Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 20:40:07 +01:00
0aa0a1d973
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing CraftBukkit Changes: b5d7883a SPIGOT-6634: Override needed method 99561c21 SPIGOT-6624: Explosions do not destroy blocks out of vanilla heights in custom dimensions
63 Zeilen
3.8 KiB
Diff
63 Zeilen
3.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Mon, 8 Jul 2019 00:13:36 -0700
|
|
Subject: [PATCH] Use getChunkIfLoadedImmediately in places
|
|
|
|
This prevents us from hitting chunk loads for chunks at or less-than
|
|
ticket level 33 (yes getChunkIfLoaded will actually perform a chunk
|
|
load in that case).
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
index db1884bde77bb46ccd65ced67928928b1e569b84..6ecf60c69a27f8db1c245db15449bba581c3dbf5 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -206,7 +206,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
|
|
}
|
|
|
|
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
|
|
- return this.chunkSource.getChunk(x, z, false);
|
|
+ return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper
|
|
}
|
|
|
|
// Paper start - Asynchronous IO
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index 6c6e5b7562d9051709f76bf968060de7212dc182..6ff04fc7202a7eb1f2b5978a2e2a573945d9dde1 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -1298,7 +1298,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
speed = this.player.getAbilities().walkingSpeed * 10f;
|
|
}
|
|
// Paper start - Prevent moving into unloaded chunks
|
|
- if (player.level.paperConfig.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.hasChunk((int) Math.floor(toX) >> 4, (int) Math.floor(toZ) >> 4)) {
|
|
+ if (player.level.paperConfig.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && worldserver.getChunkIfLoadedImmediately((int) Math.floor(toX) >> 4, (int) Math.floor(toZ) >> 4) == null) { // Paper - use getIfLoadedImmediately
|
|
this.internalTeleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot(), Collections.emptySet(), true);
|
|
return;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index b85d0222bb151ff3c7377e444a431212e262c95f..474078b68f1bf22037495f42bae59b790fd8cb46 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -192,6 +192,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
return (CraftServer) Bukkit.getServer();
|
|
}
|
|
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public boolean hasChunk(int chunkX, int chunkZ) {
|
|
+ return ((ServerLevel) this).getChunkIfLoaded(chunkX, chunkZ) != null;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
public ResourceKey<DimensionType> getTypeKey() {
|
|
return this.typeKey;
|
|
}
|
|
@@ -1371,7 +1378,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
|
|
for (int l1 = j; l1 <= l; ++l1) {
|
|
for (int i2 = k; i2 <= i1; ++i2) {
|
|
- LevelChunk chunk = this.getChunkSource().getChunkNow(l1, i2);
|
|
+ LevelChunk chunk = (LevelChunk) this.getChunkIfLoadedImmediately(l1, i2); // Paper
|
|
|
|
if (chunk != null) {
|
|
for (int j2 = j1; j2 <= k1; ++j2) {
|