From 722bb103f31b1277e80a261adf74775a8517884f Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 13 Aug 2016 22:35:15 +0200 Subject: [PATCH] Fixed infinite tilling of worms Closes #204 --- .../actuallyadditions/mod/items/ItemWorm.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWorm.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWorm.java index 0250e07d9..b4ad54970 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWorm.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWorm.java @@ -64,11 +64,13 @@ public class ItemWorm extends ItemBase{ World world = event.getWorld(); if(!world.isRemote){ BlockPos pos = event.getPos(); - IBlockState state = world.getBlockState(pos); - if(state.getBlock() instanceof BlockGrass && world.rand.nextFloat() >= 0.95F){ - ItemStack stack = new ItemStack(InitItems.itemWorm, world.rand.nextInt(2)+1); - EntityItem item = new EntityItem(event.getWorld(), pos.getX()+0.5, pos.getY()+1, pos.getZ()+0.5, stack); - world.spawnEntityInWorld(item); + if(world.isAirBlock(pos.up())){ + IBlockState state = world.getBlockState(pos); + if(state.getBlock() instanceof BlockGrass && world.rand.nextFloat() >= 0.95F){ + ItemStack stack = new ItemStack(InitItems.itemWorm, world.rand.nextInt(2)+1); + EntityItem item = new EntityItem(event.getWorld(), pos.getX()+0.5, pos.getY()+1, pos.getZ()+0.5, stack); + world.spawnEntityInWorld(item); + } } } }