Skip to content

Commit 768de73

Browse files
committed
Override method 'getTranslationKey'
1 parent e022619 commit 768de73

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/main/java/hellfirepvp/modularmachinery/common/item/ItemBlockCustomName.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,15 @@ public String getUnlocalizedNameInefficiently(@Nonnull ItemStack stack) {
4444
}
4545
return super.getUnlocalizedNameInefficiently(stack);
4646
}
47+
@Nonnull
48+
@Override
49+
public String getTranslationKey(@Nonnull ItemStack stack)
50+
{
51+
Block block = getBlock();
52+
if (block instanceof BlockCustomName) {
53+
String identifier = ((BlockCustomName) block).getIdentifierForMeta(stack.getItemDamage());
54+
return super.getTranslationKey(stack) + "." + identifier;
55+
}
56+
return super.getTranslationKey(stack);
57+
}
4758
}

0 commit comments

Comments
 (0)