From 40b5e5432f91cb53eac7027e941b17b579317378 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Fri, 10 Jan 2025 18:15:16 -0500 Subject: [PATCH 01/12] Fix IClientItemExtensions#renderHelmetOverlay never being called --- patches/net/minecraft/client/gui/Gui.java.patch | 9 +++++++++ .../client/extensions/common/IClientItemExtensions.java | 3 +++ 2 files changed, 12 insertions(+) diff --git a/patches/net/minecraft/client/gui/Gui.java.patch b/patches/net/minecraft/client/gui/Gui.java.patch index f48725af15..b980596d9d 100644 --- a/patches/net/minecraft/client/gui/Gui.java.patch +++ b/patches/net/minecraft/client/gui/Gui.java.patch @@ -101,6 +101,15 @@ } private void renderCameraOverlays(GuiGraphics p_316735_, DeltaTracker p_348538_) { +@@ -238,6 +_,8 @@ + Equippable equippable = itemstack.get(DataComponents.EQUIPPABLE); + if (equippable != null && equippable.slot() == equipmentslot && equippable.cameraOverlay().isPresent()) { + this.renderTextureOverlay(p_316735_, equippable.cameraOverlay().get().withPath(p_380782_ -> "textures/" + p_380782_ + ".png"), 1.0F); ++ } else { ++ net.neoforged.neoforge.client.extensions.common.IClientItemExtensions.of(itemstack).renderHelmetOverlay(itemstack, this.minecraft.player, p_316735_.guiWidth(), p_316735_.guiHeight(), p_348538_.getGameTimeDeltaPartialTick(true)); + } + } + } @@ -289,8 +_,12 @@ } diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java index 4ba1dfb5b9..ac79653701 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java @@ -23,6 +23,7 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.component.DyedItemColor; +import net.minecraft.world.item.equipment.Equippable; import net.neoforged.fml.LogicalSide; import net.neoforged.neoforge.client.ClientHooks; import net.neoforged.neoforge.client.IArmPoseTransformer; @@ -145,6 +146,8 @@ default void setupModelAnimations(LivingEntity livingEntity, ItemStack itemStack * Called when the client starts rendering the HUD, and is wearing this item in the helmet slot. *

* This is where pumpkins would render their overlay. + *

+ * Note: Only use this if {@link Equippable#cameraOverlay()} doesn't suit your use case * * @param stack The item stack * @param player The player entity From 943b02b2cb353f1ac22927122283d37b4c9883e7 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Fri, 10 Jan 2025 19:31:57 -0500 Subject: [PATCH 02/12] add more context to the method --- patches/net/minecraft/client/gui/Gui.java.patch | 2 +- .../extensions/common/IClientItemExtensions.java | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/patches/net/minecraft/client/gui/Gui.java.patch b/patches/net/minecraft/client/gui/Gui.java.patch index b980596d9d..7fe3d1496c 100644 --- a/patches/net/minecraft/client/gui/Gui.java.patch +++ b/patches/net/minecraft/client/gui/Gui.java.patch @@ -106,7 +106,7 @@ if (equippable != null && equippable.slot() == equipmentslot && equippable.cameraOverlay().isPresent()) { this.renderTextureOverlay(p_316735_, equippable.cameraOverlay().get().withPath(p_380782_ -> "textures/" + p_380782_ + ".png"), 1.0F); + } else { -+ net.neoforged.neoforge.client.extensions.common.IClientItemExtensions.of(itemstack).renderHelmetOverlay(itemstack, this.minecraft.player, p_316735_.guiWidth(), p_316735_.guiHeight(), p_348538_.getGameTimeDeltaPartialTick(true)); ++ net.neoforged.neoforge.client.extensions.common.IClientItemExtensions.of(itemstack).renderHelmetOverlay(itemstack, this.minecraft.player, p_316735_, p_348538_); } } } diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java index ac79653701..41f4fbf1ed 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java @@ -6,7 +6,9 @@ package net.neoforged.neoforge.client.extensions.common; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.DeltaTracker; import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.Model; import net.minecraft.client.player.LocalPlayer; @@ -149,13 +151,12 @@ default void setupModelAnimations(LivingEntity livingEntity, ItemStack itemStack *

* Note: Only use this if {@link Equippable#cameraOverlay()} doesn't suit your use case * - * @param stack The item stack - * @param player The player entity - * @param width The viewport width - * @param height Viewport height - * @param partialTick Partial tick time, useful for interpolation + * @param stack The item stack + * @param player The player entity + * @param guiGraphics The gui graphics + * @param deltaTracker The delta tracker */ - default void renderHelmetOverlay(ItemStack stack, Player player, int width, int height, float partialTick) {} + default void renderHelmetOverlay(ItemStack stack, Player player, GuiGraphics guiGraphics, DeltaTracker deltaTracker) {} /** * {@return Whether the item should bob when rendered in the world as an entity} From a0e84abf218f3a513d4c5843ba4dd46411107090 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Sun, 12 Jan 2025 12:00:09 -0500 Subject: [PATCH 03/12] Update method --- .../net/minecraft/client/gui/Gui.java.patch | 18 +++++++++++++----- .../common/IClientItemExtensions.java | 4 ++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/patches/net/minecraft/client/gui/Gui.java.patch b/patches/net/minecraft/client/gui/Gui.java.patch index 7fe3d1496c..9ddd3d3f74 100644 --- a/patches/net/minecraft/client/gui/Gui.java.patch +++ b/patches/net/minecraft/client/gui/Gui.java.patch @@ -101,12 +101,20 @@ } private void renderCameraOverlays(GuiGraphics p_316735_, DeltaTracker p_348538_) { -@@ -238,6 +_,8 @@ +@@ -236,8 +_,14 @@ + for (EquipmentSlot equipmentslot : EquipmentSlot.values()) { + ItemStack itemstack = this.minecraft.player.getItemBySlot(equipmentslot); Equippable equippable = itemstack.get(DataComponents.EQUIPPABLE); - if (equippable != null && equippable.slot() == equipmentslot && equippable.cameraOverlay().isPresent()) { - this.renderTextureOverlay(p_316735_, equippable.cameraOverlay().get().withPath(p_380782_ -> "textures/" + p_380782_ + ".png"), 1.0F); -+ } else { -+ net.neoforged.neoforge.client.extensions.common.IClientItemExtensions.of(itemstack).renderHelmetOverlay(itemstack, this.minecraft.player, p_316735_, p_348538_); +- if (equippable != null && equippable.slot() == equipmentslot && equippable.cameraOverlay().isPresent()) { +- this.renderTextureOverlay(p_316735_, equippable.cameraOverlay().get().withPath(p_380782_ -> "textures/" + p_380782_ + ".png"), 1.0F); ++ if (equippable != null && equippable.slot() == equipmentslot) { ++ if (equippable.cameraOverlay().isPresent()) { ++ this.renderTextureOverlay(p_316735_, equippable.cameraOverlay().get().withPath(p_380782_ -> "textures/" + p_380782_ + ".png"), 1.0F); ++ } ++ ++ if (equipmentslot == EquipmentSlot.HEAD) { ++ net.neoforged.neoforge.client.extensions.common.IClientItemExtensions.of(itemstack).renderFirstPersonOverlay(itemstack, this.minecraft.player, p_316735_, p_348538_); ++ } } } } diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java index 41f4fbf1ed..a32aaa0c2c 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java @@ -145,7 +145,7 @@ default Model getGenericArmorModel(ItemStack itemStack, EquipmentClientInfo.Laye default void setupModelAnimations(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, Model model, float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, float netHeadYaw, float headPitch) {} /** - * Called when the client starts rendering the HUD, and is wearing this item in the helmet slot. + * Called when the client starts rendering the HUD, and is wearing this item in the head equipment slot. *

* This is where pumpkins would render their overlay. *

@@ -156,7 +156,7 @@ default void setupModelAnimations(LivingEntity livingEntity, ItemStack itemStack * @param guiGraphics The gui graphics * @param deltaTracker The delta tracker */ - default void renderHelmetOverlay(ItemStack stack, Player player, GuiGraphics guiGraphics, DeltaTracker deltaTracker) {} + default void renderFirstPersonOverlay(ItemStack stack, Player player, GuiGraphics guiGraphics, DeltaTracker deltaTracker) {} /** * {@return Whether the item should bob when rendered in the world as an entity} From d70772035e6634d432b5155ae46870d5936e6b8d Mon Sep 17 00:00:00 2001 From: IThundxr Date: Sun, 12 Jan 2025 14:13:01 -0500 Subject: [PATCH 04/12] update javadocs --- .../common/IClientItemExtensions.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java index a32aaa0c2c..8772e0d807 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java @@ -145,18 +145,22 @@ default Model getGenericArmorModel(ItemStack itemStack, EquipmentClientInfo.Laye default void setupModelAnimations(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, Model model, float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, float netHeadYaw, float headPitch) {} /** - * Called when the client starts rendering the HUD, and is wearing this item in the head equipment slot. + * Called to render an overlay on the first-person camera. *

- * This is where pumpkins would render their overlay. + * Called after the client camera overlay + * provided by the {@link DataComponents#EQUIPPABLE Equipable data component} is rendered if it's present, + * such as the pumpkin overlay. *

- * Note: Only use this if {@link Equippable#cameraOverlay()} doesn't suit your use case + * This method should be used if the overlay is dynamic or has dynamic components. + * For a static overlay, prefer using {@link Equippable#cameraOverlay()}. * - * @param stack The item stack - * @param player The player entity - * @param guiGraphics The gui graphics - * @param deltaTracker The delta tracker + * @param stack The item stack that the player is wearing + * @param equipmentSlot The slot in which the player is wearing the above item stack + * @param player The player entity + * @param guiGraphics The gui graphics + * @param deltaTracker The delta tracker */ - default void renderFirstPersonOverlay(ItemStack stack, Player player, GuiGraphics guiGraphics, DeltaTracker deltaTracker) {} + default void renderFirstPersonOverlay(ItemStack stack, EquipmentSlot equipmentSlot, Player player, GuiGraphics guiGraphics, DeltaTracker deltaTracker) {} /** * {@return Whether the item should bob when rendered in the world as an entity} From 921912169897fed6ca4622ac6de0b3bceed89b97 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Sun, 12 Jan 2025 14:16:11 -0500 Subject: [PATCH 05/12] genpatch --- patches/net/minecraft/client/gui/Gui.java.patch | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/patches/net/minecraft/client/gui/Gui.java.patch b/patches/net/minecraft/client/gui/Gui.java.patch index 9ddd3d3f74..799abace32 100644 --- a/patches/net/minecraft/client/gui/Gui.java.patch +++ b/patches/net/minecraft/client/gui/Gui.java.patch @@ -101,7 +101,7 @@ } private void renderCameraOverlays(GuiGraphics p_316735_, DeltaTracker p_348538_) { -@@ -236,8 +_,14 @@ +@@ -236,8 +_,13 @@ for (EquipmentSlot equipmentslot : EquipmentSlot.values()) { ItemStack itemstack = this.minecraft.player.getItemBySlot(equipmentslot); Equippable equippable = itemstack.get(DataComponents.EQUIPPABLE); @@ -112,9 +112,8 @@ + this.renderTextureOverlay(p_316735_, equippable.cameraOverlay().get().withPath(p_380782_ -> "textures/" + p_380782_ + ".png"), 1.0F); + } + -+ if (equipmentslot == EquipmentSlot.HEAD) { -+ net.neoforged.neoforge.client.extensions.common.IClientItemExtensions.of(itemstack).renderFirstPersonOverlay(itemstack, this.minecraft.player, p_316735_, p_348538_); -+ } ++ net.neoforged.neoforge.client.extensions.common.IClientItemExtensions.of(itemstack) ++ .renderFirstPersonOverlay(itemstack, equipmentslot, this.minecraft.player, p_316735_, p_348538_); } } } From a41b458237a3e1b49f5d888a59254a9a4c0ff35f Mon Sep 17 00:00:00 2001 From: IThundxr Date: Mon, 13 Jan 2025 10:33:19 -0500 Subject: [PATCH 06/12] Update Gui.java.patch --- patches/net/minecraft/client/gui/Gui.java.patch | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/patches/net/minecraft/client/gui/Gui.java.patch b/patches/net/minecraft/client/gui/Gui.java.patch index 799abace32..e573d66866 100644 --- a/patches/net/minecraft/client/gui/Gui.java.patch +++ b/patches/net/minecraft/client/gui/Gui.java.patch @@ -101,7 +101,7 @@ } private void renderCameraOverlays(GuiGraphics p_316735_, DeltaTracker p_348538_) { -@@ -236,8 +_,13 @@ +@@ -236,8 +_,12 @@ for (EquipmentSlot equipmentslot : EquipmentSlot.values()) { ItemStack itemstack = this.minecraft.player.getItemBySlot(equipmentslot); Equippable equippable = itemstack.get(DataComponents.EQUIPPABLE); @@ -112,8 +112,7 @@ + this.renderTextureOverlay(p_316735_, equippable.cameraOverlay().get().withPath(p_380782_ -> "textures/" + p_380782_ + ".png"), 1.0F); + } + -+ net.neoforged.neoforge.client.extensions.common.IClientItemExtensions.of(itemstack) -+ .renderFirstPersonOverlay(itemstack, equipmentslot, this.minecraft.player, p_316735_, p_348538_); ++ net.neoforged.neoforge.client.extensions.common.IClientItemExtensions.of(itemstack).renderFirstPersonOverlay(itemstack, equipmentslot, this.minecraft.player, p_316735_, p_348538_); } } } From 9ca9dbf0db8a8b1c4822f212b83f46e539bca2aa Mon Sep 17 00:00:00 2001 From: IThundxr Date: Mon, 13 Jan 2025 10:36:14 -0500 Subject: [PATCH 07/12] Update IClientItemExtensions.java --- .../client/extensions/common/IClientItemExtensions.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java index 8772e0d807..9152dc22cf 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java @@ -147,9 +147,8 @@ default void setupModelAnimations(LivingEntity livingEntity, ItemStack itemStack /** * Called to render an overlay on the first-person camera. *

- * Called after the client camera overlay - * provided by the {@link DataComponents#EQUIPPABLE Equipable data component} is rendered if it's present, - * such as the pumpkin overlay. + * If the client camera overlay provided by the {@link DataComponents#EQUIPPABLE Equipable data component} is present, + * such as for a pumpkin, this will be called after it is rendered. *

* This method should be used if the overlay is dynamic or has dynamic components. * For a static overlay, prefer using {@link Equippable#cameraOverlay()}. From fc937d4c6befffd54f46cd1afa5f0bb330455366 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Tue, 14 Jan 2025 13:54:22 -0500 Subject: [PATCH 08/12] Update javadocs --- .../client/extensions/common/IClientItemExtensions.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java index 9152dc22cf..eb7762ee83 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java @@ -147,8 +147,9 @@ default void setupModelAnimations(LivingEntity livingEntity, ItemStack itemStack /** * Called to render an overlay on the first-person camera. *

- * If the client camera overlay provided by the {@link DataComponents#EQUIPPABLE Equipable data component} is present, - * such as for a pumpkin, this will be called after it is rendered. + * This method will always be called to render a overlay, regardless of whether the client camera overlay provided + * by the {@link DataComponents#EQUIPPABLE Equipable data component} is present. If the equippable overlay is present + * (e.g. the pumpkin overlay), this method will be called after it has been rendered. *

* This method should be used if the overlay is dynamic or has dynamic components. * For a static overlay, prefer using {@link Equippable#cameraOverlay()}. From 1a5bca1cd3bfa55d1785a39a81ee4010a9b6baa7 Mon Sep 17 00:00:00 2001 From: dhyces <10985914+dhyces@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:09:49 -0500 Subject: [PATCH 09/12] Add client test and grammar fixes --- .../common/IClientItemExtensions.java | 4 +-- .../neoforge/debug/client/ClientTests.java | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java index eb7762ee83..5190dfecca 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java @@ -147,8 +147,8 @@ default void setupModelAnimations(LivingEntity livingEntity, ItemStack itemStack /** * Called to render an overlay on the first-person camera. *

- * This method will always be called to render a overlay, regardless of whether the client camera overlay provided - * by the {@link DataComponents#EQUIPPABLE Equipable data component} is present. If the equippable overlay is present + * This method will always be called to render an overlay, regardless of whether the client camera overlay provided + * by the {@link DataComponents#EQUIPPABLE Equippable data component} is present. If the equippable overlay is present * (e.g. the pumpkin overlay), this method will be called after it has been rendered. *

* This method should be used if the overlay is dynamic or has dynamic components. diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/client/ClientTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/client/ClientTests.java index b89c9e5394..f04e4432d0 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/client/ClientTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/client/ClientTests.java @@ -9,8 +9,11 @@ import java.nio.ByteBuffer; import java.util.concurrent.CompletableFuture; import javax.sound.sampled.AudioFormat; +import net.minecraft.client.DeltaTracker; import net.minecraft.client.KeyMapping; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.sounds.AbstractSoundInstance; @@ -21,7 +24,10 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundSource; +import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.phys.Vec3; import net.neoforged.api.distmarker.Dist; @@ -29,6 +35,8 @@ import net.neoforged.neoforge.client.event.ClientTickEvent; import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent; import net.neoforged.neoforge.client.event.TextureAtlasStitchedEvent; +import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions; +import net.neoforged.neoforge.client.extensions.common.RegisterClientExtensionsEvent; import net.neoforged.neoforge.common.data.LanguageProvider; import net.neoforged.testframework.DynamicTest; import net.neoforged.testframework.annotation.ForEachTest; @@ -107,6 +115,30 @@ static void namespacedDirectoryListerTest(final DynamicTest test) { }); } + @TestHolder(description = "Tests that helmets with custom rendering work", enabledByDefault = true) + static void customHelmetRendering(final DynamicTest test) { + var item = test.registrationHelper().items().registerItem("neo_helmet", properties -> new Item(properties.equippable(EquipmentSlot.HEAD))); + test.framework().modEventBus().addListener((final RegisterClientExtensionsEvent event) -> { + event.registerItem(new IClientItemExtensions() { + @Override + public void renderFirstPersonOverlay(ItemStack stack, EquipmentSlot equipmentSlot, Player player, GuiGraphics guiGraphics, DeltaTracker deltaTracker) { + guiGraphics.blit( + RenderType::guiTexturedOverlay, + ResourceLocation.withDefaultNamespace("textures/block/stone.png"), + 0, + 0, + 0, + 0, + guiGraphics.guiWidth(), + guiGraphics.guiHeight(), + guiGraphics.guiWidth(), + guiGraphics.guiHeight(), + -1); + } + }, item); + }); + } + private static final class SineSound extends AbstractSoundInstance { SineSound(Vec3 position) { super(ResourceLocation.fromNamespaceAndPath("neotests_audio_stream_test", "sine_wave"), SoundSource.BLOCKS, SoundInstance.createUnseededRandom()); From 0efd3d07f96b4c742c5c5aa64e5c7927ff8490c5 Mon Sep 17 00:00:00 2001 From: dhyces <10985914+dhyces@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:14:58 -0500 Subject: [PATCH 10/12] Request confirmation --- .../java/net/neoforged/neoforge/debug/client/ClientTests.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/client/ClientTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/client/ClientTests.java index f04e4432d0..c84aa7bab6 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/client/ClientTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/client/ClientTests.java @@ -38,6 +38,7 @@ import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions; import net.neoforged.neoforge.client.extensions.common.RegisterClientExtensionsEvent; import net.neoforged.neoforge.common.data.LanguageProvider; +import net.neoforged.neoforge.event.entity.player.PlayerEvent; import net.neoforged.testframework.DynamicTest; import net.neoforged.testframework.annotation.ForEachTest; import net.neoforged.testframework.annotation.TestHolder; @@ -137,6 +138,9 @@ public void renderFirstPersonOverlay(ItemStack stack, EquipmentSlot equipmentSlo } }, item); }); + test.framework().modEventBus().addListener((final PlayerEvent.PlayerLoggedInEvent event) -> { + test.requestConfirmation(event.getEntity(), Component.literal("Does stone cover the screen when wearing the *_custom_helmet_rendering:neo_helmet?")); + }); } private static final class SineSound extends AbstractSoundInstance { From 3b578242466d0e9057376637f0dc64ed4f828fb2 Mon Sep 17 00:00:00 2001 From: dhyces <10985914+dhyces@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:32:40 -0500 Subject: [PATCH 11/12] Fix bus --- .../java/net/neoforged/neoforge/debug/client/ClientTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/main/java/net/neoforged/neoforge/debug/client/ClientTests.java b/tests/src/main/java/net/neoforged/neoforge/debug/client/ClientTests.java index c84aa7bab6..63cc542c93 100644 --- a/tests/src/main/java/net/neoforged/neoforge/debug/client/ClientTests.java +++ b/tests/src/main/java/net/neoforged/neoforge/debug/client/ClientTests.java @@ -138,7 +138,7 @@ public void renderFirstPersonOverlay(ItemStack stack, EquipmentSlot equipmentSlo } }, item); }); - test.framework().modEventBus().addListener((final PlayerEvent.PlayerLoggedInEvent event) -> { + test.eventListeners().forge().addListener((final PlayerEvent.PlayerLoggedInEvent event) -> { test.requestConfirmation(event.getEntity(), Component.literal("Does stone cover the screen when wearing the *_custom_helmet_rendering:neo_helmet?")); }); } From 6d5e15590d1151b1c978add51b368379dfec0105 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Tue, 14 Jan 2025 17:04:46 -0500 Subject: [PATCH 12/12] Update src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java Co-authored-by: ChampionAsh5357 --- .../client/extensions/common/IClientItemExtensions.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java index 5190dfecca..5533e4223c 100644 --- a/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java +++ b/src/main/java/net/neoforged/neoforge/client/extensions/common/IClientItemExtensions.java @@ -155,7 +155,7 @@ default void setupModelAnimations(LivingEntity livingEntity, ItemStack itemStack * For a static overlay, prefer using {@link Equippable#cameraOverlay()}. * * @param stack The item stack that the player is wearing - * @param equipmentSlot The slot in which the player is wearing the above item stack + * @param equipmentSlot The slot in which the player is wearing or holding the above item stack * @param player The player entity * @param guiGraphics The gui graphics * @param deltaTracker The delta tracker