Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.21.4] Fix IClientItemExtensions#renderHelmetOverlay never being called #1837

Open
wants to merge 2 commits into
base: 1.21.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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_, p_348538_);
}
}
}
@@ -289,8 +_,12 @@
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -23,6 +25,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,14 +148,15 @@ 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
* @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}
Expand Down
Loading