Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Called when a Block is right-clicked with this Item
- */
- public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
- {
- BlockPos blockpos = pos.offset(facing);
- ItemStack caught = new ItemStack(IntegratedItems.caught);
- Entity entity = EntityList.createEntityByName(caught.getTagCompound().getString("entity"), worldIn);
- if (playerIn.canPlayerEdit(blockpos, facing, stack))
- {
- //EntityHanging entityhanging = this.createEntity(worldIn, blockpos, facing);
- if (entity != null) //&& entityhanging.onValidSurface())
- {
- if (!worldIn.isRemote)
- {
- //entity.play();
- worldIn.spawnEntityInWorld(entity);
- }
- --stack.stackSize;
- }
- return EnumActionResult.SUCCESS;
- }
- else
- {
- return EnumActionResult.FAIL;
- }
- }
Add Comment
Please, Sign In to add comment