Fixed infinite tilling of worms

Closes #204
This commit is contained in:
Ellpeck 2016-08-13 22:35:15 +02:00
parent 018e2603d5
commit 722bb103f3

View file

@ -64,6 +64,7 @@ public class ItemWorm extends ItemBase{
World world = event.getWorld(); World world = event.getWorld();
if(!world.isRemote){ if(!world.isRemote){
BlockPos pos = event.getPos(); BlockPos pos = event.getPos();
if(world.isAirBlock(pos.up())){
IBlockState state = world.getBlockState(pos); IBlockState state = world.getBlockState(pos);
if(state.getBlock() instanceof BlockGrass && world.rand.nextFloat() >= 0.95F){ if(state.getBlock() instanceof BlockGrass && world.rand.nextFloat() >= 0.95F){
ItemStack stack = new ItemStack(InitItems.itemWorm, world.rand.nextInt(2)+1); ItemStack stack = new ItemStack(InitItems.itemWorm, world.rand.nextInt(2)+1);
@ -73,6 +74,7 @@ public class ItemWorm extends ItemBase{
} }
} }
} }
}
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){