Nerfed the worm a little more and made sure he only actually ticks plants

This commit is contained in:
Ellpeck 2016-08-06 14:07:08 +02:00
parent 97c9e0f454
commit 997e9c634c

View file

@ -11,10 +11,7 @@
package de.ellpeck.actuallyadditions.mod.entity; package de.ellpeck.actuallyadditions.mod.entity;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.Block; import net.minecraft.block.*;
import net.minecraft.block.BlockBush;
import net.minecraft.block.BlockDirt;
import net.minecraft.block.BlockFarmland;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
@ -78,12 +75,13 @@ public class EntityWorm extends Entity{
} }
} }
if(isFarmland && this.worldObj.rand.nextFloat() >= 0.9F){ if(isFarmland && this.worldObj.rand.nextFloat() >= 0.95F){
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();
if((plantBlock instanceof IGrowable || plantBlock instanceof IPlantable) && !(plantBlock instanceof BlockGrass)){
plantBlock.updateTick(this.worldObj, plant, plantState, Util.RANDOM); plantBlock.updateTick(this.worldObj, plant, plantState, Util.RANDOM);
IBlockState newState = this.worldObj.getBlockState(plant); IBlockState newState = this.worldObj.getBlockState(plant);
@ -93,6 +91,7 @@ public class EntityWorm extends Entity{
} }
} }
} }
}
else if(isMiddlePose){ else if(isMiddlePose){
this.setDead(); this.setDead();
} }