Skip to content

Commit

Permalink
Fix Topiary grasses not allowing flowers to be planted on them. Closes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbegt committed Apr 11, 2018
1 parent ca0cecf commit aa2f3da
Showing 1 changed file with 19 additions and 0 deletions.
Expand Up @@ -7,7 +7,13 @@
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
import slimeknights.mantle.block.EnumBlock;

public class BlockColoredGrass extends EnumBlock<BlockColoredGrass.GrassType>
Expand All @@ -23,6 +29,19 @@ public BlockColoredGrass()
this.setSoundType(SoundType.PLANT);
}

@Override
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable)
{
EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));

if (plantType == EnumPlantType.Plains)
{
return true;
}

return super.canSustainPlant(state, world, pos, direction, plantable);
}

public enum GrassType implements IStringSerializable, EnumBlock.IEnumMeta
{
TOPIARY, BLUEGRASS, AUTUMNAL;
Expand Down

0 comments on commit aa2f3da

Please sign in to comment.