Made worms fertilize more often

This commit is contained in:
Ellpeck 2016-07-23 13:43:43 +02:00
parent 1fd25ec885
commit 43229f2d20

View file

@ -75,14 +75,18 @@ public class EntityWorm extends Entity{
} }
} }
if(isFarmland && this.worldObj.rand.nextFloat() >= 0.95F){ if(isFarmland && this.worldObj.rand.nextFloat() >= 0.8F){
BlockPos plant = pos.up(); BlockPos plant = pos.up();
if(!this.worldObj.isAirBlock(plant)){ if(!this.worldObj.isAirBlock(plant)){
IBlockState plantState = this.worldObj.getBlockState(plant); IBlockState plantState = this.worldObj.getBlockState(plant);
Block plantBlock = plantState.getBlock(); Block plantBlock = plantState.getBlock();
plantBlock.updateTick(this.worldObj, plant, plantState, Util.RANDOM); plantBlock.updateTick(this.worldObj, plant, plantState, Util.RANDOM);
this.worldObj.playEvent(2005, plant, 0);
IBlockState newState = this.worldObj.getBlockState(plant);
if(newState.getBlock().getMetaFromState(newState) != plantBlock.getMetaFromState(plantState)){
this.worldObj.playEvent(2005, plant, 0);
}
} }
} }
} }