Advertisement
Guest User

Untitled

a guest
Sep 7th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. public class ItemTest extends ItemNk{
  2.  
  3.     private String tip;
  4.  
  5.     public ItemTest() {
  6.         super("test_item");
  7.     }
  8.  
  9.     @Override
  10.     @SideOnly(Side.CLIENT)
  11.     public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
  12.         if(!(tip==null)) {
  13.             tooltip.add("\u00a7a" + tip);
  14.         }
  15.     }
  16.  
  17.  
  18.     @Override
  19.     public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
  20.  
  21.         tip = worldIn.getBlockState(pos).getBlock().getLocalizedName();
  22.         if (!worldIn.isRemote) {
  23.             playerIn.addChatMessage(new TextComponentString("Block set to " + tip));
  24.         }
  25.         return EnumActionResult.SUCCESS;
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement