Fix Melon/Pumpkin stems having wrong plat type causing them to remain after trampling farmland. Fixes #9495

This commit is contained in:
LexManos committed 2023-10-11 22:54:55 -07:00
1 parent a1aacf25fe
commit e9ee999558
1 file changed
+8 -6
@@ -9,23 +9,25 @@ import net.minecraft.world.level.block.CropBlock;
import net.minecraft.world.level.block.FlowerBlock;
import net.minecraft.world.level.block.SaplingBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.AttachedStemBlock;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
public interface IPlantable
{
public interface IPlantable {
default PlantType getPlantType(BlockGetter level, BlockPos pos) {
if (this instanceof CropBlock || this == Blocks.PITCHER_CROP) return PlantType.CROP;
if (this instanceof SaplingBlock) return PlantType.PLAINS;
if (this instanceof FlowerBlock) return PlantType.PLAINS;
if (this instanceof AttachedStemBlock) return PlantType.CROP;
if (this instanceof CropBlock) return PlantType.CROP;
if (this instanceof SaplingBlock) return PlantType.PLAINS;
if (this instanceof FlowerBlock) return PlantType.PLAINS;
if (this == Blocks.PITCHER_CROP) return PlantType.CROP;
if (this == Blocks.DEAD_BUSH) return PlantType.DESERT;
if (this == Blocks.LILY_PAD) return PlantType.WATER;
if (this == Blocks.RED_MUSHROOM) return PlantType.CAVE;
if (this == Blocks.BROWN_MUSHROOM) return PlantType.CAVE;
if (this == Blocks.NETHER_WART) return PlantType.NETHER;
if (this == Blocks.TALL_GRASS) return PlantType.PLAINS;
return net.minecraftforge.common.PlantType.PLAINS;
return PlantType.PLAINS;
}
BlockState getPlant(BlockGetter level, BlockPos pos);