3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-16 19:40:07 +01:00

SPIGOT-4975: NPE on WorldGenStronghold When Using Multiple Worlds

Dieser Commit ist enthalten in:
md_5 2019-07-22 16:03:02 +10:00
Ursprung 65ea162ce2
Commit c03b2befb2
2 geänderte Dateien mit 33 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,22 @@
--- a/net/minecraft/server/ChunkGenerator.java
+++ b/net/minecraft/server/ChunkGenerator.java
@@ -148,6 +148,19 @@
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
StructureStart structurestart = StructureStart.a;
+ // CraftBukkit start
+ if (structuregenerator == WorldGenerator.STRONGHOLD) {
+ synchronized (structuregenerator) {
+ if (structuregenerator.a(chunkgenerator, seededrandom, chunkcoordintpair.x, chunkcoordintpair.z)) {
+ BiomeBase biomebase = this.getWorldChunkManager().getBiome(new BlockPosition(chunkcoordintpair.d() + 9, 0, chunkcoordintpair.e() + 9));
+ StructureStart structurestart1 = structuregenerator.a().create(structuregenerator, chunkcoordintpair.x, chunkcoordintpair.z, biomebase, StructureBoundingBox.a(), 0, chunkgenerator.getSeed());
+
+ structurestart1.a(this, definedstructuremanager, chunkcoordintpair.x, chunkcoordintpair.z, biomebase);
+ structurestart = structurestart1.e() ? structurestart1 : StructureStart.a;
+ }
+ }
+ } else
+ // CraftBukkit end
if (structuregenerator.a(chunkgenerator, seededrandom, chunkcoordintpair.x, chunkcoordintpair.z)) {
BiomeBase biomebase = this.getWorldChunkManager().getBiome(new BlockPosition(chunkcoordintpair.d() + 9, 0, chunkcoordintpair.e() + 9));
StructureStart structurestart1 = structuregenerator.a().create(structuregenerator, chunkcoordintpair.x, chunkcoordintpair.z, biomebase, StructureBoundingBox.a(), 0, chunkgenerator.getSeed());

Datei anzeigen

@ -0,0 +1,11 @@
--- a/net/minecraft/server/WorldGenStronghold.java
+++ b/net/minecraft/server/WorldGenStronghold.java
@@ -67,7 +67,7 @@
@Nullable
@Override
- public BlockPosition getNearestGeneratedFeature(World world, ChunkGenerator<? extends GeneratorSettingsDefault> chunkgenerator, BlockPosition blockposition, int i, boolean flag) {
+ public synchronized BlockPosition getNearestGeneratedFeature(World world, ChunkGenerator<? extends GeneratorSettingsDefault> chunkgenerator, BlockPosition blockposition, int i, boolean flag) { // CraftBukkit - synchronized
if (!chunkgenerator.getWorldChunkManager().a(this)) {
return null;
} else {