Skip to content

Commit

Permalink
Fix data stick render not working when holding shift (#3329)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Robertz <dream-master@gmx.net>
  • Loading branch information
serenibyss and Dream-Master authored Oct 5, 2024
1 parent bd24e8e commit 90cf10f
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public <T extends Item & IGT_ItemWithMaterialRenderer> 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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand All @@ -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);
}
}
}

0 comments on commit 90cf10f

Please sign in to comment.