From aa2f3da629c82cbf3f2fe98515ad0c65e7592190 Mon Sep 17 00:00:00 2001 From: alexbegt Date: Wed, 11 Apr 2018 12:44:39 -0400 Subject: [PATCH] Fix Topiary grasses not allowing flowers to be planted on them. Closes #440 --- .../block/grass/BlockColoredGrass.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main/java/com/progwml6/natura/overworld/block/grass/BlockColoredGrass.java b/src/main/java/com/progwml6/natura/overworld/block/grass/BlockColoredGrass.java index 167324e5..0337639f 100644 --- a/src/main/java/com/progwml6/natura/overworld/block/grass/BlockColoredGrass.java +++ b/src/main/java/com/progwml6/natura/overworld/block/grass/BlockColoredGrass.java @@ -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 @@ -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;