Address gen concurrency issue causing crashes (Fixes #2746)

This commit is contained in:
Shane Freeder
2019-12-16 01:38:00 +00:00
parent f6fcec51bb
commit bbaca0408f
3 changed files with 65 additions and 28 deletions

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Fix some generation concurrency issues
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 9889b0543..e80cb3b97 100644
index 66e1745836..d7a7720996 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -32,8 +32,34 @@ index 9889b0543..e80cb3b97 100644
public CraftWorld getWorld() {
return this.world;
diff --git a/src/main/java/net/minecraft/server/WorldGenFeatureStateProviderWeighted.java b/src/main/java/net/minecraft/server/WorldGenFeatureStateProviderWeighted.java
index 22e14fe1e9..e2af6d43b2 100644
--- a/src/main/java/net/minecraft/server/WorldGenFeatureStateProviderWeighted.java
+++ b/src/main/java/net/minecraft/server/WorldGenFeatureStateProviderWeighted.java
@@ -0,0 +0,0 @@ public class WorldGenFeatureStateProviderWeighted extends WorldGenFeatureStatePr
this(new WeightedList<>(dynamic.get("entries").orElseEmptyList(), IBlockData::a));
}
- public WorldGenFeatureStateProviderWeighted a(IBlockData iblockdata, int i) {
+ public synchronized WorldGenFeatureStateProviderWeighted a(IBlockData iblockdata, int i) { // Paper
this.b.a(iblockdata, i);
return this;
}
@Override
- public IBlockData a(Random random, BlockPosition blockposition) {
+ public synchronized IBlockData a(Random random, BlockPosition blockposition) { // Paper
return (IBlockData) this.b.b(random);
}
@Override
- public <T> T a(DynamicOps<T> dynamicops) {
+ public synchronized <T> T a(DynamicOps<T> dynamicops) { // Paper
Builder<T, T> builder = ImmutableMap.builder();
builder.put(dynamicops.createString("type"), dynamicops.createString(IRegistry.t.getKey(this.a).toString())).put(dynamicops.createString("entries"), this.b.a(dynamicops, (iblockdata) -> {
diff --git a/src/main/java/net/minecraft/server/WorldGenStronghold.java b/src/main/java/net/minecraft/server/WorldGenStronghold.java
index b34a0683a..e002ed53f 100644
index b34a0683a1..e002ed53f6 100644
--- a/src/main/java/net/minecraft/server/WorldGenStronghold.java
+++ b/src/main/java/net/minecraft/server/WorldGenStronghold.java
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;