Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //UUID Set
- public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target) {
- if (target instanceof EntityWorker && !playerIn.worldObj.isRemote){
- NBTTagCompound tag = new NBTTagCompound();
- UUID id = target.getPersistentID();
- playerIn.addChatComponentMessage(new ChatComponentText("ID: " + id));
- tag.setString("id",id.toString());
- stack.setTagCompound(tag);
- }
- return super.itemInteractionForEntity(stack, playerIn, target);
- }
- //UUID Retrieved
- public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
- if (player.isSneaking()) {
- // ...
- } else {
- NBTTagCompound tag = stack.getTagCompound();
- if (tag!=null){
- if (tag.hasKey("id")) {
- String idStr = tag.getString("id");
- UUID id = UUID.fromString(idStr);
- // doesn't even get here ...
- }
- }
- }
- return super.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement