Add support for bonus chest configuration in WorldCreator (#12344)

This commit is contained in:
David
2025-04-14 17:24:19 +02:00
committed by GitHub
parent de410d13ef
commit 33e8928f53
5 changed files with 39 additions and 3 deletions

View File

@@ -250,7 +250,7 @@
+ // Paper start - expose FeatureElement wrapper for GameRules.Type.
+ // Chosen over simply adding this to the inheritance to avoid reobf issues with spigot...
+ public net.minecraft.world.flag.FeatureElement asFeatureElement() {
+ return net.minecraft.world.level.GameRules.Type.this::requiredFeatures;
+ return GameRules.Type.this::requiredFeatures;
+ }
+ // Paper end - expose FeatureElement wrapper for GameRules.Type.
}

View File

@@ -1345,7 +1345,7 @@ public final class CraftServer implements Server {
registryAccess = levelDataAndDimensions.dimensions().dimensionsRegistryAccess();
} else {
LevelSettings levelSettings;
WorldOptions worldOptions = new WorldOptions(creator.seed(), creator.generateStructures(), false);
WorldOptions worldOptions = new WorldOptions(creator.seed(), creator.generateStructures(), creator.bonusChest());
WorldDimensions worldDimensions;
DedicatedServerProperties.WorldDimensionData properties = new DedicatedServerProperties.WorldDimensionData(GsonHelper.parse((creator.generatorSettings().isEmpty()) ? "{}" : creator.generatorSettings()), creator.type().name().toLowerCase(Locale.ROOT));

View File

@@ -1620,6 +1620,11 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return this.world.serverLevelData.worldGenOptions().generateStructures();
}
@Override
public boolean hasBonusChest() {
return this.world.serverLevelData.worldGenOptions().generateBonusChest();
}
@Override
public boolean isHardcore() {
return this.world.getLevelData().isHardcore();