Skip to content

Commit

Permalink
Fix IClientItemExtensions#renderHelmetOverlay never being called
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Jan 10, 2025
1 parent 821e47f commit 40b5e54
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions patches/net/minecraft/client/gui/Gui.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
* <p>
* This is where pumpkins would render their overlay.
* <p>
* Note: Only use this if {@link Equippable#cameraOverlay()} doesn't suit your use case
*
* @param stack The item stack
* @param player The player entity
Expand Down

0 comments on commit 40b5e54

Please sign in to comment.