Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. @SubscribeEvent
  2. public boolean createAttachedPlant (PlayerInteractEvent event){
  3. ItemStack item = event.entityPlayer.getHeldItem();
  4.  
  5.  
  6. World worldIn = event.world;
  7. EntityPlayer playerIn = event.entityPlayer;
  8. BlockPos pos = event.pos;
  9. EnumFacing side = event.face;
  10.  
  11.  
  12. IBlockState iblockstate = worldIn.getBlockState(pos);
  13. Block block = iblockstate.getBlock();
  14.  
  15. float hitX;
  16. float hitY;
  17. float hitZ;
  18.  
  19.  
  20. if (item == null || item.getItem() != SkyraveItems.COCONUT_SEEDS) {
  21. return false;
  22. } else if (block == Blocks.log && iblockstate.getValue(BlockPlanks.VARIANT) == BlockPlanks.EnumType.JUNGLE) {
  23. if (worldIn.isAirBlock(pos)) {
  24. IBlockState iblockstate1 = SkyraveBlocks.COCONUT_BLOCK.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, 0, playerIn);
  25. worldIn.setBlockState(pos, iblockstate1, 2);
  26.  
  27. if (!playerIn.capabilities.isCreativeMode) {
  28. --item.stackSize;
  29. }
  30. }
  31.  
  32. return true;
  33.  
  34. }
  35. return false;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement