Skip to content

Commit

Permalink
Update method
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Jan 12, 2025
1 parent 943b02b commit a0e84ab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
18 changes: 13 additions & 5 deletions patches/net/minecraft/client/gui/Gui.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
+ }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <p>
* This is where pumpkins would render their overlay.
* <p>
Expand All @@ -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}
Expand Down

0 comments on commit a0e84ab

Please sign in to comment.