Guest User

Untitled

a guest
Nov 14th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. /**
  2. * Called when a Block is right-clicked with this Item
  3. */
  4. public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
  5. {
  6. BlockPos blockpos = pos.offset(facing);
  7.  
  8. ItemStack caught = new ItemStack(IntegratedItems.caught);
  9.  
  10. Entity entity = EntityList.createEntityByName(caught.getTagCompound().getString("entity"), worldIn);
  11.  
  12. if (playerIn.canPlayerEdit(blockpos, facing, stack))
  13. {
  14. //EntityHanging entityhanging = this.createEntity(worldIn, blockpos, facing);
  15.  
  16. if (entity != null) //&& entityhanging.onValidSurface())
  17. {
  18. if (!worldIn.isRemote)
  19. {
  20. //entity.play();
  21. worldIn.spawnEntityInWorld(entity);
  22. }
  23.  
  24. --stack.stackSize;
  25. }
  26.  
  27. return EnumActionResult.SUCCESS;
  28. }
  29. else
  30. {
  31. return EnumActionResult.FAIL;
  32. }
  33. }
Add Comment
Please, Sign In to add comment