mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 21:17:00 +01:00
SPIGOT-4975: NPE on WorldGenStronghold When Using Multiple Worlds
This commit is contained in:
parent
65ea162ce2
commit
c03b2befb2
2 changed files with 33 additions and 0 deletions
22
nms-patches/ChunkGenerator.patch
Normal file
22
nms-patches/ChunkGenerator.patch
Normal file
|
@ -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());
|
11
nms-patches/WorldGenStronghold.patch
Normal file
11
nms-patches/WorldGenStronghold.patch
Normal file
|
@ -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 {
|
Loading…
Reference in a new issue