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.1] Fix IClientItemExtensions#renderHelmetOverlay never being called #1836

Merged
Merged
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 @@
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
Loading