mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 08:57:35 +01:00
More patches
This commit is contained in:
parent
ec4ada852e
commit
c9907c650f
@ -87,7 +87,7 @@ index 0ffff5329fa2c7833f9ec71528cb7f951cf78109..bf2d91bbb4bf401696f5f5d14a67e392
|
||||
if (damager != null) {
|
||||
event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damager.getBukkitEntity(), source.is(DamageTypeTags.IS_EXPLOSION) ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.ENTITY);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
index 4b94e21d05d6deae75f0c2fb711e43a4c7d06f90..8db431cb9778cd38c8e7ef939a055c4b72232c75 100644
|
||||
index 4b94e21d05d6deae75f0c2fb711e43a4c7d06f90..662b55f69fb4284cbeb0e08b4b63353d498e0217 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
@@ -271,7 +271,7 @@ public class Creeper extends Monster implements PowerableMob {
|
||||
@ -95,7 +95,7 @@ index 4b94e21d05d6deae75f0c2fb711e43a4c7d06f90..8db431cb9778cd38c8e7ef939a055c4b
|
||||
// CraftBukkit end
|
||||
this.dead = true;
|
||||
- this.level().explode(this, net.minecraft.world.level.Explosion.getDefaultDamageSource(this.level(), this).customCausingEntity(this.entityIgniter), null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit
|
||||
+ this.level().explode(this, net.minecraft.world.level.Explosion.getDefaultDamageSource(this.level(), this).customEventDamager(this.entityIgniter), null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit
|
||||
+ this.level().explode(this, net.minecraft.world.level.Explosion.getDefaultDamageSource(this.level(), this).customEventDamager(this.entityIgniter), null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit // Paper - fix DamageSource API
|
||||
this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
|
||||
this.spawnLingeringCloud();
|
||||
// CraftBukkit start
|
||||
|
@ -59,7 +59,7 @@ index 6aaed8e8bf8c721fc834da5c76ac72a4c3e92458..4b002e8b75d117b726b0de274a76d359
|
||||
// Many servers tend to restart at a fixed time at xx:00 which causes an uneven distribution of requests on the
|
||||
// bStats backend. To circumvent this problem, we introduce some randomness into the initial and second delay.
|
||||
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
|
||||
index 6f2452de76e8f5fcc1367066e0e753740764eb98..e047dee632022abfe05865d1e71838be8d5d053a 100644
|
||||
index bcb6a3b3cd17ce5db9aaf6bd3ec7a0ec1b44b979..4f3cc14d48690bb183d09bb7a5ba1e23e8a0c08a 100644
|
||||
--- a/src/main/java/net/minecraft/CrashReport.java
|
||||
+++ b/src/main/java/net/minecraft/CrashReport.java
|
||||
@@ -234,6 +234,7 @@ public class CrashReport {
|
||||
@ -71,10 +71,10 @@ index 6f2452de76e8f5fcc1367066e0e753740764eb98..e047dee632022abfe05865d1e71838be
|
||||
cause = cause.getCause();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 884c0e4f58f0e374c910bc0d8b5d3ab1b8ade226..9d3cf1a14259397f806c57baa223faa7ee9eaf6b 100644
|
||||
index 4bb0cf4d4eb0b648062c40a8347298002256d39e..affc74c4650ce03aeb723619b63035d539958a8e 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -296,7 +296,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -303,7 +303,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
|
||||
public int autosavePeriod;
|
||||
public Commands vanillaCommandDispatcher;
|
||||
@ -83,7 +83,7 @@ index 884c0e4f58f0e374c910bc0d8b5d3ab1b8ade226..9d3cf1a14259397f806c57baa223faa7
|
||||
// CraftBukkit end
|
||||
// Spigot start
|
||||
public static final int TPS = 20;
|
||||
@@ -309,6 +309,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -316,6 +316,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public static long currentTickLong = 0L; // Paper - track current tick as a long
|
||||
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
||||
|
||||
@ -93,7 +93,7 @@ index 884c0e4f58f0e374c910bc0d8b5d3ab1b8ade226..9d3cf1a14259397f806c57baa223faa7
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
Thread thread = new io.papermc.paper.util.TickThread(() -> { // Paper - rewrite chunk system
|
||||
@@ -928,6 +931,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -933,6 +936,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
// CraftBukkit start
|
||||
private boolean hasStopped = false;
|
||||
private boolean hasLoggedStop = false; // Paper - Debugging
|
||||
@ -101,7 +101,7 @@ index 884c0e4f58f0e374c910bc0d8b5d3ab1b8ade226..9d3cf1a14259397f806c57baa223faa7
|
||||
private final Object stopLock = new Object();
|
||||
public final boolean hasStopped() {
|
||||
synchronized (this.stopLock) {
|
||||
@@ -943,6 +947,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -948,6 +952,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.hasStopped = true;
|
||||
}
|
||||
if (!hasLoggedStop && isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
|
||||
@ -121,7 +121,7 @@ index 884c0e4f58f0e374c910bc0d8b5d3ab1b8ade226..9d3cf1a14259397f806c57baa223faa7
|
||||
// CraftBukkit end
|
||||
if (this.metricsRecorder.isRecording()) {
|
||||
this.cancelRecordingMetrics();
|
||||
@@ -998,7 +1015,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1004,7 +1021,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
// Spigot end
|
||||
|
||||
@ -143,7 +143,7 @@ index 884c0e4f58f0e374c910bc0d8b5d3ab1b8ade226..9d3cf1a14259397f806c57baa223faa7
|
||||
}
|
||||
|
||||
public String getLocalIp() {
|
||||
@@ -1095,6 +1126,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1101,6 +1132,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
protected void runServer() {
|
||||
try {
|
||||
@ -151,7 +151,7 @@ index 884c0e4f58f0e374c910bc0d8b5d3ab1b8ade226..9d3cf1a14259397f806c57baa223faa7
|
||||
if (!this.initServer()) {
|
||||
throw new IllegalStateException("Failed to initialize server");
|
||||
}
|
||||
@@ -1104,6 +1136,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1110,6 +1142,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.status = this.buildServerStatus();
|
||||
|
||||
// Spigot start
|
||||
@ -170,7 +170,7 @@ index 884c0e4f58f0e374c910bc0d8b5d3ab1b8ade226..9d3cf1a14259397f806c57baa223faa7
|
||||
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
|
||||
Arrays.fill( this.recentTps, 20 );
|
||||
// Paper start - further improve server tick loop
|
||||
@@ -1185,6 +1229,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1204,6 +1248,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis);
|
||||
}
|
||||
} catch (Throwable throwable) {
|
||||
@ -183,7 +183,7 @@ index 884c0e4f58f0e374c910bc0d8b5d3ab1b8ade226..9d3cf1a14259397f806c57baa223faa7
|
||||
MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable);
|
||||
CrashReport crashreport = MinecraftServer.constructOrExtractCrashReport(throwable);
|
||||
|
||||
@@ -1209,15 +1259,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1228,15 +1278,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.services.profileCache().clearExecutor();
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ index 884c0e4f58f0e374c910bc0d8b5d3ab1b8ade226..9d3cf1a14259397f806c57baa223faa7
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1286,6 +1336,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1343,6 +1393,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@Override
|
||||
public TickTask wrapRunnable(Runnable runnable) {
|
||||
@ -216,16 +216,16 @@ index 884c0e4f58f0e374c910bc0d8b5d3ab1b8ade226..9d3cf1a14259397f806c57baa223faa7
|
||||
return new TickTask(this.tickCount, runnable);
|
||||
}
|
||||
|
||||
@@ -2111,7 +2167,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -2178,7 +2234,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.worldData.setDataConfiguration(worlddataconfiguration);
|
||||
this.resources.managers.updateRegistryTags(this.registryAccess());
|
||||
net.minecraft.world.item.alchemy.PotionBrewing.reload(); // Paper - Custom Potion Mixes
|
||||
this.resources.managers.updateRegistryTags();
|
||||
this.potionBrewing.reload(this.worldData.enabledFeatures()); // Paper - Custom Potion Mixes
|
||||
- this.getPlayerList().saveAll();
|
||||
+ // Paper start
|
||||
+ if (Thread.currentThread() != this.serverThread) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // this.getPlayerList().saveAll(); // Paper - we don't need to save everything, just advancements
|
||||
+ // this.getPlayerList().saveAll(); // Paper - we don't need to save everything, just advancements // TODO Move this to a different patch
|
||||
+ for (ServerPlayer player : this.getPlayerList().getPlayers()) {
|
||||
+ player.getAdvancements().save();
|
||||
+ }
|
||||
@ -234,10 +234,10 @@ index 884c0e4f58f0e374c910bc0d8b5d3ab1b8ade226..9d3cf1a14259397f806c57baa223faa7
|
||||
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
|
||||
this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager);
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 27546cdf3a4d6954e7b5639ec18fcf554be4d092..68d268b6fff126e8645b6deec3fb549ea2286b77 100644
|
||||
index 89c2c26afc5f06c4f57716cadbebabb8854f3635..eb4fc900164d1fb3a78653ae8bc42ea30323f5b7 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -310,7 +310,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -325,7 +325,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
long j = Util.getNanos() - i;
|
||||
String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D);
|
||||
|
||||
@ -246,7 +246,7 @@ index 27546cdf3a4d6954e7b5639ec18fcf554be4d092..68d268b6fff126e8645b6deec3fb549e
|
||||
if (dedicatedserverproperties.announcePlayerAchievements != null) {
|
||||
((GameRules.BooleanValue) this.getGameRules().getRule(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)).set(dedicatedserverproperties.announcePlayerAchievements, this.overworld()); // CraftBukkit - per-world
|
||||
}
|
||||
@@ -438,7 +438,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -459,7 +459,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
// this.remoteStatusListener.stop(); // Paper - don't wait for remote connections
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ index 27546cdf3a4d6954e7b5639ec18fcf554be4d092..68d268b6fff126e8645b6deec3fb549e
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -819,7 +820,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -840,7 +841,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@Override
|
||||
public void stopServer() {
|
||||
super.stopServer();
|
||||
@ -266,10 +266,10 @@ index 27546cdf3a4d6954e7b5639ec18fcf554be4d092..68d268b6fff126e8645b6deec3fb549e
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 37245ff682837e7e8c9647f4afe30f0dd87cb384..594cb6ce4bfa6c42212000a1ed983ea95ee2c4bf 100644
|
||||
index 65803c0927103e3ae63d8d8616f42090e736508b..3e3bca13578ab9e5b6ca0159383bee0b2a60a86e 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -613,7 +613,7 @@ public abstract class PlayerList {
|
||||
@@ -611,7 +611,7 @@ public abstract class PlayerList {
|
||||
this.cserver.getPluginManager().callEvent(playerQuitEvent);
|
||||
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
|
||||
|
||||
@ -279,10 +279,10 @@ index 37245ff682837e7e8c9647f4afe30f0dd87cb384..594cb6ce4bfa6c42212000a1ed983ea9
|
||||
|
||||
// Paper start - Configurable player collision; Remove from collideRule team if needed
|
||||
diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
index 03e8707258e9b73cf12a4750270ab7573bb1c812..d0dbe7e3c7c9c2727d5de456808765b2666108e4 100644
|
||||
index 2510589400b3012b827efcab477c6483d9d55901..43487a9ee202c5b0e5a416519939111f77b3059c 100644
|
||||
--- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
+++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
||||
@@ -148,6 +148,7 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
|
||||
@@ -150,6 +150,7 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
|
||||
try {
|
||||
task.run();
|
||||
} catch (Exception var3) {
|
||||
@ -291,10 +291,10 @@ index 03e8707258e9b73cf12a4750270ab7573bb1c812..d0dbe7e3c7c9c2727d5de456808765b2
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 16e0b4bcc903e6decbdf66ac4fb3d0dc261dbded..983dad7ecc58033ecb6f523f7aef24de122417e8 100644
|
||||
index a0d0c7d55158a00e0ca4bfaab67bb5c7f80f2a74..799db7d6229de9e4b7b97da91037dc8fed5b379e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -935,6 +935,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -927,6 +927,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
try {
|
||||
tickConsumer.accept(entity);
|
||||
} catch (Throwable throwable) {
|
||||
@ -303,10 +303,10 @@ index 16e0b4bcc903e6decbdf66ac4fb3d0dc261dbded..983dad7ecc58033ecb6f523f7aef24de
|
||||
final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
|
||||
MinecraftServer.LOGGER.error(msg, throwable);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index 2eeb0c78f2b717b59542b6b668371558ae2fcc25..6ec3fc801453fd54c25b642e6fa71c19b463311d 100644
|
||||
index 424c4613e202c6ba50fa0de65d2526d400a8e299..2a8609e33716949ff1877b6d10f64a9d7a7c81e9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -1176,6 +1176,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -1179,6 +1179,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
|
||||
gameprofilerfiller.pop();
|
||||
} catch (Throwable throwable) {
|
||||
@ -315,10 +315,10 @@ index 2eeb0c78f2b717b59542b6b668371558ae2fcc25..6ec3fc801453fd54c25b642e6fa71c19
|
||||
final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
|
||||
net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index b131a84865d9160d1b5d411515b69e967dbda66c..8d626fadcd4743b6472a2954d2b1b2ec89669814 100644
|
||||
index 3b8a2de79c79302626f43f320b15bae52416cc37..c097f5d5fbd51cbbc01bbd54101905c59b3f3a4c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -186,6 +186,36 @@ public class Main {
|
||||
@@ -187,6 +187,36 @@ public class Main {
|
||||
|
||||
OptionSet options = null;
|
||||
|
||||
@ -355,7 +355,7 @@ index b131a84865d9160d1b5d411515b69e967dbda66c..8d626fadcd4743b6472a2954d2b1b2ec
|
||||
try {
|
||||
options = parser.parse(args);
|
||||
} catch (joptsimple.OptionException ex) {
|
||||
@@ -297,8 +327,65 @@ public class Main {
|
||||
@@ -298,8 +328,65 @@ public class Main {
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
@ -468,7 +468,7 @@ index e3b262add194a126e731c68e68f3139a00cacacb..da7d5efd76c9ef92e9ce22860fec7918
|
||||
String[] split = restartScript.split( " " );
|
||||
if ( split.length > 0 && new File( split[0] ).isFile() )
|
||||
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
index a284d3b8526a743ba4389ec5b44d80af6d0e5a5f..0234555978d1b13051f876a257e47bafad37b0f8 100644
|
||||
index 9e5d08f57aa448552d100ca892c211d44441ef68..577f29519156f33b49ee319a64a52249630e28d8 100644
|
||||
--- a/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
@@ -11,6 +11,7 @@ import org.bukkit.Bukkit;
|
||||
@ -532,13 +532,13 @@ index a284d3b8526a743ba4389ec5b44d80af6d0e5a5f..0234555978d1b13051f876a257e47baf
|
||||
break;
|
||||
} // Paper end
|
||||
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
|
||||
index 32e64b3866bdd1489a90339bda2268adafbb15de..675cd61221e807aadf28322b46c3daa1370241b5 100644
|
||||
index 637d64da9938e51a97338b9253b43889585c67bb..d2a75850af9c6ad2aca66a5f994f1b587d73eac4 100644
|
||||
--- a/src/main/resources/log4j2.xml
|
||||
+++ b/src/main/resources/log4j2.xml
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
-<Configuration status="WARN" packages="com.mojang.util">
|
||||
+<Configuration status="WARN" packages="com.mojang.util" shutdownHook="disable">
|
||||
-<Configuration status="WARN">
|
||||
+<Configuration status="WARN" shutdownHook="disable">
|
||||
<Appenders>
|
||||
<Queue name="ServerGuiConsole">
|
||||
<PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg%n" />
|
||||
<PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg{nolookups}%n" />
|
@ -5,31 +5,11 @@ Subject: [PATCH] Write SavedData IO async
|
||||
|
||||
Co-Authored-By: Shane Freeder <theboyetronic@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
|
||||
index 513833c2ea23df5b079d157bc5cb89d5c9754c0b..9017907c0ec67a37a506f09b7e4499cef7885279 100644
|
||||
--- a/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
|
||||
+++ b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java
|
||||
@@ -97,6 +97,15 @@ public class ThreadedWorldUpgrader {
|
||||
}
|
||||
|
||||
this.threadPool.execute(new ConvertTask(info, regionPos.x >> 5, regionPos.z >> 5));
|
||||
+ // Paper start - Write SavedData IO async
|
||||
+ this.threadPool.execute(() -> {
|
||||
+ try {
|
||||
+ worldPersistentData.close();
|
||||
+ } catch (IOException exception) {
|
||||
+ LOGGER.error("Failed to close persistent world data", exception);
|
||||
+ }
|
||||
+ });
|
||||
+ // Paper end - Write SavedData IO async
|
||||
}
|
||||
this.threadPool.shutdown();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 5afbb5b307cc67d86dd916dc8f7521d5d021e056..4e0f80b26f1a1703184e38d739996b9919699fec 100644
|
||||
index c7b7f153895a4b95b2071a31db00c9c4b69fa094..0b7a38b9e92b19345a34c6226413a9b133264077 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -452,6 +452,13 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -447,6 +447,13 @@ public class ServerChunkCache extends ChunkSource {
|
||||
|
||||
public void close(boolean save) { // Paper - rewrite chunk system
|
||||
this.level.chunkTaskScheduler.chunkHolderManager.close(save, true); // Paper - rewrite chunk system
|
||||
@ -44,10 +24,10 @@ index 5afbb5b307cc67d86dd916dc8f7521d5d021e056..4e0f80b26f1a1703184e38d739996b99
|
||||
|
||||
// CraftBukkit start - modelled on below
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 6f497b95fd870a32c56590c00b2b39f88c51ecb9..4f2d30e8ffe228952db64d0122a8958e33f841fa 100644
|
||||
index ed8e875fff01c6b464fbaefbb0a3f417f9d67a72..aba5f694b25507c9ab2e214bc1f25e0a895e8a95 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1318,7 +1318,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1324,7 +1324,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
try (co.aikar.timings.Timing ignored = this.timings.worldSave.startTiming()) {
|
||||
if (doFull) {
|
||||
@ -56,7 +36,7 @@ index 6f497b95fd870a32c56590c00b2b39f88c51ecb9..4f2d30e8ffe228952db64d0122a8958e
|
||||
}
|
||||
|
||||
this.timings.worldSaveChunks.startTiming(); // Paper
|
||||
@@ -1354,7 +1354,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1360,7 +1360,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
|
||||
}
|
||||
|
||||
@ -65,7 +45,7 @@ index 6f497b95fd870a32c56590c00b2b39f88c51ecb9..4f2d30e8ffe228952db64d0122a8958e
|
||||
if (progressListener != null) {
|
||||
progressListener.progressStage(Component.translatable("menu.savingChunks"));
|
||||
}
|
||||
@@ -1377,12 +1377,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1383,12 +1383,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
@ -81,48 +61,50 @@ index 6f497b95fd870a32c56590c00b2b39f88c51ecb9..4f2d30e8ffe228952db64d0122a8958e
|
||||
|
||||
public <T extends Entity> List<? extends T> getEntities(EntityTypeTest<Entity, T> filter, Predicate<? super T> predicate) {
|
||||
diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
index f2a7cb6ebed7a4b4019a09af2a025f624f6fe9c9..77dd632a266f4abed30b87b7909d77857c01e316 100644
|
||||
index 7984f17cd9c4cef8100909b6c33b3144c8096fcf..868c9bbb12c8cfe76abb62774cf08102b727063b 100644
|
||||
--- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
+++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
@@ -224,7 +224,13 @@ public class WorldUpgrader {
|
||||
}
|
||||
}
|
||||
|
||||
- this.overworldDataStorage.save();
|
||||
+ // Paper start - Write SavedData IO async
|
||||
+ try {
|
||||
+ this.overworldDataStorage.close();
|
||||
+ } catch (IOException exception) {
|
||||
+ LOGGER.error("Failed to close persistent world data", exception);
|
||||
+ }
|
||||
+ // Paper end - Write SavedData IO async
|
||||
i = Util.getMillis() - i;
|
||||
WorldUpgrader.LOGGER.info("World optimizaton finished after {} ms", i);
|
||||
this.finished = true;
|
||||
@@ -116,7 +116,13 @@ public class WorldUpgrader {
|
||||
(new WorldUpgrader.PoiUpgrader(this)).upgrade();
|
||||
WorldUpgrader.LOGGER.info("Upgrading blocks");
|
||||
(new WorldUpgrader.ChunkUpgrader()).upgrade();
|
||||
- this.overworldDataStorage.save();
|
||||
+ // Paper start - Write SavedData IO async
|
||||
+ try {
|
||||
+ this.overworldDataStorage.close();
|
||||
+ } catch (final IOException e) {
|
||||
+ LOGGER.error("Failed to close persistent world data", e);
|
||||
+ }
|
||||
+ // Paper end - Write SavedData IO async
|
||||
i = Util.getMillis() - i;
|
||||
WorldUpgrader.LOGGER.info("World optimizaton finished after {} seconds", i / 1000L);
|
||||
this.finished = true;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/saveddata/SavedData.java b/src/main/java/net/minecraft/world/level/saveddata/SavedData.java
|
||||
index 697df9a9f050c0130246ce2b08a859965bddf184..0655a26a58b3df19d81b18abf6b8ab81fd000ef7 100644
|
||||
index 9cc3850bb70dfbcf342651360314a19fd9ea3ecc..4cbb943b702baaeb8bfd2b558cc848e719cf095d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/saveddata/SavedData.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/saveddata/SavedData.java
|
||||
@@ -29,20 +29,34 @@ public abstract class SavedData {
|
||||
@@ -30,20 +30,36 @@ public abstract class SavedData {
|
||||
return this.dirty;
|
||||
}
|
||||
|
||||
+ @io.papermc.paper.annotation.DoNotUse // Paper - Write SavedData IO async - This is dead
|
||||
public void save(File file) {
|
||||
+ save(file, null).join(); // Paper - Write SavedData IO async - joining is evil, but we assume the old blocking behavior here just for safety
|
||||
+ // Paper start - Write SavedData IO async - joining is evil, but we assume the old blocking behavior here just for safety
|
||||
+ @io.papermc.paper.annotation.DoNotUse
|
||||
public void save(File file, HolderLookup.Provider registryLookup) {
|
||||
+ save(file, registryLookup, null).join();
|
||||
+ }
|
||||
+
|
||||
+ public java.util.concurrent.CompletableFuture<Void> save(File file, @org.jetbrains.annotations.Nullable java.util.concurrent.ExecutorService ioExecutor) { // Paper - Write SavedData IO async
|
||||
+ public java.util.concurrent.CompletableFuture<Void> save(File file, HolderLookup.Provider registryLookup, @org.jetbrains.annotations.Nullable java.util.concurrent.ExecutorService ioExecutor) {
|
||||
+ // Paper end - Write SavedData IO async
|
||||
if (this.isDirty()) {
|
||||
CompoundTag compoundTag = new CompoundTag();
|
||||
compoundTag.put("data", this.save(new CompoundTag()));
|
||||
compoundTag.put("data", this.save(new CompoundTag(), registryLookup));
|
||||
NbtUtils.addCurrentDataVersion(compoundTag);
|
||||
|
||||
+ Runnable writeRunnable = () -> { // Paper - Write SavedData IO async
|
||||
try {
|
||||
NbtIo.writeCompressed(compoundTag, file.toPath());
|
||||
} catch (IOException var4) {
|
||||
LOGGER.error("Could not save data {}", this, var4);
|
||||
} catch (IOException var5) {
|
||||
LOGGER.error("Could not save data {}", this, var5);
|
||||
}
|
||||
+ }; // Paper - Write SavedData IO async
|
||||
|
||||
@ -137,12 +119,12 @@ index 697df9a9f050c0130246ce2b08a859965bddf184..0655a26a58b3df19d81b18abf6b8ab81
|
||||
+ // Paper end - Write SavedData IO async
|
||||
}
|
||||
|
||||
public static record Factory<T extends SavedData>(Supplier<T> constructor, Function<CompoundTag, T> deserializer, DataFixTypes type) {
|
||||
public static record Factory<T extends SavedData>(
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
index de44680d9bc34c6ce22e12c3008019c8c6803437..b89bd2d046e99d0c4848579a5ab4385453358b89 100644
|
||||
index 7d98d2911e9d6ec429ce7df1f1f2650c7ea32325..6e23e69abd56eeda3b52a22019e1b74ae10682e7 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
@@ -20,15 +20,18 @@ import net.minecraft.util.datafix.DataFixTypes;
|
||||
@@ -23,17 +23,19 @@ import net.minecraft.util.datafix.DataFixTypes;
|
||||
import net.minecraft.world.level.saveddata.SavedData;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@ -151,18 +133,19 @@ index de44680d9bc34c6ce22e12c3008019c8c6803437..b89bd2d046e99d0c4848579a5ab43854
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public final Map<String, SavedData> cache = Maps.newHashMap();
|
||||
private final DataFixer fixerUpper;
|
||||
private final HolderLookup.Provider registries;
|
||||
private final File dataFolder;
|
||||
+ protected final java.util.concurrent.ExecutorService ioExecutor; // Paper - Write SavedData IO async
|
||||
|
||||
public DimensionDataStorage(File directory, DataFixer dataFixer) {
|
||||
public DimensionDataStorage(File directory, DataFixer dataFixer, HolderLookup.Provider registryLookup) {
|
||||
this.fixerUpper = dataFixer;
|
||||
this.dataFolder = directory;
|
||||
+ String worldFolder = dataFolder.getParent(); // Paper - Write SavedData IO async
|
||||
+ this.ioExecutor = java.util.concurrent.Executors.newSingleThreadExecutor(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("DimensionDataIO - " + worldFolder + " - %d").setDaemon(true).build()); // Paper - Write SavedData IO async
|
||||
this.registries = registryLookup;
|
||||
+ this.ioExecutor = java.util.concurrent.Executors.newSingleThreadExecutor(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("DimensionDataIO - " + dataFolder.getParent() + " - %d").setDaemon(true).build()); // Paper - Write SavedData IO async
|
||||
}
|
||||
|
||||
private File getDataFile(String id) {
|
||||
@@ -118,10 +121,23 @@ public class DimensionDataStorage {
|
||||
@@ -123,10 +125,23 @@ public class DimensionDataStorage {
|
||||
return bl;
|
||||
}
|
||||
|
||||
@ -178,9 +161,9 @@ index de44680d9bc34c6ce22e12c3008019c8c6803437..b89bd2d046e99d0c4848579a5ab43854
|
||||
+ public void save(boolean async) { // Paper - Write SavedData IO async
|
||||
this.cache.forEach((id, state) -> {
|
||||
if (state != null) {
|
||||
- state.save(this.getDataFile(id));
|
||||
- state.save(this.getDataFile(id), this.registries);
|
||||
+ // Paper start - Write SavedData IO async
|
||||
+ final java.util.concurrent.CompletableFuture<Void> save = state.save(this.getDataFile(id), ioExecutor);
|
||||
+ final java.util.concurrent.CompletableFuture<Void> save = state.save(this.getDataFile(id), this.registries, this.ioExecutor);
|
||||
+ if (!async) {
|
||||
+ save.join();
|
||||
+ }
|
@ -13,10 +13,10 @@ A config is provided if you rather let players use these exploits, and let
|
||||
them destroy the worlds End Portals and get on top of the nether easy.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 217018dbdd78af4b89d9d4e7154956593dfa8dae..093c814d6835f20b1208236db96bb40b4611936c 100644
|
||||
index 550c0cf4d84afc0cd6b2675bdc6aa2282d87e312..6bd6533e314b64d3512cbb46f5174a4956c323b2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -191,6 +191,7 @@ public class Explosion {
|
||||
@@ -192,6 +192,7 @@ public class Explosion {
|
||||
for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) {
|
||||
BlockPos blockposition = BlockPos.containing(d4, d5, d6);
|
||||
BlockState iblockdata = this.level.getBlockState(blockposition);
|
||||
@ -25,10 +25,10 @@ index 217018dbdd78af4b89d9d4e7154956593dfa8dae..093c814d6835f20b1208236db96bb40b
|
||||
|
||||
if (!this.level.isInWorldBounds(blockposition)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 983dad7ecc58033ecb6f523f7aef24de122417e8..44d81cacbe3ec878f3af02f4fad974d75fc4db9e 100644
|
||||
index 799db7d6229de9e4b7b97da91037dc8fed5b379e..232ac315fa1ed0e6e9ff4882d3378745804e4e1c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -540,6 +540,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -534,6 +534,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
|
||||
// CraftBukkit start - tree generation
|
||||
if (this.captureTreeGeneration) {
|
||||
@ -40,7 +40,7 @@ index 983dad7ecc58033ecb6f523f7aef24de122417e8..44d81cacbe3ec878f3af02f4fad974d7
|
||||
if (blockstate == null) {
|
||||
blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index 6896d46fce2e466ebee23ac2dc00312ec1beefdb..b60a52788e73de3dcb086c1a4628466b25c9d3ef 100644
|
||||
index 7f0c0ca49e7575c18935b71e3180d112440289f7..054593fc0b8d13f6bf449cc20a1f7ddfd5f1d1f0 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -90,6 +90,19 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@ -64,12 +64,12 @@ index 6896d46fce2e466ebee23ac2dc00312ec1beefdb..b60a52788e73de3dcb086c1a4628466b
|
||||
public co.aikar.timings.Timing getTiming() {
|
||||
if (timing == null) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
index 3dfe79684f662ac7cae4583bfe03a633438b4df7..be74adc86f0ca467f3b59e7b57fd47a8f381d86e 100644
|
||||
index e6bfbe2588e0c2a1be14e38d654e889d392ad4db..e0c62227b279a5fe0f3868fbf9ce8c78c515a09c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
@@ -212,6 +212,12 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
@@ -213,6 +213,12 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
@Override
|
||||
public boolean triggerEvent(BlockState state, Level world, BlockPos pos, int type, int data) {
|
||||
protected boolean triggerEvent(BlockState state, Level world, BlockPos pos, int type, int data) {
|
||||
Direction enumdirection = (Direction) state.getValue(PistonBaseBlock.FACING);
|
||||
+ // Paper start - Protect Bedrock and End Portal/Frames from being destroyed; prevent retracting when we're facing the wrong way (we were replaced before retraction could occur)
|
||||
+ Direction directionQueuedAs = Direction.from3DDataValue(data & 7); // Paper - copied from below
|
||||
@ -80,7 +80,7 @@ index 3dfe79684f662ac7cae4583bfe03a633438b4df7..be74adc86f0ca467f3b59e7b57fd47a8
|
||||
BlockState iblockdata1 = (BlockState) state.setValue(PistonBaseBlock.EXTENDED, true);
|
||||
|
||||
if (!world.isClientSide) {
|
||||
@@ -252,7 +258,7 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
@@ -253,7 +259,7 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
}
|
||||
// Paper end - Fix sticky pistons and BlockPistonRetractEvent
|
||||
world.setBlock(pos, iblockdata2, 20);
|
||||
@ -89,7 +89,7 @@ index 3dfe79684f662ac7cae4583bfe03a633438b4df7..be74adc86f0ca467f3b59e7b57fd47a8
|
||||
world.blockUpdated(pos, iblockdata2.getBlock());
|
||||
iblockdata2.updateNeighbourShapes(world, pos, 2);
|
||||
if (this.isSticky) {
|
||||
@@ -288,7 +294,14 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
@@ -289,7 +295,14 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -106,28 +106,28 @@ index 3dfe79684f662ac7cae4583bfe03a633438b4df7..be74adc86f0ca467f3b59e7b57fd47a8
|
||||
|
||||
world.playSound((Player) null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
index e28ac8f7960f648099e5f3607530a406c72e5056..e493b34aa8726ed48f8e5db2ae8ea561cc5b1f75 100644
|
||||
index 0cc12c418d18c5c2e927b93907daea3e0f662035..f863f3a553e26af1fb656622da052505e6ef1c01 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -189,7 +189,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public void onExplosionHit(BlockState state, Level world, BlockPos pos, Explosion explosion, BiConsumer<ItemStack, BlockPos> stackMerger) {
|
||||
@@ -174,7 +174,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
}
|
||||
|
||||
protected void onExplosionHit(BlockState state, Level world, BlockPos pos, Explosion explosion, BiConsumer<ItemStack, BlockPos> stackMerger) {
|
||||
- if (!state.isAir() && explosion.getBlockInteraction() != Explosion.BlockInteraction.TRIGGER_BLOCK) {
|
||||
+ if (!state.isAir() && explosion.getBlockInteraction() != Explosion.BlockInteraction.TRIGGER_BLOCK && state.isDestroyable()) { // Paper - Protect Bedrock and End Portal/Frames from being destroyed
|
||||
Block block = state.getBlock();
|
||||
boolean flag = explosion.getIndirectSourceEntity() instanceof Player;
|
||||
|
||||
@@ -285,7 +285,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
public boolean canBeReplaced(BlockState state, BlockPlaceContext context) {
|
||||
@@ -254,7 +254,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
}
|
||||
|
||||
protected boolean canBeReplaced(BlockState state, BlockPlaceContext context) {
|
||||
- return state.canBeReplaced() && (context.getItemInHand().isEmpty() || !context.getItemInHand().is(this.asItem()));
|
||||
+ return state.canBeReplaced() && (context.getItemInHand().isEmpty() || !context.getItemInHand().is(this.asItem())) && (state.isDestroyable() || (context.getPlayer() != null && context.getPlayer().getAbilities().instabuild)); // Paper - Protect Bedrock and End Portal/Frames from being destroyed
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
@@ -965,6 +965,12 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
protected boolean canBeReplaced(BlockState state, Fluid fluid) {
|
||||
@@ -896,6 +896,12 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
return this.legacySolid;
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ index e28ac8f7960f648099e5f3607530a406c72e5056..e493b34aa8726ed48f8e5db2ae8ea561
|
||||
public boolean isValidSpawn(BlockGetter world, BlockPos pos, EntityType<?> type) {
|
||||
return this.getBlock().properties.isValidSpawn.test(this.asState(), world, pos, type);
|
||||
}
|
||||
@@ -1068,7 +1074,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
@@ -999,7 +1005,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
}
|
||||
|
||||
public PushReaction getPistonPushReaction() {
|
||||
@ -150,7 +150,7 @@ index e28ac8f7960f648099e5f3607530a406c72e5056..e493b34aa8726ed48f8e5db2ae8ea561
|
||||
|
||||
public boolean isSolidRender(BlockGetter world, BlockPos pos) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
||||
index afdd4ecbff21e2172b390bcbdf74f3c1bbddafcc..bb739f8584dd3847152314aa995800f51907da2f 100644
|
||||
index 03dd833d61d5152af3032f23dd1fc4c75da9bc4f..a61959700d5e00739a79eaa617ac383160335f26 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
||||
@@ -221,6 +221,13 @@ public class PortalForcer {
|
@ -6,10 +6,10 @@ Subject: [PATCH] Use distance map to optimise entity tracker
|
||||
Use the distance map to find candidate players for tracking.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index ac1a4ff5f83e53fa2983ff6e834775e51fba715e..284f9548d62f9230c668bb1adb8cb8084b7cef7c 100644
|
||||
index 2ae2f36ef3d78ee4859c09096d516eeb3ffb02a0..9bb56d235a7614cefcd0551a455f9c4ddadb1db0 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -146,6 +146,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -149,6 +149,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
|
||||
// Paper start - distance maps
|
||||
private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
|
||||
@ -33,7 +33,7 @@ index ac1a4ff5f83e53fa2983ff6e834775e51fba715e..284f9548d62f9230c668bb1adb8cb808
|
||||
|
||||
void addPlayerToDistanceMaps(ServerPlayer player) {
|
||||
int chunkX = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getX());
|
||||
@@ -153,6 +170,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -156,6 +173,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Note: players need to be explicitly added to distance maps before they can be updated
|
||||
this.nearbyPlayers.addPlayer(player);
|
||||
this.level.playerChunkLoader.addPlayer(player); // Paper - replace chunk loader
|
||||
@ -48,7 +48,7 @@ index ac1a4ff5f83e53fa2983ff6e834775e51fba715e..284f9548d62f9230c668bb1adb8cb808
|
||||
}
|
||||
|
||||
void removePlayerFromDistanceMaps(ServerPlayer player) {
|
||||
@@ -161,6 +186,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -164,6 +189,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Note: players need to be explicitly added to distance maps before they can be updated
|
||||
this.nearbyPlayers.removePlayer(player);
|
||||
this.level.playerChunkLoader.removePlayer(player); // Paper - replace chunk loader
|
||||
@ -60,7 +60,7 @@ index ac1a4ff5f83e53fa2983ff6e834775e51fba715e..284f9548d62f9230c668bb1adb8cb808
|
||||
}
|
||||
|
||||
void updateMaps(ServerPlayer player) {
|
||||
@@ -169,6 +199,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -172,6 +202,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Note: players need to be explicitly added to distance maps before they can be updated
|
||||
this.nearbyPlayers.tickPlayer(player);
|
||||
this.level.playerChunkLoader.updatePlayer(player); // Paper - replace chunk loader
|
||||
@ -75,7 +75,7 @@ index ac1a4ff5f83e53fa2983ff6e834775e51fba715e..284f9548d62f9230c668bb1adb8cb808
|
||||
}
|
||||
// Paper end
|
||||
// Paper start
|
||||
@@ -256,6 +294,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -258,6 +296,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.regionManagers.add(this.dataRegionManager);
|
||||
this.nearbyPlayers = new io.papermc.paper.util.player.NearbyPlayers(this.level);
|
||||
// Paper end
|
||||
@ -124,7 +124,7 @@ index ac1a4ff5f83e53fa2983ff6e834775e51fba715e..284f9548d62f9230c668bb1adb8cb808
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@@ -933,17 +1013,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -951,17 +1031,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
|
||||
public void move(ServerPlayer player) {
|
||||
@ -143,7 +143,7 @@ index ac1a4ff5f83e53fa2983ff6e834775e51fba715e..284f9548d62f9230c668bb1adb8cb808
|
||||
|
||||
SectionPos sectionposition = player.getLastSectionPos();
|
||||
SectionPos sectionposition1 = SectionPos.of((EntityAccess) player);
|
||||
@@ -1020,7 +1090,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1038,7 +1108,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
|
||||
entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker
|
||||
this.entityMap.put(entity.getId(), playerchunkmap_entitytracker);
|
||||
@ -152,7 +152,7 @@ index ac1a4ff5f83e53fa2983ff6e834775e51fba715e..284f9548d62f9230c668bb1adb8cb808
|
||||
if (entity instanceof ServerPlayer) {
|
||||
ServerPlayer entityplayer = (ServerPlayer) entity;
|
||||
|
||||
@@ -1064,9 +1134,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1080,9 +1150,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
entity.tracker = null; // Paper - We're no longer tracked
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ index ac1a4ff5f83e53fa2983ff6e834775e51fba715e..284f9548d62f9230c668bb1adb8cb808
|
||||
List<ServerPlayer> list = Lists.newArrayList();
|
||||
List<ServerPlayer> list1 = this.level.players();
|
||||
ObjectIterator objectiterator = this.entityMap.values().iterator();
|
||||
@@ -1216,6 +1314,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1230,6 +1328,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.lastSectionPos = SectionPos.of((EntityAccess) entity);
|
||||
}
|
||||
|
||||
@ -236,10 +236,10 @@ index ac1a4ff5f83e53fa2983ff6e834775e51fba715e..284f9548d62f9230c668bb1adb8cb808
|
||||
return object instanceof ChunkMap.TrackedEntity ? ((ChunkMap.TrackedEntity) object).entity.getId() == this.entity.getId() : false;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index d4c8f2cb1e3adf45863226ae9ad31968bc3445c9..ab8a736bd8da140c48e6bd66449d7aa3b4f29a16 100644
|
||||
index b57644317b5085d74d11ac6ba858c3747d703a47..257943b4c984d6faee29eca17c8f951e7f43168b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -56,6 +56,7 @@ import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
@@ -59,6 +59,7 @@ import net.minecraft.network.syncher.SyncedDataHolder;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@ -247,7 +247,7 @@ index d4c8f2cb1e3adf45863226ae9ad31968bc3445c9..ab8a736bd8da140c48e6bd66449d7aa3
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
@@ -469,6 +470,38 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
@@ -471,6 +472,38 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.teleportTo(worldserver, null);
|
||||
}
|
||||
// Paper end - make end portalling safe
|
@ -7,11 +7,11 @@ Inline bit operations and reduce instruction count to make these hot
|
||||
operations faster
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
|
||||
index d80e3f5f53b9d28dea574cff5c65dfa3f8148f88..70f9e737b3b9f80395afc3542aafe4a0c774c722 100644
|
||||
index 4144c872fbd89d22827ad1f586e9a8d63a39ed46..665e88b2dedf9d5bb50914d5f3d377f2d19f40b0 100644
|
||||
--- a/src/main/java/net/minecraft/core/BlockPos.java
|
||||
+++ b/src/main/java/net/minecraft/core/BlockPos.java
|
||||
@@ -36,15 +36,16 @@ public class BlockPos extends Vec3i {
|
||||
.stable();
|
||||
@@ -50,15 +50,16 @@ public class BlockPos extends Vec3i {
|
||||
};
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final BlockPos ZERO = new BlockPos(0, 0, 0);
|
||||
- private static final int PACKED_X_LENGTH = 1 + Mth.log2(Mth.smallestEncompassingPowerOfTwo(30000000));
|
||||
@ -36,7 +36,7 @@ index d80e3f5f53b9d28dea574cff5c65dfa3f8148f88..70f9e737b3b9f80395afc3542aafe4a0
|
||||
|
||||
public BlockPos(int x, int y, int z) {
|
||||
super(x, y, z);
|
||||
@@ -54,28 +55,29 @@ public class BlockPos extends Vec3i {
|
||||
@@ -68,28 +69,29 @@ public class BlockPos extends Vec3i {
|
||||
this(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ index d80e3f5f53b9d28dea574cff5c65dfa3f8148f88..70f9e737b3b9f80395afc3542aafe4a0
|
||||
}
|
||||
|
||||
public static BlockPos containing(double x, double y, double z) {
|
||||
@@ -91,10 +93,7 @@ public class BlockPos extends Vec3i {
|
||||
@@ -113,10 +115,7 @@ public class BlockPos extends Vec3i {
|
||||
}
|
||||
|
||||
public static long asLong(int x, int y, int z) {
|
@ -7,7 +7,7 @@ Co-authored-by: Bjarne Koll <lynxplay101@gmail.com>
|
||||
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
|
||||
index 5ca112631cce775c609950d3540059f54033fd3e..5e13c5d7534397b902889b8dde9037da114b1039 100644
|
||||
index 6a270c9adb044a6e0b1c8e09b9106d51989fd761..d4581127366736c54f74e4ef7479236b18fb487d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java
|
||||
@@ -57,7 +57,7 @@ public class GateBehavior<E extends LivingEntity> implements BehaviorControl<E>
|
||||
@ -186,7 +186,7 @@ index 28fd073ddad358e087e8c78985a97cad21be81b7..a5bd308d1b3ea5db185c06a287167d1d
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
|
||||
index 14d3f57fa796776e372cfe722471cdf8d4166b44..7cd8e444cd33a0995eda56e3be931780c3f501d9 100644
|
||||
index 04552e2cf3de2dc41dfe7e7a2e88b200eaaf280b..ca93a97256350789ca56f910862c9d717ca7670b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java
|
||||
@@ -35,9 +35,10 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
|
@ -987,10 +987,10 @@ index 0000000000000000000000000000000000000000..fa062e6543e8a0377e3d4715996955db
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
index 7cc1410803c0054566ce2849e0b04b14e5b0ab92..c80af964a2b4026f738aecd2058a7e99d225cce0 100644
|
||||
index 9936fd34ab51693559638709f3eccac59ba1832d..7ec3b0f9488b732c51cd1b02fb0dfe3c45aec2a4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
@@ -259,6 +259,116 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -258,6 +258,116 @@ public class RedStoneWireBlock extends Block {
|
||||
return floor.isFaceSturdy(world, pos, Direction.UP) || floor.is(Blocks.HOPPER);
|
||||
}
|
||||
|
||||
@ -1107,7 +1107,7 @@ index 7cc1410803c0054566ce2849e0b04b14e5b0ab92..c80af964a2b4026f738aecd2058a7e99
|
||||
private void updatePowerStrength(Level world, BlockPos pos, BlockState state) {
|
||||
int i = this.calculateTargetStrength(world, pos);
|
||||
|
||||
@@ -328,6 +438,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -327,6 +437,7 @@ public class RedStoneWireBlock extends Block {
|
||||
return Math.max(i, j - 1);
|
||||
}
|
||||
|
||||
@ -1115,16 +1115,16 @@ index 7cc1410803c0054566ce2849e0b04b14e5b0ab92..c80af964a2b4026f738aecd2058a7e99
|
||||
private int getWireSignal(BlockState state) {
|
||||
return state.is((Block) this) ? (Integer) state.getValue(RedStoneWireBlock.POWER) : 0;
|
||||
}
|
||||
@@ -350,7 +461,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -349,7 +460,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@Override
|
||||
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
||||
protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
||||
if (!oldState.is(state.getBlock()) && !world.isClientSide) {
|
||||
- this.updatePowerStrength(world, pos, state);
|
||||
+ this.updateSurroundingRedstone(world, pos, state, null); // Paper - Optimize redstone
|
||||
Iterator iterator = Direction.Plane.VERTICAL.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -377,7 +488,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -376,7 +487,7 @@ public class RedStoneWireBlock extends Block {
|
||||
world.updateNeighborsAt(pos.relative(enumdirection), this);
|
||||
}
|
||||
|
||||
@ -1133,8 +1133,8 @@ index 7cc1410803c0054566ce2849e0b04b14e5b0ab92..c80af964a2b4026f738aecd2058a7e99
|
||||
this.updateNeighborsOfNeighboringWires(world, pos);
|
||||
}
|
||||
}
|
||||
@@ -412,7 +523,7 @@ public class RedStoneWireBlock extends Block {
|
||||
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
|
||||
@@ -411,7 +522,7 @@ public class RedStoneWireBlock extends Block {
|
||||
protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
|
||||
if (!world.isClientSide) {
|
||||
if (state.canSurvive(world, pos)) {
|
||||
- this.updatePowerStrength(world, pos, state);
|
@ -16,7 +16,7 @@ This lets us get faster foreach iteration, as well as avoids map lookups on
|
||||
the values when needed.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||
index a2e7040df11a0138c706a10b190111b6c3bd99a9..d1e1f12451058f7f276f8277536a4c0a4d736601 100644
|
||||
index 8a483c8d2a54617d78af19de32fa0ded71b3223a..18bbb3f8f99849333ff4bc020c8ce758a69312a5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||
@@ -38,8 +38,12 @@ public class PathFinder {
|
||||
@ -24,11 +24,11 @@ index a2e7040df11a0138c706a10b190111b6c3bd99a9..d1e1f12451058f7f276f8277536a4c0a
|
||||
return null;
|
||||
} else {
|
||||
- Map<Target, BlockPos> map = positions.stream()
|
||||
- .collect(Collectors.toMap(pos -> this.nodeEvaluator.getGoal((double)pos.getX(), (double)pos.getY(), (double)pos.getZ()), Function.identity()));
|
||||
- .collect(Collectors.toMap(pos -> this.nodeEvaluator.getTarget((double)pos.getX(), (double)pos.getY(), (double)pos.getZ()), Function.identity()));
|
||||
+ // Paper start - Perf: remove streams and optimize collection
|
||||
+ List<Map.Entry<Target, BlockPos>> map = Lists.newArrayList();
|
||||
+ for (BlockPos pos : positions) {
|
||||
+ map.add(new java.util.AbstractMap.SimpleEntry<>(this.nodeEvaluator.getGoal(pos.getX(), pos.getY(), pos.getZ()), pos));
|
||||
+ for (final BlockPos pos : positions) {
|
||||
+ map.add(new java.util.AbstractMap.SimpleEntry<>(this.nodeEvaluator.getTarget(pos.getX(), pos.getY(), pos.getZ()), pos));
|
||||
+ }
|
||||
+ // Paper end - Perf: remove streams and optimize collection
|
||||
Path path = this.findPath(world.getProfiler(), node, map, followRange, distance, rangeMultiplier);
|
@ -5,10 +5,10 @@ Subject: [PATCH] Improve boat collision performance
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
|
||||
index 72e734af483dc03e1ae947b2ab3b6fa7df38ce62..01a12f4d6f3c2f09bffc78692443b9fd391db45a 100644
|
||||
index 2cd0a4dc4f0baa08bd7f5a053303bb63733f0bab..0bd367235f80c1f0d319a6aa5130d82ad82d895c 100644
|
||||
--- a/src/main/java/net/minecraft/Util.java
|
||||
+++ b/src/main/java/net/minecraft/Util.java
|
||||
@@ -123,6 +123,7 @@ public class Util {
|
||||
@@ -125,6 +125,7 @@ public class Util {
|
||||
.filter(fileSystemProvider -> fileSystemProvider.getScheme().equalsIgnoreCase("jar"))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalStateException("No jar file system provider found"));
|
||||
@ -17,10 +17,10 @@ index 72e734af483dc03e1ae947b2ab3b6fa7df38ce62..01a12f4d6f3c2f09bffc78692443b9fd
|
||||
};
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index aa261d3ad04bc3a19b3200214214650d9a9ac2af..a9d549d1f35928b7e9220e1e2e4ac30f3199ba2d 100644
|
||||
index 5854e58a014b5581fa065d1db256ffc0aa947ce2..75e01c1e01e0782fc8af48777bbe4716d37aeafa 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1446,7 +1446,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -1459,7 +1459,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (!source.is(DamageTypeTags.IS_PROJECTILE)) {
|
||||
Entity entity = source.getDirectEntity();
|
||||
|
||||
@ -29,7 +29,7 @@ index aa261d3ad04bc3a19b3200214214650d9a9ac2af..a9d549d1f35928b7e9220e1e2e4ac30f
|
||||
LivingEntity entityliving = (LivingEntity) entity;
|
||||
|
||||
this.blockUsingShield(entityliving);
|
||||
@@ -1540,11 +1540,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -1553,11 +1553,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
if (entity1 != null && !source.is(DamageTypeTags.NO_KNOCKBACK)) {
|
||||
@ -44,7 +44,7 @@ index aa261d3ad04bc3a19b3200214214650d9a9ac2af..a9d549d1f35928b7e9220e1e2e4ac30f
|
||||
d0 = (Math.random() - Math.random()) * 0.01D;
|
||||
}
|
||||
|
||||
@@ -2287,7 +2288,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2334,7 +2335,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.hurtCurrentlyUsedShield((float) -event.getDamage(DamageModifier.BLOCKING));
|
||||
Entity entity = damagesource.getDirectEntity();
|
||||
|
||||
@ -54,10 +54,10 @@ index aa261d3ad04bc3a19b3200214214650d9a9ac2af..a9d549d1f35928b7e9220e1e2e4ac30f
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
index 1ced6d60a74fac028804b3c2d938e89af4706823..db6aa75d642f4a7258f197933671907faf79c8f2 100644
|
||||
index 549202706396fee91c23f6e34f7faa7672e4b03f..b068cff9b5aa457d65b679529956e8210296d799 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
||||
@@ -689,7 +689,7 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
|
||||
@@ -686,7 +686,7 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
|
||||
this.invFriction = 0.05F;
|
||||
if (this.oldStatus == Boat.Status.IN_AIR && this.status != Boat.Status.IN_AIR && this.status != Boat.Status.ON_LAND) {
|
||||
this.waterLevel = this.getY(1.0D);
|
@ -884,10 +884,10 @@ index d5a549f08b98c80a5cf0eef02cb8a389c32dfecb..92731b6b593289e9f583c9b705b219e8
|
||||
BlockPos blockPos = path.getTarget();
|
||||
Optional<Holder<PoiType>> optional = poiManager.getType(blockPos);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
|
||||
index c07cc1bf3b98525d72924edee4233364fd8174d0..61a06706f1468a8d4cceb9fb2aae61cf56bd991d 100644
|
||||
index 51564dc963e39018e1572d3429c70eb9f8094e72..5ce7db30e6bd75db43ca8f5bbec709d07861966f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java
|
||||
@@ -124,36 +124,45 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
@@ -133,36 +133,45 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
public Optional<BlockPos> find(
|
||||
Predicate<Holder<PoiType>> typePredicate, Predicate<BlockPos> posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus
|
||||
) {
|
||||
@ -947,7 +947,7 @@ index c07cc1bf3b98525d72924edee4233364fd8174d0..61a06706f1468a8d4cceb9fb2aae61cf
|
||||
.map(poi -> {
|
||||
poi.acquireTicket();
|
||||
return poi.getPos();
|
||||
@@ -168,8 +177,21 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
@@ -177,8 +186,21 @@ public class PoiManager extends SectionStorage<PoiSection> {
|
||||
int radius,
|
||||
RandomSource random
|
||||
) {
|
||||
@ -972,7 +972,7 @@ index c07cc1bf3b98525d72924edee4233364fd8174d0..61a06706f1468a8d4cceb9fb2aae61cf
|
||||
|
||||
public boolean release(BlockPos pos) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java
|
||||
index f7d69dd83aad8e0ec1497441c61188bcf230865f..94404922304cfe23ea5fe8524387bc9b675cbc78 100644
|
||||
index 5b7deae326228e482b218aeebd857a59b7434eaf..4ee7d75c56d9f9ff3607276857dde84410ba3f2a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java
|
||||
@@ -26,7 +26,7 @@ import org.slf4j.Logger;
|
||||
@ -985,10 +985,10 @@ index f7d69dd83aad8e0ec1497441c61188bcf230865f..94404922304cfe23ea5fe8524387bc9b
|
||||
private boolean isValid;
|
||||
public final Optional<PoiSection> noAllocateOptional = Optional.of(this); // Paper - rewrite chunk system
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
||||
index bc6043a21227ce8c9c3879bc9c93c3803f79857b..4ac5024936987c15f927e3148af4bfa57228ad1e 100644
|
||||
index 428ed5adce8510dbcd3518f645f0ecdacf3a0132..f265be3b5b0ce769d2dbf20dd188bf59ce9f32d4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
|
||||
@@ -79,11 +79,11 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl
|
||||
@@ -68,11 +68,11 @@ public class SectionStorage<R> extends RegionFileStorage implements AutoCloseabl
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -1003,7 +1003,7 @@ index bc6043a21227ce8c9c3879bc9c93c3803f79857b..4ac5024936987c15f927e3148af4bfa5
|
||||
return Optional.empty();
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
||||
index bb739f8584dd3847152314aa995800f51907da2f..5d4c18b068f41f349bdccec14e08ca6ca7cb0c6c 100644
|
||||
index a61959700d5e00739a79eaa617ac383160335f26..52b15b52629bbf79af4f7bd8e0992d3f17f3eacc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
|
||||
@@ -51,18 +51,39 @@ public class PortalForcer {
|
@ -173,24 +173,24 @@ index 0000000000000000000000000000000000000000..57d0cd3ad6f972e986c72a57f1a6e360
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java
|
||||
index 4ce9906e1f2b79df7c08d644684281ee59aa0c91..2630f54d499abbe52798f97c8ea14a8d0bd75e99 100644
|
||||
index daedcfd867ed6171fb61bdcbded417a11c8a5b0f..223ab2d0256fa6df8064f16bc5f8fbe87a1422e4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java
|
||||
@@ -40,11 +40,13 @@ public abstract class StateHolder<O, S> {
|
||||
private final ImmutableMap<Property<?>, Comparable<?>> values;
|
||||
@@ -39,11 +39,13 @@ public abstract class StateHolder<O, S> {
|
||||
private final Reference2ObjectArrayMap<Property<?>, Comparable<?>> values;
|
||||
private Table<Property<?>, Comparable<?>, S> neighbours;
|
||||
protected final MapCodec<S> propertiesCodec;
|
||||
+ protected final io.papermc.paper.util.table.ZeroCollidingReferenceStateTable optimisedTable; // Paper - optimise state lookup
|
||||
|
||||
protected StateHolder(O owner, ImmutableMap<Property<?>, Comparable<?>> entries, MapCodec<S> codec) {
|
||||
protected StateHolder(O owner, Reference2ObjectArrayMap<Property<?>, Comparable<?>> propertyMap, MapCodec<S> codec) {
|
||||
this.owner = owner;
|
||||
this.values = entries;
|
||||
this.values = propertyMap;
|
||||
this.propertiesCodec = codec;
|
||||
+ this.optimisedTable = new io.papermc.paper.util.table.ZeroCollidingReferenceStateTable(this, entries); // Paper - optimise state lookup
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> S cycle(Property<T> property) {
|
||||
@@ -85,11 +87,11 @@ public abstract class StateHolder<O, S> {
|
||||
@@ -84,11 +86,11 @@ public abstract class StateHolder<O, S> {
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> boolean hasProperty(Property<T> property) {
|
||||
@ -204,7 +204,7 @@ index 4ce9906e1f2b79df7c08d644684281ee59aa0c91..2630f54d499abbe52798f97c8ea14a8d
|
||||
if (comparable == null) {
|
||||
throw new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.owner);
|
||||
} else {
|
||||
@@ -98,24 +100,18 @@ public abstract class StateHolder<O, S> {
|
||||
@@ -97,24 +99,18 @@ public abstract class StateHolder<O, S> {
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> Optional<T> getOptionalValue(Property<T> property) {
|
||||
@ -236,7 +236,7 @@ index 4ce9906e1f2b79df7c08d644684281ee59aa0c91..2630f54d499abbe52798f97c8ea14a8d
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>, V extends T> S trySetValue(Property<T> property, V value) {
|
||||
@@ -148,7 +144,7 @@ public abstract class StateHolder<O, S> {
|
||||
@@ -147,7 +143,7 @@ public abstract class StateHolder<O, S> {
|
||||
}
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ index 6b3cde6d4d1e63bec01f502f2027ee9fddac08aa..46449728f69ee7d4f78470f8da23c055
|
||||
|
||||
private MinecraftTimings() {}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 9d3cf1a14259397f806c57baa223faa7ee9eaf6b..636ad032f9b6b20557327e7d0b0aefff7780d1f3 100644
|
||||
index affc74c4650ce03aeb723619b63035d539958a8e..88549de2768149885c4eabbaaa71a38341453aed 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1357,8 +1357,79 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1414,8 +1414,79 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
return flag;
|
||||
}
|
||||
|
||||
@ -103,10 +103,10 @@ index 9d3cf1a14259397f806c57baa223faa7ee9eaf6b..636ad032f9b6b20557327e7d0b0aefff
|
||||
} else {
|
||||
boolean ret = false; // Paper - force execution of all worlds, do not just bias the first
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 4e0f80b26f1a1703184e38d739996b9919699fec..2b33a3d8fdb86024acb2a3ee9d0a4a7dd4989c98 100644
|
||||
index 0b7a38b9e92b19345a34c6226413a9b133264077..18640c8681f6a3b2276123d19e3e8f0a8c630b41 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -568,6 +568,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -566,6 +566,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
|
||||
Iterator iterator1 = list.iterator();
|
||||
|
||||
@ -114,7 +114,7 @@ index 4e0f80b26f1a1703184e38d739996b9919699fec..2b33a3d8fdb86024acb2a3ee9d0a4a7d
|
||||
while (iterator1.hasNext()) {
|
||||
ServerChunkCache.ChunkAndHolder chunkproviderserver_a = (ServerChunkCache.ChunkAndHolder) iterator1.next();
|
||||
LevelChunk chunk1 = chunkproviderserver_a.chunk;
|
||||
@@ -581,6 +582,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -579,6 +580,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
|
||||
if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) {
|
||||
this.level.tickChunk(chunk1, l);
|
||||
@ -123,10 +123,10 @@ index 4e0f80b26f1a1703184e38d739996b9919699fec..2b33a3d8fdb86024acb2a3ee9d0a4a7d
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 4f2d30e8ffe228952db64d0122a8958e33f841fa..160d340b6b9a054091897a728e4dbc73bb62ab96 100644
|
||||
index aba5f694b25507c9ab2e214bc1f25e0a895e8a95..d917407dbab842c6aec5f5a37f29dc9dd6d86407 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -216,6 +216,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -221,6 +221,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
private final StructureCheck structureCheck;
|
||||
private final boolean tickTime;
|
||||
private final RandomSequences randomSequences;
|
||||
@ -134,7 +134,7 @@ index 4f2d30e8ffe228952db64d0122a8958e33f841fa..160d340b6b9a054091897a728e4dbc73
|
||||
|
||||
// CraftBukkit start
|
||||
public final LevelStorageSource.LevelStorageAccess convertable;
|
||||
@@ -1205,6 +1206,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1211,6 +1212,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
if (fluid1.is(fluid)) {
|
||||
fluid1.tick(this, pos);
|
||||
}
|
||||
@ -142,7 +142,7 @@ index 4f2d30e8ffe228952db64d0122a8958e33f841fa..160d340b6b9a054091897a728e4dbc73
|
||||
|
||||
}
|
||||
|
||||
@@ -1214,6 +1216,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1220,6 +1222,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
if (iblockdata.is(block)) {
|
||||
iblockdata.tick(this, pos, this.random);
|
||||
}
|
||||
@ -151,10 +151,10 @@ index 4f2d30e8ffe228952db64d0122a8958e33f841fa..160d340b6b9a054091897a728e4dbc73
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 44d81cacbe3ec878f3af02f4fad974d75fc4db9e..e64431d524f83897d8ff7f5adc27ddef58cd46df 100644
|
||||
index 232ac315fa1ed0e6e9ff4882d3378745804e4e1c..e982de0ec4e45219962ea775f355a5740b3906af 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -924,6 +924,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -916,6 +916,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
// Spigot end
|
||||
} else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
|
||||
tickingblockentity.tick();
|
||||
@ -166,7 +166,7 @@ index 44d81cacbe3ec878f3af02f4fad974d75fc4db9e..e64431d524f83897d8ff7f5adc27ddef
|
||||
}
|
||||
}
|
||||
this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
|
||||
@@ -938,6 +943,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -930,6 +935,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public <T extends Entity> void guardEntityTick(Consumer<T> tickConsumer, T entity) {
|
||||
try {
|
||||
tickConsumer.accept(entity);
|
@ -90,10 +90,10 @@ index 0000000000000000000000000000000000000000..7d93652c1abbb6aee6eb7c26cf35d4d0
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 160d340b6b9a054091897a728e4dbc73bb62ab96..9d18da228c6709e7665ba8babb6ee6d0b36b5dc5 100644
|
||||
index d917407dbab842c6aec5f5a37f29dc9dd6d86407..16d24e70072e3846b3c35d331c3f474238a8def2 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -855,6 +855,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -861,6 +861,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
entityplayer.stopSleepInBed(false, false);
|
||||
});
|
||||
}
|
||||
@ -104,7 +104,7 @@ index 160d340b6b9a054091897a728e4dbc73bb62ab96..9d18da228c6709e7665ba8babb6ee6d0
|
||||
|
||||
public void tickChunk(LevelChunk chunk, int randomTickSpeed) {
|
||||
ChunkPos chunkcoordintpair = chunk.getPos();
|
||||
@@ -864,8 +868,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -870,8 +874,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
ProfilerFiller gameprofilerfiller = this.getProfiler();
|
||||
|
||||
gameprofilerfiller.push("thunder");
|
||||
@ -116,7 +116,7 @@ index 160d340b6b9a054091897a728e4dbc73bb62ab96..9d18da228c6709e7665ba8babb6ee6d0
|
||||
|
||||
if (this.isRainingAt(blockposition)) {
|
||||
DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition);
|
||||
@@ -897,7 +903,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -903,7 +909,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow
|
||||
for (int l = 0; l < randomTickSpeed; ++l) {
|
||||
if (this.random.nextInt(48) == 0) {
|
||||
@ -128,7 +128,7 @@ index 160d340b6b9a054091897a728e4dbc73bb62ab96..9d18da228c6709e7665ba8babb6ee6d0
|
||||
}
|
||||
}
|
||||
} // Paper - Option to disable ice and snow
|
||||
@@ -905,36 +914,37 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -911,36 +920,37 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
gameprofilerfiller.popPush("tickBlocks");
|
||||
timings.chunkTicksBlocks.startTiming(); // Paper
|
||||
if (randomTickSpeed > 0) {
|
||||
@ -190,7 +190,7 @@ index 160d340b6b9a054091897a728e4dbc73bb62ab96..9d18da228c6709e7665ba8babb6ee6d0
|
||||
|
||||
timings.chunkTicksBlocks.stopTiming(); // Paper
|
||||
gameprofilerfiller.pop();
|
||||
@@ -942,17 +952,25 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -948,17 +958,25 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
@VisibleForTesting
|
||||
public void tickPrecipitation(BlockPos pos) {
|
||||
@ -220,7 +220,7 @@ index 160d340b6b9a054091897a728e4dbc73bb62ab96..9d18da228c6709e7665ba8babb6ee6d0
|
||||
if (i > 0 && biomebase.shouldSnow(this, blockposition1)) {
|
||||
BlockState iblockdata = this.getBlockState(blockposition1);
|
||||
|
||||
@@ -970,12 +988,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -976,12 +994,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,10 +311,10 @@ index 50040c497a819cd1229042ab3cb057d34a32cacc..01f5b946fabbe34f31110e75973dab9f
|
||||
public void getAll(IntConsumer action) {
|
||||
for (int i = 0; i < this.size; i++) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
|
||||
index 6a98f66b7701e8af389ca9a1e9eb230a6100c838..dbdb6c432448b151fa4421f14235f8bad23dc720 100644
|
||||
index ffffa53fcaa6ec8681b283fa20bb5a3320ad9c11..30b87b5cb18c25cdd04eab64cfbe5acd6c1b6d84 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
|
||||
@@ -87,7 +87,7 @@ public class Turtle extends Animal {
|
||||
@@ -88,7 +88,7 @@ public class Turtle extends Animal {
|
||||
}
|
||||
|
||||
public void setHomePos(BlockPos pos) {
|
||||
@ -324,10 +324,10 @@ index 6a98f66b7701e8af389ca9a1e9eb230a6100c838..dbdb6c432448b151fa4421f14235f8ba
|
||||
|
||||
public BlockPos getHomePos() {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index e64431d524f83897d8ff7f5adc27ddef58cd46df..47e83adf64df673bc40077335baf786f865411e8 100644
|
||||
index e982de0ec4e45219962ea775f355a5740b3906af..5b3143723e1637c2ab44363b208cd26b659d70cc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1395,10 +1395,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1388,10 +1388,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public abstract RecipeManager getRecipeManager();
|
||||
|
||||
public BlockPos getBlockRandomPos(int x, int y, int z, int l) {
|
||||
@ -348,7 +348,7 @@ index e64431d524f83897d8ff7f5adc27ddef58cd46df..47e83adf64df673bc40077335baf786f
|
||||
|
||||
public boolean noSave() {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
index 8852263cb6faec1b68326145aa30e5cd36d066e7..eb05c01e85825cbd5b7cf43bc6d261db0b871b92 100644
|
||||
index f2e11bff414b521295bde721e01ae2166a6a3fd6..8cd6c1d838e0332125fde3fc36475034aa4effa0 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
@@ -25,6 +25,7 @@ public class LevelChunkSection {
|
||||
@ -389,7 +389,7 @@ index 8852263cb6faec1b68326145aa30e5cd36d066e7..eb05c01e85825cbd5b7cf43bc6d261db
|
||||
- public int tickingBlockCount;
|
||||
- public int tickingFluidCount;
|
||||
-
|
||||
- a() {}
|
||||
- a(final LevelChunkSection chunksection) {}
|
||||
-
|
||||
- public void accept(BlockState iblockdata, int i) {
|
||||
+ // Paper start - unfuck this
|
||||
@ -425,18 +425,18 @@ index 8852263cb6faec1b68326145aa30e5cd36d066e7..eb05c01e85825cbd5b7cf43bc6d261db
|
||||
+ });
|
||||
}
|
||||
-
|
||||
- a a0 = new a();
|
||||
- a a0 = new a(this);
|
||||
-
|
||||
- this.states.count(a0);
|
||||
- this.nonEmptyBlockCount = (short) a0.nonEmptyBlockCount;
|
||||
- this.tickingBlockCount = (short) a0.tickingBlockCount;
|
||||
- this.tickingFluidCount = (short) a0.tickingFluidCount;
|
||||
+ // Paper end
|
||||
+ // Paper end - unfuck this
|
||||
}
|
||||
|
||||
public PalettedContainer<BlockState> getStates() {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
index d473637a705c1f11079fff08e334545779a99a84..adfbdca12fbdee2602feb0158674166d5256e49e 100644
|
||||
index 926c81a25180d508d662eb3fa35f771636164694..81368bf186365878db2e1ed305bb7bf36c26f61f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
@@ -381,6 +381,14 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
@ -10,10 +10,10 @@ hoping that at least then we don't swap chunks, and maybe recover
|
||||
them all.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
index 539b36bde9cba3a44184eba36df9aa4c345a5b84..d53c4f3d47a8728d56fbd9b5e12be51885560d52 100644
|
||||
index e64fe79b231987e240d7482c0d6fa3c89dc97462..db932f8e9d48e1e47a89526d1d76947e91b55eea 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
@@ -70,6 +70,18 @@ import net.minecraft.world.ticks.ProtoChunkTicks;
|
||||
@@ -72,6 +72,18 @@ import net.minecraft.world.ticks.ProtoChunkTicks;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public class ChunkSerializer {
|
||||
@ -32,7 +32,7 @@ index 539b36bde9cba3a44184eba36df9aa4c345a5b84..d53c4f3d47a8728d56fbd9b5e12be518
|
||||
|
||||
public static final Codec<PalettedContainer<BlockState>> BLOCK_STATE_CODEC = PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), null); // Paper - Anti-Xray - Add preset block states
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -455,7 +467,7 @@ public class ChunkSerializer {
|
||||
@@ -449,7 +461,7 @@ public class ChunkSerializer {
|
||||
nbttagcompound.putInt("xPos", chunkcoordintpair.x);
|
||||
nbttagcompound.putInt("yPos", chunk.getMinSection());
|
||||
nbttagcompound.putInt("zPos", chunkcoordintpair.z);
|
||||
@ -42,15 +42,15 @@ index 539b36bde9cba3a44184eba36df9aa4c345a5b84..d53c4f3d47a8728d56fbd9b5e12be518
|
||||
nbttagcompound.putString("Status", BuiltInRegistries.CHUNK_STATUS.getKey(chunk.getStatus()).toString());
|
||||
BlendingData blendingdata = chunk.getBlendingData();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
index 645a1773237f2002c233ec1f3ff6f0ca46ca4024..d16d7c2fed89fb1347df7ddd95856e7f08c22e8a 100644
|
||||
index 554dede2ad0e45d3ee4ccc5510b7644f2e9e4250..7801fac96d728f951989fca36f6a4890a0638c36 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java
|
||||
@@ -38,7 +38,7 @@ public class ChunkStorage implements AutoCloseable {
|
||||
@@ -41,7 +41,7 @@ public class ChunkStorage implements AutoCloseable {
|
||||
|
||||
public ChunkStorage(Path directory, DataFixer dataFixer, boolean dsync) {
|
||||
public ChunkStorage(RegionStorageInfo storageKey, Path directory, DataFixer dataFixer, boolean dsync) {
|
||||
this.fixerUpper = dataFixer;
|
||||
- this.regionFileCache = new RegionFileStorage(directory, dsync); // Paper - rewrite chunk system; async chunk IO
|
||||
+ this.regionFileCache = new RegionFileStorage(directory, dsync, true); // Paper - rewrite chunk system; async chunk IO & Attempt to recalculate regionfile header if it is corrupt
|
||||
- this.regionFileCache = new RegionFileStorage(storageKey, directory, dsync); // Paper - rewrite chunk system; async chunk IO
|
||||
+ this.regionFileCache = new RegionFileStorage(storageKey, directory, dsync, true); // Paper - rewrite chunk system; async chunk IO & Attempt to recalculate regionfile header if it is corrupt
|
||||
}
|
||||
|
||||
public boolean isOldChunkAround(ChunkPos chunkPos, int checkRadius) {
|
||||
@ -87,13 +87,14 @@ index a23dc2f8f4475de1ee35bf18a7a8a53233ccac12..226af44fd469053451a0403a95ffb446
|
||||
this.used.set(start, start + size);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
index 92ba75254f6ffca40abd5485dbb4789de59edebd..6cf83502a954cce9c562ec036bfeddb477d38b73 100644
|
||||
index 36cdf165334c4d7c1ca28ba42b1006b163e45a95..6e8c488ed05495237e06e44005d3656f16573e58 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
@@ -50,6 +50,355 @@ public class RegionFile implements AutoCloseable {
|
||||
@@ -53,6 +53,356 @@ public class RegionFile implements AutoCloseable {
|
||||
protected final RegionBitmap usedSectors;
|
||||
public final java.util.concurrent.locks.ReentrantLock fileLock = new java.util.concurrent.locks.ReentrantLock(); // Paper
|
||||
public final Path regionFile; // Paper
|
||||
|
||||
+
|
||||
+ // Paper start - Attempt to recalculate regionfile header if it is corrupt
|
||||
+ private static long roundToSectors(long bytes) {
|
||||
+ long sectors = bytes >>> 12; // 4096 = 2^12
|
||||
@ -446,32 +447,31 @@ index 92ba75254f6ffca40abd5485dbb4789de59edebd..6cf83502a954cce9c562ec036bfeddb4
|
||||
// Paper start - Cache chunk status
|
||||
private final net.minecraft.world.level.chunk.ChunkStatus[] statuses = new net.minecraft.world.level.chunk.ChunkStatus[32 * 32];
|
||||
|
||||
@@ -77,8 +426,19 @@ public class RegionFile implements AutoCloseable {
|
||||
public RegionFile(Path file, Path directory, boolean dsync) throws IOException {
|
||||
this(file, directory, RegionFileVersion.getCompressionFormat(), dsync); // Paper - Configurable region compression format
|
||||
@@ -80,8 +430,18 @@ public class RegionFile implements AutoCloseable {
|
||||
public RegionFile(RegionStorageInfo storageKey, Path directory, Path path, boolean dsync) throws IOException {
|
||||
this(storageKey, directory, path, RegionFileVersion.getCompressionFormat(), dsync); // Paper - Configurable region compression format
|
||||
}
|
||||
+ // Paper start - add can recalc flag
|
||||
+ public RegionFile(Path file, Path directory, boolean dsync, boolean canRecalcHeader) throws IOException {
|
||||
+ this(file, directory, RegionFileVersion.getCompressionFormat(), dsync, canRecalcHeader);
|
||||
+ public RegionFile(RegionStorageInfo storageKey, Path directory, Path path, boolean dsync, boolean canRecalcHeader) throws IOException {
|
||||
+ this(storageKey, directory, path, RegionFileVersion.getCompressionFormat(), dsync, canRecalcHeader);
|
||||
+ }
|
||||
+ // Paper end - add can recalc flag
|
||||
|
||||
public RegionFile(Path file, Path directory, RegionFileVersion outputChunkStreamVersion, boolean dsync) throws IOException {
|
||||
+ // Paper start - add can recalc flag
|
||||
+ this(file, directory, outputChunkStreamVersion, dsync, false);
|
||||
public RegionFile(RegionStorageInfo storageKey, Path path, Path directory, RegionFileVersion compressionFormat, boolean dsync) throws IOException {
|
||||
+ this(storageKey, path, directory, compressionFormat, dsync, true);
|
||||
+ }
|
||||
+ public RegionFile(Path file, Path directory, RegionFileVersion outputChunkStreamVersion, boolean dsync, boolean canRecalcHeader) throws IOException {
|
||||
+
|
||||
+ public RegionFile(RegionStorageInfo storageKey, Path path, Path directory, RegionFileVersion compressionFormat, boolean dsync, boolean canRecalcHeader) throws IOException {
|
||||
+ this.canRecalcHeader = canRecalcHeader;
|
||||
+ // Paper end - add can recalc flag
|
||||
this.header = ByteBuffer.allocateDirect(8192);
|
||||
this.regionFile = file; // Paper
|
||||
initOversizedState(); // Paper
|
||||
@@ -107,14 +467,16 @@ public class RegionFile implements AutoCloseable {
|
||||
RegionFile.LOGGER.warn("Region file {} has truncated header: {}", file, i);
|
||||
@@ -112,14 +472,16 @@ public class RegionFile implements AutoCloseable {
|
||||
RegionFile.LOGGER.warn("Region file {} has truncated header: {}", path, i);
|
||||
}
|
||||
|
||||
- long j = Files.size(file);
|
||||
+ final long j = Files.size(file); final long regionFileSize = j; // Paper - recalculate header on header corruption
|
||||
- long j = Files.size(path);
|
||||
+ final long j = Files.size(path); final long regionFileSize = j; // Paper - recalculate header on header corruption
|
||||
|
||||
- for (int k = 0; k < 1024; ++k) {
|
||||
- int l = this.offsets.get(k);
|
||||
@ -488,22 +488,22 @@ index 92ba75254f6ffca40abd5485dbb4789de59edebd..6cf83502a954cce9c562ec036bfeddb4
|
||||
// Spigot start
|
||||
if (j1 == 255) {
|
||||
// We're maxed out, so we need to read the proper length from the section
|
||||
@@ -123,32 +485,102 @@ public class RegionFile implements AutoCloseable {
|
||||
@@ -128,21 +490,66 @@ public class RegionFile implements AutoCloseable {
|
||||
j1 = (realLen.getInt(0) + 4) / 4096 + 1;
|
||||
}
|
||||
// Spigot end
|
||||
+ sectorLength = j1; // Paper - diff on change, we expect this to be sector length of region
|
||||
|
||||
if (i1 < 2) {
|
||||
RegionFile.LOGGER.warn("Region file {} has invalid sector at index: {}; sector {} overlaps with header", new Object[]{file, k, i1});
|
||||
RegionFile.LOGGER.warn("Region file {} has invalid sector at index: {}; sector {} overlaps with header", new Object[]{path, k, i1});
|
||||
- this.offsets.put(k, 0);
|
||||
+ //this.offsets.put(k, 0); // Paper - we catch this, but need it in the header for the summary change
|
||||
} else if (j1 == 0) {
|
||||
RegionFile.LOGGER.warn("Region file {} has an invalid sector at index: {}; size has to be > 0", file, k);
|
||||
RegionFile.LOGGER.warn("Region file {} has an invalid sector at index: {}; size has to be > 0", path, k);
|
||||
- this.offsets.put(k, 0);
|
||||
+ //this.offsets.put(k, 0); // Paper - we catch this, but need it in the header for the summary change
|
||||
} else if ((long) i1 * 4096L > j) {
|
||||
RegionFile.LOGGER.warn("Region file {} has an invalid sector at index: {}; sector {} is out of bounds", new Object[]{file, k, i1});
|
||||
RegionFile.LOGGER.warn("Region file {} has an invalid sector at index: {}; sector {} is out of bounds", new Object[]{path, k, i1});
|
||||
- this.offsets.put(k, 0);
|
||||
+ //this.offsets.put(k, 0); // Paper - we catch this, but need it in the header for the summary change
|
||||
} else {
|
||||
@ -559,6 +559,7 @@ index 92ba75254f6ffca40abd5485dbb4789de59edebd..6cf83502a954cce9c562ec036bfeddb4
|
||||
}
|
||||
|
||||
}
|
||||
@@ -153,11 +560,36 @@ public class RegionFile implements AutoCloseable {
|
||||
}
|
||||
|
||||
private Path getExternalChunkPath(ChunkPos chunkPos) {
|
||||
@ -596,7 +597,7 @@ index 92ba75254f6ffca40abd5485dbb4789de59edebd..6cf83502a954cce9c562ec036bfeddb4
|
||||
@Nullable
|
||||
public synchronized DataInputStream getChunkDataInputStream(ChunkPos pos) throws IOException {
|
||||
int i = this.getOffset(pos);
|
||||
@@ -172,6 +604,11 @@ public class RegionFile implements AutoCloseable {
|
||||
@@ -181,6 +613,11 @@ public class RegionFile implements AutoCloseable {
|
||||
((java.nio.Buffer) bytebuffer).flip(); // CraftBukkit - decompile error
|
||||
if (bytebuffer.remaining() < 5) {
|
||||
RegionFile.LOGGER.error("Chunk {} header is truncated: expected {} but read {}", new Object[]{pos, l, bytebuffer.remaining()});
|
||||
@ -608,7 +609,7 @@ index 92ba75254f6ffca40abd5485dbb4789de59edebd..6cf83502a954cce9c562ec036bfeddb4
|
||||
return null;
|
||||
} else {
|
||||
int i1 = bytebuffer.getInt();
|
||||
@@ -179,6 +616,11 @@ public class RegionFile implements AutoCloseable {
|
||||
@@ -188,6 +625,11 @@ public class RegionFile implements AutoCloseable {
|
||||
|
||||
if (i1 == 0) {
|
||||
RegionFile.LOGGER.warn("Chunk {} is allocated, but stream is missing", pos);
|
||||
@ -620,7 +621,7 @@ index 92ba75254f6ffca40abd5485dbb4789de59edebd..6cf83502a954cce9c562ec036bfeddb4
|
||||
return null;
|
||||
} else {
|
||||
int j1 = i1 - 1;
|
||||
@@ -186,17 +628,44 @@ public class RegionFile implements AutoCloseable {
|
||||
@@ -195,18 +637,45 @@ public class RegionFile implements AutoCloseable {
|
||||
if (RegionFile.isExternalStreamChunk(b0)) {
|
||||
if (j1 != 0) {
|
||||
RegionFile.LOGGER.warn("Chunk has both internal and external streams");
|
||||
@ -656,6 +657,7 @@ index 92ba75254f6ffca40abd5485dbb4789de59edebd..6cf83502a954cce9c562ec036bfeddb4
|
||||
+ // Paper end - recalculate header on regionfile corruption
|
||||
return null;
|
||||
} else {
|
||||
JvmProfiler.INSTANCE.onRegionFileRead(this.info, pos, this.version, j1);
|
||||
- return this.createChunkInputStream(pos, b0, RegionFile.createStream(bytebuffer, j1));
|
||||
+ // Paper start - recalculate header on regionfile corruption
|
||||
+ final DataInputStream ret = this.createChunkInputStream(pos, b0, RegionFile.createStream(bytebuffer, j1));
|
||||
@ -667,7 +669,7 @@ index 92ba75254f6ffca40abd5485dbb4789de59edebd..6cf83502a954cce9c562ec036bfeddb4
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -371,10 +840,15 @@ public class RegionFile implements AutoCloseable {
|
||||
@@ -392,10 +861,15 @@ public class RegionFile implements AutoCloseable {
|
||||
}
|
||||
|
||||
private ByteBuffer createExternalStub() {
|
||||
@ -685,31 +687,31 @@ index 92ba75254f6ffca40abd5485dbb4789de59edebd..6cf83502a954cce9c562ec036bfeddb4
|
||||
return bytebuffer;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
index 42d37bee3a459adcd46408596ccf93abbcff51fe..fe312b1aef579cb4bf81bdd967cf72ff880d7505 100644
|
||||
index a73a37320da2c141fc2db9d1d61233a34ce0c906..af50a02bafb7c1db4569604d1e69f95daab6d2a5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
@@ -24,6 +24,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
public final Long2ObjectLinkedOpenHashMap<RegionFile> regionCache = new Long2ObjectLinkedOpenHashMap();
|
||||
@@ -25,6 +25,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
private final RegionStorageInfo info;
|
||||
private final Path folder;
|
||||
private final boolean sync;
|
||||
+ private final boolean isChunkData; // Paper
|
||||
|
||||
// Paper start - cache regionfile does not exist state
|
||||
static final int MAX_NON_EXISTING_CACHE = 1024 * 64;
|
||||
@@ -55,6 +56,12 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -56,6 +57,12 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
// Paper end - cache regionfile does not exist state
|
||||
|
||||
protected RegionFileStorage(Path directory, boolean dsync) { // Paper - protected constructor
|
||||
protected RegionFileStorage(RegionStorageInfo storageKey, Path directory, boolean dsync) { // Paper - protected constructor
|
||||
+ // Paper start - add isChunkData param
|
||||
+ this(directory, dsync, false);
|
||||
+ this(storageKey, directory, dsync, false);
|
||||
+ }
|
||||
+ RegionFileStorage(Path directory, boolean dsync, boolean isChunkData) {
|
||||
+ RegionFileStorage(RegionStorageInfo storageKey, Path directory, boolean dsync, boolean isChunkData) {
|
||||
+ this.isChunkData = isChunkData;
|
||||
+ // Paper end - add isChunkData param
|
||||
this.folder = directory;
|
||||
this.sync = dsync;
|
||||
}
|
||||
@@ -122,7 +129,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
this.info = storageKey;
|
||||
@@ -101,7 +108,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
// Paper - only create directory if not existing only - moved down
|
||||
Path path = this.folder;
|
||||
int j = chunkcoordintpair.getRegionX();
|
||||
@ -718,16 +720,16 @@ index 42d37bee3a459adcd46408596ccf93abbcff51fe..fe312b1aef579cb4bf81bdd967cf72ff
|
||||
if (existingOnly && !java.nio.file.Files.exists(path1)) { // Paper start - cache regionfile does not exist state
|
||||
this.markNonExisting(regionPos);
|
||||
return null; // CraftBukkit
|
||||
@@ -131,7 +138,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -110,7 +117,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
}
|
||||
// Paper end - cache regionfile does not exist state
|
||||
FileUtil.createDirectoriesSafe(this.folder); // Paper - only create directory if not existing only - moved from above
|
||||
- RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync);
|
||||
+ RegionFile regionfile1 = new RegionFile(path1, this.folder, this.sync, this.isChunkData); // Paper - allow for chunk regionfiles to regen header
|
||||
- RegionFile regionfile1 = new RegionFile(this.info, path1, this.folder, this.sync);
|
||||
+ RegionFile regionfile1 = new RegionFile(this.info, path1, this.folder, this.sync, this.isChunkData); // Paper - allow for chunk regionfiles to regen header
|
||||
|
||||
this.regionCache.putAndMoveToFirst(i, regionfile1);
|
||||
// Paper start
|
||||
@@ -188,6 +195,13 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -167,6 +174,13 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
if (regionfile == null) {
|
||||
return null;
|
||||
}
|
||||
@ -741,7 +743,7 @@ index 42d37bee3a459adcd46408596ccf93abbcff51fe..fe312b1aef579cb4bf81bdd967cf72ff
|
||||
// CraftBukkit end
|
||||
try { // Paper
|
||||
DataInputStream datainputstream = regionfile.getChunkDataInputStream(pos);
|
||||
@@ -204,6 +218,20 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -183,6 +197,20 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
try {
|
||||
if (datainputstream != null) {
|
||||
nbttagcompound = NbtIo.read((DataInput) datainputstream);
|
||||
@ -763,15 +765,15 @@ index 42d37bee3a459adcd46408596ccf93abbcff51fe..fe312b1aef579cb4bf81bdd967cf72ff
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java
|
||||
index 581912e1315a4a8b46042a27df54826fa63e9c75..7baa12b53588d39fe1e6f130992dca591f246c83 100644
|
||||
index ef68b57ef1d8d7cb317c417569dd23a777fba4ad..f4a39f49b354c560d614483db1cd3dfc154e94b4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java
|
||||
@@ -14,7 +14,7 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.util.FastBufferedInputStream;
|
||||
@@ -21,7 +21,7 @@ import org.slf4j.Logger;
|
||||
|
||||
public class RegionFileVersion {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
- private static final Int2ObjectMap<RegionFileVersion> VERSIONS = new Int2ObjectOpenHashMap<>();
|
||||
+ public static final Int2ObjectMap<RegionFileVersion> VERSIONS = new Int2ObjectOpenHashMap<>(); // Paper - private -> public
|
||||
private static final Object2ObjectMap<String, RegionFileVersion> VERSIONS_BY_NAME = new Object2ObjectOpenHashMap<>();
|
||||
public static final RegionFileVersion VERSION_GZIP = register(
|
||||
new RegionFileVersion(
|
||||
1, stream -> new FastBufferedInputStream(new GZIPInputStream(stream)), stream -> new BufferedOutputStream(new GZIPOutputStream(stream))
|
Loading…
Reference in New Issue
Block a user