Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. public class IMetaItemBlock extends ItemColored {
  2.  
  3. protected IProperty mappingProperty;
  4.  
  5. public IMetaItemBlock(Block block) {
  6. super(block, true);
  7. }
  8.  
  9. @Nonnull
  10. @Override
  11. public String getUnlocalizedName(@Nonnull ItemStack stack) {
  12. if (mappingProperty == null) {
  13. return super.getUnlocalizedName(stack);
  14. }
  15.  
  16. IBlockState state = block.getStateFromMeta(stack.getMetadata());
  17. String name = state.getValue(mappingProperty).toString().toLowerCase(Locale.US);
  18. return super.getUnlocalizedName(stack) + "." + name;
  19. }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement