SPIGOT-5141: World.generateTree() causes ClassCastException with huge mushrooms

This commit is contained in:
md_5 2019-07-06 10:13:00 +10:00
parent 31d4a777c7
commit a2275f19e9

View File

@ -80,6 +80,7 @@ import net.minecraft.server.TicketType;
import net.minecraft.server.Unit; import net.minecraft.server.Unit;
import net.minecraft.server.Vec3D; import net.minecraft.server.Vec3D;
import net.minecraft.server.WorldGenFeatureEmptyConfiguration; import net.minecraft.server.WorldGenFeatureEmptyConfiguration;
import net.minecraft.server.WorldGenHugeMushroomConfiguration;
import net.minecraft.server.WorldGenerator; import net.minecraft.server.WorldGenerator;
import net.minecraft.server.WorldNBTStorage; import net.minecraft.server.WorldNBTStorage;
import net.minecraft.server.WorldServer; import net.minecraft.server.WorldServer;
@ -571,6 +572,7 @@ public class CraftWorld implements World {
BlockPosition pos = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); BlockPosition pos = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
net.minecraft.server.WorldGenerator gen; net.minecraft.server.WorldGenerator gen;
net.minecraft.server.WorldGenFeatureConfiguration conf = new WorldGenFeatureEmptyConfiguration();
switch (type) { switch (type) {
case BIG_TREE: case BIG_TREE:
gen = WorldGenerator.FANCY_TREE; gen = WorldGenerator.FANCY_TREE;
@ -598,9 +600,11 @@ public class CraftWorld implements World {
break; break;
case RED_MUSHROOM: case RED_MUSHROOM:
gen = WorldGenerator.HUGE_RED_MUSHROOM; gen = WorldGenerator.HUGE_RED_MUSHROOM;
conf = new WorldGenHugeMushroomConfiguration(true);
break; break;
case BROWN_MUSHROOM: case BROWN_MUSHROOM:
gen = WorldGenerator.HUGE_BROWN_MUSHROOM; gen = WorldGenerator.HUGE_BROWN_MUSHROOM;
conf = new WorldGenHugeMushroomConfiguration(true);
break; break;
case SWAMP: case SWAMP:
gen = WorldGenerator.SWAMP_TREE; gen = WorldGenerator.SWAMP_TREE;
@ -626,7 +630,7 @@ public class CraftWorld implements World {
break; break;
} }
return gen.generate(world, world.worldProvider.getChunkGenerator(), rand, pos, new WorldGenFeatureEmptyConfiguration()); return gen.generate(world, world.worldProvider.getChunkGenerator(), rand, pos, conf);
} }
@Override @Override