Add workaround (temporary I hope) for a forge bug

This commit is contained in:
Cheeserolls 2015-06-11 11:26:12 +01:00
parent 24d3b3cf5e
commit 4cdbc7c294

View file

@ -16,6 +16,7 @@ import biomesoplenty.common.item.ItemBOPBlock;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockDirt; import net.minecraft.block.BlockDirt;
import net.minecraft.block.BlockGrass; import net.minecraft.block.BlockGrass;
import net.minecraft.block.BlockReed;
import net.minecraft.block.BlockTallGrass; import net.minecraft.block.BlockTallGrass;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
@ -113,10 +114,13 @@ public class BlockBOPGrass extends BlockGrass implements IBOPBlock
@Override @Override
public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable)
{ {
// Workaround for bug in forge - BlockReed calls this function with the wrong block position
if (plantable instanceof BlockReed) {pos = pos.down();}
IBlockState state = world.getBlockState(pos); IBlockState state = world.getBlockState(pos);
net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));
switch ((BOPGrassType) state.getValue(VARIANT)) switch ((BOPGrassType) state.getValue(VARIANT))
{ {
// smoldering grass supports no plants // smoldering grass supports no plants