Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - @SubscribeEvent
 - public boolean createAttachedPlant (PlayerInteractEvent event){
 - ItemStack item = event.entityPlayer.getHeldItem();
 - World worldIn = event.world;
 - EntityPlayer playerIn = event.entityPlayer;
 - BlockPos pos = event.pos;
 - EnumFacing side = event.face;
 - IBlockState iblockstate = worldIn.getBlockState(pos);
 - Block block = iblockstate.getBlock();
 - float hitX;
 - float hitY;
 - float hitZ;
 - if (item == null || item.getItem() != SkyraveItems.COCONUT_SEEDS) {
 - return false;
 - } else if (block == Blocks.log && iblockstate.getValue(BlockPlanks.VARIANT) == BlockPlanks.EnumType.JUNGLE) {
 - if (worldIn.isAirBlock(pos)) {
 - IBlockState iblockstate1 = SkyraveBlocks.COCONUT_BLOCK.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, 0, playerIn);
 - worldIn.setBlockState(pos, iblockstate1, 2);
 - if (!playerIn.capabilities.isCreativeMode) {
 - --item.stackSize;
 - }
 - }
 - return true;
 - }
 - return false;
 - }
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment