Fixed tiny cacti placement

This commit is contained in:
Adubbz 2019-05-04 00:11:02 +10:00
parent 290533131e
commit 55a938e8b6

View file

@ -15,9 +15,11 @@ 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;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReaderBase;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.IPlantable;
@ -45,6 +47,19 @@ public class BlockPlantBOP extends BlockBush implements IPlantable
return Block.EnumOffsetType.XZ; return Block.EnumOffsetType.XZ;
} }
@Override
public boolean isValidPosition(IBlockState state, IWorldReaderBase worldIn, BlockPos pos)
{
Block ground = worldIn.getBlockState(pos.down()).getBlock();
if (this == BOPBlocks.tiny_cactus)
{
return ground == Blocks.SAND;
}
return super.isValidPosition(state, worldIn, pos);
}
@Override @Override
public EnumPlantType getPlantType(IBlockReader world, BlockPos pos) public EnumPlantType getPlantType(IBlockReader world, BlockPos pos)
{ {