Do not extend GrassBlock for slime grass block
Requires confirmation that it does not mess with existing worlds
package slimeknights.tconstruct.world.block;
+import net.minecraft.block.Block;
import net.minecraft.block.BlockDirt;
import net.minecraft.block.BlockGrass;
+import net.minecraft.block.IGrowable;
import net.minecraft.block.SoundType;
+import net.minecraft.block.material.Material;
+import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
@@ -11,6 +15,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.NonNullList;
@@ -32,12 +37,16 @@ import slimeknights.mantle.block.EnumBlock;
import slimeknights.tconstruct.library.TinkerRegistry;
import slimeknights.tconstruct.world.TinkerWorld;
-public class BlockSlimeGrass extends BlockGrass {
+public class BlockSlimeGrass extends Block implements IGrowable {
public static PropertyEnum<DirtType> TYPE = PropertyEnum.create("type", DirtType.class);
public static PropertyEnum<FoliageType> FOLIAGE = PropertyEnum.create("foliage", FoliageType.class);
+ public static final PropertyBool SNOWY = PropertyBool.create("snowy");
public BlockSlimeGrass() {
+ super(Material.GRASS);
+ this.setDefaultState(this.blockState.getBaseState().withProperty(SNOWY, Boolean.FALSE));
+ this.setTickRandomly(true);
this.setCreativeTab(TinkerRegistry.tabWorld);
this.setHardness(0.65f);
this.setSoundType(SoundType.PLANT);
@@ -54,6 +63,16 @@ public class BlockSlimeGrass extends BlockGrass {
}
}
+ @Override
+ public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) {
+ return true;
+ }
+
+ @Override
+ public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state) {
+ return true;
+ }
+
@Override
public void grow(@Nonnull World worldIn, @Nonnull Random rand, @Nonnull BlockPos pos, @Nonnull IBlockState state) {
BlockPos blockpos1 = pos.up();
@@ -225,6 +244,12 @@ public class BlockSlimeGrass extends BlockGrass {
return plantable.getPlantType(world, pos) == TinkerWorld.slimePlantType || plantable.getPlantType(world, pos) == EnumPlantType.Plains;
}
+ @SideOnly(Side.CLIENT)
+ public BlockRenderLayer getBlockLayer()
+ {
+ return BlockRenderLayer.CUTOUT_MIPPED;
+ }
+
public enum FoliageType implements IStringSerializable, EnumBlock.IEnumMeta {
BLUE,
PURPLE,
