From 90cf10f06294b6bdeb48c5b2d19cb5decf378324 Mon Sep 17 00:00:00 2001 From: Maya <10861407+serenibyss@users.noreply.github.com> Date: Sat, 5 Oct 2024 08:08:19 -0500 Subject: [PATCH] Fix data stick render not working when holding shift (#3329) Co-authored-by: Martin Robertz --- .../render/items/MetaGeneratedItemRenderer.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/gregtech/common/render/items/MetaGeneratedItemRenderer.java b/src/main/java/gregtech/common/render/items/MetaGeneratedItemRenderer.java index f0a614e3e64..8a2163a2afb 100644 --- a/src/main/java/gregtech/common/render/items/MetaGeneratedItemRenderer.java +++ b/src/main/java/gregtech/common/render/items/MetaGeneratedItemRenderer.java @@ -33,7 +33,7 @@ public void registerItem(T item) public static void registerSpecialRenderer(ItemList item, IItemRenderer renderer) { specialRenderers.put( new RendererKey( - Item.getIdFromItem(item.getItem()), + item.getItem(), (short) item.getInternalStack_unsafe() .getItemDamage()), renderer); @@ -67,7 +67,7 @@ public void renderItem(ItemRenderType type, ItemStack aStack, Object... data) { private IItemRenderer getRendererForItemStack(ItemStack aStack) { final short aMetaData = (short) aStack.getItemDamage(); - final RendererKey key = new RendererKey(Item.getIdFromItem(aStack.getItem()), aMetaData); + final RendererKey key = new RendererKey(aStack.getItem(), aMetaData); if (specialRenderers.containsKey(key)) { return specialRenderers.get(key); @@ -97,11 +97,11 @@ private IItemRenderer getRendererForItemStack(ItemStack aStack) { @SuppressWarnings("ClassCanBeRecord") private static class RendererKey { - private final int id; + private final Item item; private final short metadata; - private RendererKey(final int id, final short metadata) { - this.id = id; + private RendererKey(final Item item, final short metadata) { + this.item = item; this.metadata = metadata; } @@ -110,12 +110,12 @@ public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final RendererKey that = (RendererKey) o; - return id == that.id && metadata == that.metadata; + return item == that.item && metadata == that.metadata; } @Override public int hashCode() { - return Objects.hashCode(id, metadata); + return Objects.hashCode(item, metadata); } } }