From a2275f19e9a9f79fba7feb45dada7d1619b38909 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 6 Jul 2019 10:13:00 +1000 Subject: [PATCH] SPIGOT-5141: World.generateTree() causes ClassCastException with huge mushrooms --- src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index b9cf667153..c3c0d0a0f6 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -80,6 +80,7 @@ import net.minecraft.server.TicketType; import net.minecraft.server.Unit; import net.minecraft.server.Vec3D; import net.minecraft.server.WorldGenFeatureEmptyConfiguration; +import net.minecraft.server.WorldGenHugeMushroomConfiguration; import net.minecraft.server.WorldGenerator; import net.minecraft.server.WorldNBTStorage; import net.minecraft.server.WorldServer; @@ -571,8 +572,9 @@ public class CraftWorld implements World { BlockPosition pos = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); net.minecraft.server.WorldGenerator gen; + net.minecraft.server.WorldGenFeatureConfiguration conf = new WorldGenFeatureEmptyConfiguration(); switch (type) { - case BIG_TREE: + case BIG_TREE: gen = WorldGenerator.FANCY_TREE; break; case BIRCH: @@ -598,9 +600,11 @@ public class CraftWorld implements World { break; case RED_MUSHROOM: gen = WorldGenerator.HUGE_RED_MUSHROOM; + conf = new WorldGenHugeMushroomConfiguration(true); break; case BROWN_MUSHROOM: gen = WorldGenerator.HUGE_BROWN_MUSHROOM; + conf = new WorldGenHugeMushroomConfiguration(true); break; case SWAMP: gen = WorldGenerator.SWAMP_TREE; @@ -626,7 +630,7 @@ public class CraftWorld implements World { break; } - return gen.generate(world, world.worldProvider.getChunkGenerator(), rand, pos, new WorldGenFeatureEmptyConfiguration()); + return gen.generate(world, world.worldProvider.getChunkGenerator(), rand, pos, conf); } @Override