Fixed Double Plant Crash Closes#70

This commit is contained in:
canitzp 2016-02-18 21:55:37 +01:00
parent 8be363ba08
commit 353431827f
2 changed files with 6 additions and 1 deletions

View file

@ -20,6 +20,7 @@ import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDoublePlant;
import net.minecraft.block.material.Material;
import net.minecraft.util.BlockPos;
import net.minecraft.world.biome.BiomeGenOcean;
@ -91,7 +92,7 @@ public class WorldDecorationEvent{
randomPos = event.world.getTopSolidOrLiquidBlock(randomPos);
if(PosUtil.getMaterial(PosUtil.offset(randomPos, 0, -1, 0), event.world) == blockBelow){
if(plant.canPlaceBlockAt(event.world, randomPos)){
if(plant.canPlaceBlockAt(event.world, randomPos) && WorldUtil.isBlockAir(event.world, randomPos.add(0, 1, 0))){
PosUtil.setBlock(randomPos, event.world, plant, meta, 2);
}
}

View file

@ -51,6 +51,10 @@ public class WorldUtil{
}
}
public static boolean isBlockAir(World world, BlockPos pos){
return world.isAirBlock(pos);
}
public static BlockPos getCoordsFromSide(EnumFacing side, BlockPos pos, int offset){
return new BlockPos(pos.getX()+side.getFrontOffsetX()*(offset+1), pos.getY()+side.getFrontOffsetY()*(offset+1), pos.getZ()+side.getFrontOffsetZ()*(offset+1));
}