Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class IMetaItemBlock extends ItemColored {
- protected IProperty mappingProperty;
- public IMetaItemBlock(Block block) {
- super(block, true);
- }
- @Nonnull
- @Override
- public String getUnlocalizedName(@Nonnull ItemStack stack) {
- if (mappingProperty == null) {
- return super.getUnlocalizedName(stack);
- }
- IBlockState state = block.getStateFromMeta(stack.getMetadata());
- String name = state.getValue(mappingProperty).toString().toLowerCase(Locale.US);
- return super.getUnlocalizedName(stack) + "." + name;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement