Skip to content

Commit

Permalink
Fix IClientItemExtensions#renderHelmetOverlay never being called (#1836)
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr authored Jan 23, 2025
1 parent fd0bf2b commit 159fa7f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 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 @@
RenderSystem.disableDepthTest();
}

@@ -220,6 +_,8 @@
ItemStack itemstack = this.minecraft.player.getInventory().getArmor(3);
if (itemstack.is(Blocks.CARVED_PUMPKIN.asItem())) {
this.renderTextureOverlay(p_316735_, PUMPKIN_BLUR_LOCATION, 1.0F);
+ } else {
+ net.neoforged.neoforge.client.extensions.common.IClientItemExtensions.of(itemstack).renderHelmetOverlay(itemstack, this.minecraft.player, p_316735_, p_348538_);
}
}
}
@@ -262,8 +_,12 @@
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

import com.mojang.blaze3d.vertex.PoseStack;
import java.util.function.Consumer;
import net.minecraft.client.DeltaTracker;
import net.minecraft.client.Minecraft;
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 Down Expand Up @@ -143,18 +145,25 @@ default Model getGenericArmorModel(LivingEntity livingEntity, ItemStack itemStac
*/
default void setupModelAnimations(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, Model model, float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, float netHeadYaw, float headPitch) {}

/**
* @deprecated Switch to {@link IClientItemExtensions#renderHelmetOverlay(ItemStack, Player, GuiGraphics, DeltaTracker)}
*/
@Deprecated(forRemoval = true)
default void renderHelmetOverlay(ItemStack stack, Player player, int width, int height, float partialTick) {}

/**
* 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.
*
* @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) {
renderHelmetOverlay(stack, player, guiGraphics.guiWidth(), guiGraphics.guiHeight(), deltaTracker.getGameTimeDeltaPartialTick(true));
}

/**
* Queries this item's renderer.
Expand Down

0 comments on commit 159fa7f

Please sign in to comment.