Fix regenerate chunk method
This commit is contained in:
parent
44b6869fd2
commit
b327e17634
4 changed files with 15 additions and 14 deletions
|
@ -6,7 +6,7 @@ Subject: [PATCH] Implement regenerateChunk
|
|||
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index f68a1d5adac4d88c462371c484464bbea22d3147..6e36b6c722e647fe3672d782447a09030381137e 100644
|
||||
index f68a1d5adac4d88c462371c484464bbea22d3147..1bbc73dcdf890a9383795ffeb0d368293f7146a5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -139,6 +139,7 @@ import org.bukkit.util.Vector;
|
||||
|
@ -17,7 +17,7 @@ index f68a1d5adac4d88c462371c484464bbea22d3147..6e36b6c722e647fe3672d782447a0903
|
|||
|
||||
private final ServerLevel world;
|
||||
private WorldBorder worldBorder;
|
||||
@@ -431,27 +432,61 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -431,27 +432,62 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@Override
|
||||
public boolean regenerateChunk(int x, int z) {
|
||||
org.spigotmc.AsyncCatcher.catchOp("chunk regenerate"); // Spigot
|
||||
|
@ -58,7 +58,7 @@ index f68a1d5adac4d88c462371c484464bbea22d3147..6e36b6c722e647fe3672d782447a0903
|
|||
- PlayerChunk playerChunk = world.getPlayerChunkMap().getChunk(x, z);
|
||||
- if (playerChunk != null) {
|
||||
- playerChunk.chunk = chunk;
|
||||
+ final com.mojang.datafixers.util.Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure> either = chunkStatus.generate(
|
||||
+ final java.util.concurrent.CompletableFuture<com.mojang.datafixers.util.Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> future = chunkStatus.generate(
|
||||
+ Runnable::run,
|
||||
+ serverLevel,
|
||||
+ serverChunkCache.getGenerator(),
|
||||
|
@ -69,9 +69,10 @@ index f68a1d5adac4d88c462371c484464bbea22d3147..6e36b6c722e647fe3672d782447a0903
|
|||
+ },
|
||||
+ list,
|
||||
+ true
|
||||
+ ).join();
|
||||
+ );
|
||||
+ serverChunkCache.mainThreadProcessor.managedBlock(future::isDone);
|
||||
+ if (chunkStatus == ChunkStatus.NOISE) {
|
||||
+ either.left().ifPresent(chunk -> net.minecraft.world.level.levelgen.Heightmap.primeHeightmaps(chunk, ChunkStatus.POST_FEATURES));
|
||||
+ future.join().left().ifPresent(chunk -> net.minecraft.world.level.levelgen.Heightmap.primeHeightmaps(chunk, ChunkStatus.POST_FEATURES));
|
||||
+ }
|
||||
}
|
||||
|
||||
|
|
|
@ -2079,10 +2079,10 @@ index d870cefbe5b7485f423817f4f639e3e2a304640c..2292cb0e0c1a3e0ed34b941f028136bf
|
|||
|
||||
@Nullable
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 6e36b6c722e647fe3672d782447a09030381137e..17b85478749be5be2bec19e49f26e03ebae29852 100644
|
||||
index 1bbc73dcdf890a9383795ffeb0d368293f7146a5..c4f7aa9ffb72d2bc555ace64bb8cedc5c2545d8b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -2280,43 +2280,56 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -2281,43 +2281,56 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
// Spigot start
|
||||
@Override
|
||||
public int getViewDistance() {
|
||||
|
|
|
@ -21,10 +21,10 @@ index d1fca0e3227b5f37c11367548be362f5a49b6a71..5628940cd3c3566c5db2beda506d4f20
|
|||
if (Snowball.class.isAssignableFrom(clazz)) {
|
||||
entity = new net.minecraft.world.entity.projectile.Snowball(world, x, y, z);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 17b85478749be5be2bec19e49f26e03ebae29852..d7ec9ea48d6c8354bcf40599a9cc1743f64ebffc 100644
|
||||
index c4f7aa9ffb72d2bc555ace64bb8cedc5c2545d8b..3aa4363793ea0b2de4224010b51e9798bc77ec2c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -1416,7 +1416,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -1417,7 +1417,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
Validate.notNull(material, "Material cannot be null");
|
||||
Validate.isTrue(material.isBlock(), "Material must be a block");
|
||||
|
||||
|
@ -38,7 +38,7 @@ index 17b85478749be5be2bec19e49f26e03ebae29852..d7ec9ea48d6c8354bcf40599a9cc1743
|
|||
return (FallingBlock) entity.getBukkitEntity();
|
||||
}
|
||||
|
||||
@@ -1425,7 +1430,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -1426,7 +1431,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
Validate.notNull(location, "Location cannot be null");
|
||||
Validate.notNull(data, "BlockData cannot be null");
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ index 2cc45ec6a5f0b0d5c1ba44551d9a126176dfa8f6..b42327dcf0cc9feaf4fdb67de949dd36
|
|||
|
||||
if (dedicatedserverproperties.enableQuery) {
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index d8985815a947fd7007f87db8ebd2a6296899bee6..736444c288421db84ae127d7b8cb746b6edc355f 100644
|
||||
index e08e6091dc0b885275045260386c88b368954fe6..e8069222397f7143ffd662e554904ff811b386d4 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2785,7 +2785,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
|
@ -158,10 +158,10 @@ index 3c93bfeb94168f832904a8462ae23b06e81e080d..468c635d31cfa8051666bbefce8df4b4
|
|||
this.onChanged(server);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index d7ec9ea48d6c8354bcf40599a9cc1743f64ebffc..00fbf9ffdfa1c0d821ff86108c33e8b62a3d1268 100644
|
||||
index 3aa4363793ea0b2de4224010b51e9798bc77ec2c..a5d8dfc77475845be7c6d37eed04fb19eeef1c0c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -1920,7 +1920,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -1921,7 +1921,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
// Paper end
|
||||
GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule));
|
||||
handle.deserialize(event.getValue()); // Paper
|
||||
|
@ -170,7 +170,7 @@ index d7ec9ea48d6c8354bcf40599a9cc1743f64ebffc..00fbf9ffdfa1c0d821ff86108c33e8b6
|
|||
return true;
|
||||
}
|
||||
|
||||
@@ -1960,7 +1960,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -1961,7 +1961,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
// Paper end
|
||||
GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule.getName()));
|
||||
handle.deserialize(event.getValue()); // Paper
|
||||
|
|
Loading…
Reference in a new issue