3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 02:50:09 +01:00

a bunch more patches done

Dieser Commit ist enthalten in:
Jake Potrebic 2022-06-07 22:02:19 -07:00
Ursprung c3fc3de622
Commit dc12a6e9fe
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: ECE0B3C133C016C5
41 geänderte Dateien mit 177 neuen und 170 gelöschten Zeilen

Datei anzeigen

@ -3,6 +3,8 @@ From: David Slovikosky <davidslovikosky@gmail.com>
Date: Tue, 9 Jun 2020 00:10:03 -0700
Subject: [PATCH] Fix missing chunks due to integer overflow
1.19: Either no longer needed or has to take a very different form -MM
This patch fixes a bug in the WorldChunkManagerTheEnd class where the distance
from 0,0 squared overflows the maximum size of an integer. The overflow leads
to hard chunk borders around 370,000 blocks from 0,0. After this cutoff there

Datei anzeigen

@ -1,28 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <spottedleaf@spottedleaf.dev>
Date: Mon, 27 Apr 2020 00:04:16 -0700
Subject: [PATCH] Reduce allocation of Vec3D by entity tracker
1.19: the position vectors aren't the same for all entities here. Can maybe just handle them differently
I think only Paintings are different
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index f4b14d77d5c256852677bd9bc6dbda2bbe5367e3..38efde791c99dd22de71183676d0301a1d5a14e0 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1886,9 +1886,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public void updatePlayer(ServerPlayer player) {
org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot
if (player != this.entity) {
- Vec3 vec3d = player.position().subtract(this.entity.position()); // MC-155077, SPIGOT-5113
+ // Paper start - remove allocation of Vec3D here
+ //Vec3 vec3d = player.position().subtract(this.entity.position()); // MC-155077, SPIGOT-5113
+ double vec3d_dx = player.getX() - this.entity.getX();
+ double vec3d_dz = player.getZ() - this.entity.getZ();
+ // Paper end - remove allocation of Vec3D here
double d0 = (double) Math.min(this.getEffectiveRange(), (ChunkMap.this.viewDistance - 1) * 16);
- double d1 = vec3d.x * vec3d.x + vec3d.z * vec3d.z;
+ double d1 = vec3d_dx * vec3d_dx + vec3d_dz * vec3d_dz; // Paper
double d2 = d0 * d0;
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player);
Part of this patch was merged, see the same name
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 5e3f489964489e0facc93a823a1cb84b4c8abce7..1a4350b40d15edba998e3dee5f16cde4e9f50759 100644

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Expose game version
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9e2adc414d43f0c91f222be5f082e74d9db173aa..271f4ab919788bfad7ce750b1dafc742debed674 100644
index 14baaf2d679ccceeecb32958cd2ad0ef54beaf4b..d0c73d201d4bc5052efea6049988798a0c52f07e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -573,6 +573,13 @@ public final class CraftServer implements Server {
@@ -568,6 +568,13 @@ public final class CraftServer implements Server {
return this.bukkitVersion;
}

Datei anzeigen

@ -17,7 +17,7 @@ keeping long lived large direct buffers in cache.
Set system properly at server startup if not set already to help protect from this.
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 7a5e7e8a680ead5128fbf5829bc47704715b94bd..fbe68bd4739d9a0e7d9bc4c3d5ba8ecfd2d13954 100644
index 5e79ad04aed13462d1d187a71801aeb2628495e8..344d93f1d7f25a3f26064469e78dd698af66dc0d 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -28,6 +28,7 @@ public class Main {

Datei anzeigen

@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..2d5494d2813b773e60ddba6790b750a9
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4ed65f1371013fb91fe60a0e1501e222a6e9c508..abb640370da876a18a3eba952b19cfa9d0f73743 100644
index 08ada4f1818f3dc8aeee417df11948a48b66bcfd..096cbbeb42ea195f51e0d430aab2e989ea1aa065 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -915,6 +915,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -868,6 +868,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
private boolean hasStopped = false;
public volatile boolean hasFullyShutdown = false; // Paper
@ -40,7 +40,7 @@ index 4ed65f1371013fb91fe60a0e1501e222a6e9c508..abb640370da876a18a3eba952b19cfa9
private final Object stopLock = new Object();
public final boolean hasStopped() {
synchronized (this.stopLock) {
@@ -929,6 +930,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -882,6 +883,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.hasStopped) return;
this.hasStopped = true;
}
@ -48,7 +48,7 @@ index 4ed65f1371013fb91fe60a0e1501e222a6e9c508..abb640370da876a18a3eba952b19cfa9
// Paper start - kill main thread, and kill it hard
shutdownThread = Thread.currentThread();
org.spigotmc.WatchdogThread.doStop(); // Paper
@@ -1054,6 +1056,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1011,6 +1013,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void safeShutdown(boolean flag, boolean isRestarting) {
this.isRestarting = isRestarting;
@ -58,26 +58,26 @@ index 4ed65f1371013fb91fe60a0e1501e222a6e9c508..abb640370da876a18a3eba952b19cfa9
this.running = false;
if (flag) {
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 0af65f1698e4ee9d94724f19b0abd61c437f18f2..d21f45d983bf3047811d2d73f4a38deb108ac402 100644
index 35197aebcc7f00577dc506d022026f1d41168b73..9cefee82f6bd89b825b3007c3306a5f3622a1e70 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -204,6 +204,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
@@ -207,6 +207,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
} catch (Exception exception) {
ServerLoginPacketListenerImpl.LOGGER.error("Couldn't place player in world", exception);
TranslatableComponent chatmessage = new TranslatableComponent("multiplayer.disconnect.invalid_player_data");
MutableComponent ichatmutablecomponent = Component.translatable("multiplayer.disconnect.invalid_player_data");
+ // Paper start
+ if (MinecraftServer.getServer().isDebugging()) {
+ exception.printStackTrace();
+ }
+ // Paper end
this.connection.send(new ClientboundDisconnectPacket(chatmessage));
this.connection.disconnect(chatmessage);
this.connection.send(new ClientboundDisconnectPacket(ichatmutablecomponent));
this.connection.disconnect(ichatmutablecomponent);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 271f4ab919788bfad7ce750b1dafc742debed674..0ea163f4443bc07727675e3c05b9e1d68c52f78a 100644
index d0c73d201d4bc5052efea6049988798a0c52f07e..4639c2015de9b7300f6bfb58a598100b339f2fa6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -997,6 +997,7 @@ public final class CraftServer implements Server {
@@ -992,6 +992,7 @@ public final class CraftServer implements Server {
plugin.getDescription().getFullName(),
"This plugin is not properly shutting down its async tasks when it is being reloaded. This may cause conflicts with the newly loaded version of the plugin"
));

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent teleporting dead entities
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 47e841add3437c9ab271569e00b4b385ce2ced66..9f80408a7cf39f1f8b58c688b91de4731208e93d 100644
index 59d80414bf8fbf490d9e174a33860f035df3a8ac..d5b7a909a26135abce682c062cedd9b2de0239d0 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1528,6 +1528,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1558,6 +1558,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
private void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<ClientboundPlayerPositionPacket.RelativeArgument> set, boolean flag) {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Deobfuscate stacktraces in log messages, crash reports, and
diff --git a/build.gradle.kts b/build.gradle.kts
index 5a609a297ccfa66859b04eb907595741b8ec2160..398bedaba0a006bcd8ad562486ecd583d9d129ef 100644
index 7dd1c9449a1e6a9197e2915399feabf63f490b0a..9bd09c4465f5fe1cd68b63da293f506da4b17a72 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,4 +1,6 @@
@ -23,8 +23,8 @@ index 5a609a297ccfa66859b04eb907595741b8ec2160..398bedaba0a006bcd8ad562486ecd583
+ annotationProcessor("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - Needed to generate meta for our Log4j plugins
// Paper end
implementation("org.apache.logging.log4j:log4j-iostreams:2.17.1") // Paper
implementation("org.ow2.asm:asm:9.2")
@@ -31,6 +34,8 @@ dependencies {
implementation("org.ow2.asm:asm:9.3")
@@ -32,6 +35,8 @@ dependencies {
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.2")
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.2")
@ -33,7 +33,7 @@ index 5a609a297ccfa66859b04eb907595741b8ec2160..398bedaba0a006bcd8ad562486ecd583
testImplementation("junit:junit:4.13.2")
testImplementation("org.hamcrest:hamcrest-library:1.3")
}
@@ -89,6 +94,45 @@ tasks.shadowJar {
@@ -90,6 +95,45 @@ tasks.shadowJar {
}
}
@ -518,7 +518,7 @@ index 3941e14d1c3e6e688e28904948039c8b2200de5f..a4fda4a3bae9ce600e778b44cd3ef432
}
}
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index a0d3d9e344f530b713167d0663634c40eefce5b5..c469688c2b55b1c93435a2ac6e8e4494ab7e5229 100644
index 97166c362a5468e3f7e2fcfd5e318dc519bfbf6c..ed4587248fada36c4c206be1fa36fef42fc969e2 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -66,13 +66,13 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -539,10 +539,10 @@ index a0d3d9e344f530b713167d0663634c40eefce5b5..c469688c2b55b1c93435a2ac6e8e4494
private final PacketFlow receiving;
private final Queue<Connection.PacketHolder> queue = Queues.newConcurrentLinkedQueue();
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
index 5165170e3289fe3939497c56a71eae9fdaa4bcfa..8a0ced3f9b9099913ade4b71181aff6cafbc4ee6 100644
index 72932b13d71f71896f07810c8850eb45749ae2e6..5c92aa1cc1a7e7fd0b7a06ae9b21e734fab71c74 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
@@ -27,7 +27,7 @@ public class ServerboundChatPacket implements Packet<ServerGamePacketListener> {
@@ -41,7 +41,7 @@ public class ServerboundChatPacket implements Packet<ServerGamePacketListener> {
// Spigot Start
private static final java.util.concurrent.ExecutorService executors = java.util.concurrent.Executors.newCachedThreadPool(
@ -552,10 +552,10 @@ index 5165170e3289fe3939497c56a71eae9fdaa4bcfa..8a0ced3f9b9099913ade4b71181aff6c
if ( !this.message.startsWith("/") )
{
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index d0d058287fc1e87e944e99d4fc2cbd38eafb82b3..cec0082718c2a729044d6f19d74b8e4425816725 100644
index 7d381cc2c514045aad2bf65fd166b8ad1c8a9c97..ce700e9c74ad961703d95245febf95d060a7df8d 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -215,6 +215,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -208,6 +208,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
com.destroystokyo.paper.PaperConfig.registerCommands();
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
@ -564,10 +564,10 @@ index d0d058287fc1e87e944e99d4fc2cbd38eafb82b3..cec0082718c2a729044d6f19d74b8e44
this.setPvpAllowed(dedicatedserverproperties.pvp);
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index 7c820a8f9ae85eb6941dce0e6296775fb331d720..888e863b6d605bf587d0c071795a43d2157afa4d 100644
index 78808e6239070121d36b6c377202d76e8fb3fa32..72fbc58f7d003b7af3c35e5fc504010307c7086b 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -52,10 +52,10 @@ public class ServerConnectionListener {
@@ -53,10 +53,10 @@ public class ServerConnectionListener {
private static final Logger LOGGER = LogUtils.getLogger();
public static final LazyLoadedValue<NioEventLoopGroup> SERVER_EVENT_GROUP = new LazyLoadedValue<>(() -> {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Implement Mob Goal API
diff --git a/build.gradle.kts b/build.gradle.kts
index 398bedaba0a006bcd8ad562486ecd583d9d129ef..6b46f9c94dc051579ca5b51755caad19505e874a 100644
index 9bd09c4465f5fe1cd68b63da293f506da4b17a72..31659bb0a78dc00f29a057915fcbb0283b6081e0 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -36,6 +36,7 @@ dependencies {
@@ -37,6 +37,7 @@ dependencies {
implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation
@ -785,10 +785,10 @@ index 4379b9948f1eecfe6fd7dea98e298ad5f761019a..3f081183521603824430709886a9cc31
LOOK,
JUMP,
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0ea163f4443bc07727675e3c05b9e1d68c52f78a..44c5938edda0aeab0b65f1179ef7dad6356462da 100644
index 4639c2015de9b7300f6bfb58a598100b339f2fa6..6b3597ed1ed20863658cc5ef363ded2c734c25aa 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2670,5 +2670,11 @@ public final class CraftServer implements Server {
@@ -2653,5 +2653,11 @@ public final class CraftServer implements Server {
public boolean isStopping() {
return net.minecraft.server.MinecraftServer.getServer().hasStopped();
}

Datei anzeigen

@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..0f10c333d88f2e1c56a6c7f22d421084
+ }
+}
diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
index 701b9c67c01f2aa4823e2aa71db388d5c3292dc4..e98951ac056910340c498d866715e174d461f723 100644
index 7a7c92f1a026116958ad24312df358a703834369..0de65462956fa734b6405614e047161696e596fb 100644
--- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
@@ -27,7 +27,7 @@ import net.minecraft.util.VisibleForDebug;

Datei anzeigen

@ -10,10 +10,10 @@ Adds a 5 second grace period for any async tasks to finish and warns
if any are still running after that delay just as reload does.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index abb640370da876a18a3eba952b19cfa9d0f73743..12c1cee3b3055b44d0ca3196eb37e51879fce67b 100644
index 096cbbeb42ea195f51e0d430aab2e989ea1aa065..9905dba12c6b3f584a6fab94517592b6d2c042f0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -950,6 +950,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -907,6 +907,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();
@ -22,10 +22,10 @@ index abb640370da876a18a3eba952b19cfa9d0f73743..12c1cee3b3055b44d0ca3196eb37e518
// CraftBukkit end
if (this.getConnection() != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 44c5938edda0aeab0b65f1179ef7dad6356462da..0e339c13f58419a6af39b99782160ac3155b0606 100644
index 6b3597ed1ed20863658cc5ef363ded2c734c25aa..69e2be4906ec9cb2efaca51bda05b7e3bd8aee54 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1006,6 +1006,35 @@ public final class CraftServer implements Server {
@@ -1001,6 +1001,35 @@ public final class CraftServer implements Server {
org.spigotmc.WatchdogThread.hasStarted = true; // Paper - Disable watchdog early timeout on reload
}

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Ensure EntityRaider respects game and entity rules for
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
index 5da07a6e77bafca274700af1b3ea139fd54e77e1..c5611465b1f9228a994c462c093cec94d7d08c2f 100644
index 6babc2ccd99b739a03145e9ac6f676a46f06c773..4bb9730b6a42702e91467f980b9f045585039db3 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
@@ -312,6 +312,7 @@ public abstract class Raider extends PatrollingMonster {

Datei anzeigen

@ -33,10 +33,10 @@ index 52ba4797d0f27b8aaac262fd5a33dab63e28ebab..855db893080fc8784dc402a4fd7c3080
+ }
}
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index fc1b86828c8a38950f7a26735d8f5d125ee3e914..0d6f33319521101bd10352d597b5e3e063ec443f 100644
index 85e9c23b8dde4266696c6c62fc124b7508a0bb4f..acb94f0dd47e292446c74958667becdc8087f505 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -174,6 +174,7 @@ public class Explosion {
@@ -172,6 +172,7 @@ public class Explosion {
for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) {
BlockPos blockposition = new BlockPos(d4, d5, d6);
BlockState iblockdata = this.level.getBlockState(blockposition);
@ -44,7 +44,7 @@ index fc1b86828c8a38950f7a26735d8f5d125ee3e914..0d6f33319521101bd10352d597b5e3e0
FluidState fluid = iblockdata.getFluidState(); // Paper
if (!this.level.isInWorldBounds(blockposition)) {
@@ -351,7 +352,7 @@ public class Explosion {
@@ -350,7 +351,7 @@ public class Explosion {
BlockState iblockdata = this.level.getBlockState(blockposition);
Block block = iblockdata.getBlock();
@ -54,10 +54,10 @@ index fc1b86828c8a38950f7a26735d8f5d125ee3e914..0d6f33319521101bd10352d597b5e3e0
this.level.getProfiler().push("explosion_blocks");
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index e4c2bd0131a54495fbd1930ad046225118e33186..4095b3ebacb8a55744fa99fea7e08d31e42d8b47 100644
index 6f04f79832b52fc898ec2b13af03bc28d4e0bbc1..b1cd5781620514533cf0f4d3c518ad461f98f23b 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -414,6 +414,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -425,6 +425,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) {
@ -69,10 +69,10 @@ index e4c2bd0131a54495fbd1930ad046225118e33186..4095b3ebacb8a55744fa99fea7e08d31
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 59a8d1984f3bcc94048a4ce3e530d21cc3f39d7f..17c369b49272ac72119708b507e6fa119343706e 100644
index 0422e389e5b9577417d09490a15584ed5b885209..24556481bf72dae526eb0f13826d693d6516bfb4 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 {
@@ -92,6 +92,19 @@ public class Block extends BlockBehaviour implements ItemLike {
protected final StateDefinition<Block, BlockState> stateDefinition;
private BlockState defaultBlockState;
// Paper start
@ -93,10 +93,10 @@ index 59a8d1984f3bcc94048a4ce3e530d21cc3f39d7f..17c369b49272ac72119708b507e6fa11
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 8f4b3bf0eba548a35b59232491c68d635e21123f..edb599da2431fa32f6e656dd3de8f4a6f5e2ed4f 100644
index 76720517cd2d82065eb8430cf854b536295341db..272279244f558c8ea298b35605c0421c037aad48 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
@@ -198,6 +198,12 @@ public class PistonBaseBlock extends DirectionalBlock {
@@ -199,6 +199,12 @@ public class PistonBaseBlock extends DirectionalBlock {
@Override
public boolean triggerEvent(BlockState state, Level world, BlockPos pos, int type, int data) {
Direction enumdirection = (Direction) state.getValue(PistonBaseBlock.FACING);
@ -109,7 +109,7 @@ index 8f4b3bf0eba548a35b59232491c68d635e21123f..edb599da2431fa32f6e656dd3de8f4a6
if (!world.isClientSide) {
boolean flag = this.getNeighborSignal(world, pos, enumdirection);
@@ -230,7 +236,7 @@ public class PistonBaseBlock extends DirectionalBlock {
@@ -231,7 +237,7 @@ public class PistonBaseBlock extends DirectionalBlock {
BlockState iblockdata1 = (BlockState) ((BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(MovingPistonBlock.FACING, enumdirection)).setValue(MovingPistonBlock.TYPE, this.isSticky ? PistonType.STICKY : PistonType.DEFAULT);
world.setBlock(pos, iblockdata1, 20);
@ -118,7 +118,7 @@ index 8f4b3bf0eba548a35b59232491c68d635e21123f..edb599da2431fa32f6e656dd3de8f4a6
world.blockUpdated(pos, iblockdata1.getBlock());
iblockdata1.updateNeighbourShapes(world, pos, 2);
if (this.isSticky) {
@@ -259,7 +265,14 @@ public class PistonBaseBlock extends DirectionalBlock {
@@ -260,7 +266,14 @@ public class PistonBaseBlock extends DirectionalBlock {
}
}
} else {
@ -135,10 +135,10 @@ index 8f4b3bf0eba548a35b59232491c68d635e21123f..edb599da2431fa32f6e656dd3de8f4a6
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 a5b7fbd940bf180b76017442ee7224761741fe52..fdb9a60ce9e1f8e3caabe1733e32e34146d4ddf3 100644
index 942dae5116840a2e8a992f0830574ab2a315bdf1..0ff34d2c569fbeae95509abed343b1e2f593378a 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
@@ -225,7 +225,7 @@ public abstract class BlockBehaviour {
@@ -222,7 +222,7 @@ public abstract class BlockBehaviour {
/** @deprecated */
@Deprecated
public boolean canBeReplaced(BlockState state, BlockPlaceContext context) {
@ -147,20 +147,20 @@ index a5b7fbd940bf180b76017442ee7224761741fe52..fdb9a60ce9e1f8e3caabe1733e32e341
}
/** @deprecated */
@@ -707,7 +707,11 @@ public abstract class BlockBehaviour {
public Block getBlock() {
return (Block) this.owner;
@@ -726,6 +726,12 @@ public abstract class BlockBehaviour {
return ((Block) this.owner).builtInRegistryHolder();
}
-
+ // Paper start
+ public final boolean isDestroyable() {
+ return getBlock().isDestroyable();
+ }
+ // Paper end
+
public Material getMaterial() {
return this.material;
}
@@ -805,7 +809,7 @@ public abstract class BlockBehaviour {
@@ -823,7 +829,7 @@ public abstract class BlockBehaviour {
}
public PushReaction getPistonPushReaction() {
@ -170,7 +170,7 @@ index a5b7fbd940bf180b76017442ee7224761741fe52..fdb9a60ce9e1f8e3caabe1733e32e341
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 05150fbade1d5a9b3b6de8ad1f5e825f34d1037e..ed79058696eb26a89b9d4116821840dbad9ea449 100644
index 8672545ba07205ef362442e1342f2ee5281f62cb..504f5d98d4a3d6b5bbd0998b495196aa6b39f47a 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
@@ -210,6 +210,13 @@ public class PortalForcer {

Datei anzeigen

@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <spottedleaf@spottedleaf.dev>
Date: Mon, 27 Apr 2020 00:04:16 -0700
Subject: [PATCH] Reduce allocation of Vec3D by entity tracker
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 16cce0feeca7d6f9f67100a07b824930adabcc72..926e4a8ea6e5afc6ad683761a5d8c4006cdec5ee 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1929,9 +1929,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public void updatePlayer(ServerPlayer player) {
org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot
if (player != this.entity) {
- Vec3 vec3d = player.position().subtract(this.entity.position());
+ // Paper start - remove allocation of Vec3D here
+ // Vec3 vec3d = player.position().subtract(this.entity.position());
+ double vec3d_dx = player.getX() - this.entity.getX();
+ double vec3d_dz = player.getZ() - this.entity.getZ();
+ // Paper end - remove allocation of Vec3D here
double d0 = (double) Math.min(this.getEffectiveRange(), (ChunkMap.this.viewDistance - 1) * 16);
- double d1 = vec3d.x * vec3d.x + vec3d.z * vec3d.z;
+ double d1 = vec3d_dx * vec3d_dx + vec3d_dz * vec3d_dz; // Paper
double d2 = d0 * d0;
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player);

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Ensure safe gateway teleport
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
index 4e47b641a2aae8e82890cda1bdb209803472b1d4..4e435a16a16c703a2978f4dc82606b8710742670 100644
index befd35b0edf4a76b119f711f8536369a02abc1ba..56d68b87287f0bb2c79ce0bed02fa333b85c4287 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -105,7 +105,14 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {

Datei anzeigen

@ -39,10 +39,10 @@ index 324e6d1a4fadd3e557e4ba05f04e6a5891cc54df..db77cdee224d14ec91e8d530dd65da51
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java
index 07f7effaa46afdd8766e3e6bfd8cb923e55f68cf..54e358ffb9c89469a7cd0df6493caf6162a37a21 100644
index a6612cc0ea87aeb8e87521ff7b5fe58c7b06b9ef..b9df8c90df16f2ed462a655fff3f36c37ecbbd31 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java
@@ -46,4 +46,16 @@ public class CraftRemoteConsoleCommandSender extends ServerCommandSender impleme
@@ -45,4 +45,16 @@ public class CraftRemoteConsoleCommandSender extends ServerCommandSender impleme
public void setOp(boolean value) {
throw new UnsupportedOperationException("Cannot change operator status of remote controller.");
}

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Optimize anyPlayerCloseEnoughForSpawning to use distance maps
Use a distance map to find the players in range quickly
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 8356a0e816324ce67df14151bdc186e60d8a223c..1324d48ff7540c4fe9148b3c6d4952ebbfb3fc22 100644
index 6e7d09cd48048957a14835b857ac708aafe8f664..4e8a79f2d3b6f52c6284bc9b0ce2423dc43a154f 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -76,6 +76,23 @@ public class ChunkHolder {
@ -42,10 +42,10 @@ index 8356a0e816324ce67df14151bdc186e60d8a223c..1324d48ff7540c4fe9148b3c6d4952eb
// Paper start
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 38efde791c99dd22de71183676d0301a1d5a14e0..63e264c862053874585b0f6aad2f89389c2dadcb 100644
index 926e4a8ea6e5afc6ad683761a5d8c4006cdec5ee..464a00542756437d8c3dccc1a85ae51cfdb588d2 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -181,11 +181,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -185,11 +185,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
final CallbackExecutor chunkLoadConversionCallbackExecutor = new CallbackExecutor(); // Paper
// Paper start - distance maps
private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
@ -69,7 +69,7 @@ index 38efde791c99dd22de71183676d0301a1d5a14e0..63e264c862053874585b0f6aad2f8938
// Paper start - per player mob spawning
if (this.playerMobDistanceMap != null) {
this.playerMobDistanceMap.add(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance());
@@ -195,6 +207,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -199,6 +211,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
void removePlayerFromDistanceMaps(ServerPlayer player) {
@ -80,7 +80,7 @@ index 38efde791c99dd22de71183676d0301a1d5a14e0..63e264c862053874585b0f6aad2f8938
// Paper start - per player mob spawning
if (this.playerMobDistanceMap != null) {
this.playerMobDistanceMap.remove(player);
@@ -206,6 +222,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -210,6 +226,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
int chunkX = MCUtil.getChunkCoordinate(player.getX());
int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
// Note: players need to be explicitly added to distance maps before they can be updated
@ -88,7 +88,7 @@ index 38efde791c99dd22de71183676d0301a1d5a14e0..63e264c862053874585b0f6aad2f8938
// Paper start - per player mob spawning
if (this.playerMobDistanceMap != null) {
this.playerMobDistanceMap.update(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance());
@@ -286,6 +303,38 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -298,6 +315,38 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.regionManagers.add(this.dataRegionManager);
// Paper end
this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper
@ -127,7 +127,7 @@ index 38efde791c99dd22de71183676d0301a1d5a14e0..63e264c862053874585b0f6aad2f8938
}
protected ChunkGenerator generator() {
@@ -537,6 +586,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -553,6 +602,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
holder = (ChunkHolder) this.pendingUnloads.remove(pos);
if (holder != null) {
holder.setTicketLevel(level);
@ -135,7 +135,7 @@ index 38efde791c99dd22de71183676d0301a1d5a14e0..63e264c862053874585b0f6aad2f8938
} else {
holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this);
// Paper start
@@ -632,6 +682,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -648,6 +698,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkHolder playerchunk = (ChunkHolder) this.updatingChunkMap.remove(j);
if (playerchunk != null) {
@ -143,7 +143,7 @@ index 38efde791c99dd22de71183676d0301a1d5a14e0..63e264c862053874585b0f6aad2f8938
this.pendingUnloads.put(j, playerchunk);
this.modified = true;
++i;
@@ -1370,43 +1421,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1413,43 +1464,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return this.anyPlayerCloseEnoughForSpawning(pos, false);
}
@ -286,10 +286,10 @@ index 4a9d0fca55b71f817defcb4286154c0a47bede03..62118348d6fb00f063507debb488e1ff
public String getDebugStatus() {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index cf5a5d98420c3849621bfdfae7bda7d5cb4b2dc9..846e6f41fdb6413b10f908c6b3f5c199a9f5ef38 100644
index 55b8f9dc3ad2b282e83c912ad8bf46b31cbd3765..d247f8997e5afc4c6449495da0b302a4814df495 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -872,6 +872,37 @@ public class ServerChunkCache extends ChunkSource {
@@ -873,6 +873,37 @@ public class ServerChunkCache extends ChunkSource {
if (flag) {
this.chunkMap.tick();
} else {
@ -327,7 +327,7 @@ index cf5a5d98420c3849621bfdfae7bda7d5cb4b2dc9..846e6f41fdb6413b10f908c6b3f5c199
LevelData worlddata = this.level.getLevelData();
ProfilerFiller gameprofilerfiller = this.level.getProfiler();
@@ -915,15 +946,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -916,15 +947,7 @@ public class ServerChunkCache extends ChunkSource {
boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
Collections.shuffle(list);
@ -344,7 +344,7 @@ index cf5a5d98420c3849621bfdfae7bda7d5cb4b2dc9..846e6f41fdb6413b10f908c6b3f5c199
Iterator iterator1 = list.iterator();
while (iterator1.hasNext()) {
@@ -931,9 +954,9 @@ public class ServerChunkCache extends ChunkSource {
@@ -932,9 +955,9 @@ public class ServerChunkCache extends ChunkSource {
LevelChunk chunk1 = chunkproviderserver_a.chunk;
ChunkPos chunkcoordintpair = chunk1.getPos();
@ -357,14 +357,14 @@ index cf5a5d98420c3849621bfdfae7bda7d5cb4b2dc9..846e6f41fdb6413b10f908c6b3f5c199
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index f8913f10e3e24c4da7c251bc4bc0ab0820807f57..90a844229e4a3ef5193cffc2c742b4c5a305a91c 100644
index 1e32ac21998cf7b7987815850fd022a5f282c5e0..c62db939791f6c80f612b14db0f8b98f334a96b6 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -253,6 +253,7 @@ public class ServerPlayer extends Player {
@@ -260,6 +260,7 @@ public class ServerPlayer extends Player {
// CraftBukkit end
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
+ public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, @Nullable ProfilePublicKey publicKey) {

Datei anzeigen

@ -6,7 +6,7 @@ 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 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761ebe89a38d8 100644
index 464a00542756437d8c3dccc1a85ae51cfdb588d2..95dbf60604d86666a359c0d861ef3eb8313e6184 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -70,6 +70,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket;
@ -17,7 +17,7 @@ index 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.server.network.ServerPlayerConnection;
import net.minecraft.util.CsvOutput;
@@ -192,10 +193,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -196,10 +197,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap; // this map is absent from updateMaps since it's controlled at the start of the chunkproviderserver tick
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerChunkTickRangeMap;
// Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
@ -53,7 +53,7 @@ index 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb
// Note: players need to be explicitly added to distance maps before they can be updated
this.playerChunkTickRangeMap.add(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
// Paper start - per player mob spawning
@@ -207,6 +233,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -211,6 +237,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
void removePlayerFromDistanceMaps(ServerPlayer player) {
@ -65,7 +65,7 @@ index 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb
// Paper start - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
this.playerMobSpawnMap.remove(player);
this.playerChunkTickRangeMap.remove(player);
@@ -222,6 +253,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -226,6 +257,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
int chunkX = MCUtil.getChunkCoordinate(player.getX());
int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
// Note: players need to be explicitly added to distance maps before they can be updated
@ -80,7 +80,7 @@ index 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb
this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
// Paper start - per player mob spawning
if (this.playerMobDistanceMap != null) {
@@ -303,6 +342,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -315,6 +354,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.regionManagers.add(this.dataRegionManager);
// Paper end
this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper
@ -126,7 +126,7 @@ index 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb
// Paper start - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
this.playerChunkTickRangeMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets,
(ServerPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ,
@@ -1544,17 +1622,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1587,17 +1665,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public void move(ServerPlayer player) {
@ -145,7 +145,7 @@ index 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb
int i = SectionPos.blockToSectionCoord(player.getBlockX());
int j = SectionPos.blockToSectionCoord(player.getBlockZ());
@@ -1681,7 +1749,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1724,7 +1792,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);
@ -154,7 +154,7 @@ index 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb
if (entity instanceof ServerPlayer) {
ServerPlayer entityplayer = (ServerPlayer) entity;
@@ -1725,7 +1793,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1768,7 +1836,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
entity.tracker = null; // Paper - We're no longer tracked
}
@ -192,7 +192,7 @@ index 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb
List<ServerPlayer> list = Lists.newArrayList();
List<ServerPlayer> list1 = this.level.players();
ObjectIterator objectiterator = this.entityMap.values().iterator();
@@ -1801,23 +1899,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1844,23 +1942,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos());
List<Entity> list = Lists.newArrayList();
List<Entity> list1 = Lists.newArrayList();
@ -236,8 +236,8 @@ index 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb
Iterator iterator;
Entity entity1;
@@ -1893,6 +1999,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.lastSectionPos = SectionPos.of(entity);
@@ -1936,6 +2042,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.lastSectionPos = SectionPos.of((EntityAccess) entity);
}
+ // Paper start - use distance map to optimise tracker
@ -280,10 +280,10 @@ index 63e264c862053874585b0f6aad2f89389c2dadcb..2c9cd3619b0759905637eff746a761eb
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 f69bc9d81750feb108119347f984de6bca24ae44..14b3f14d2489bdbeb89886a115db2ba78cb97ad7 100644
index 1413acf7029fd690fbdb50c80037d040ef24e24f..bbd94142c3519bc8a6602a31699a7132119e395c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -54,6 +54,7 @@ import net.minecraft.network.syncher.EntityDataSerializers;
@@ -56,6 +56,7 @@ import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
@ -291,7 +291,7 @@ index f69bc9d81750feb108119347f984de6bca24ae44..14b3f14d2489bdbeb89886a115db2ba7
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
@@ -362,6 +363,39 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -383,6 +384,39 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
// Paper end

Datei anzeigen

@ -8,10 +8,10 @@ so inline where possible, and avoid the abstraction of the
Either class.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 5009ad1a758e192eaf6ca59baab26d2ba58a6c66..894186d25863a437e49ef0c10b2f2dab34af7ed0 100644
index 8808b8b5b3fa03a1a0c4d843867f1e26d966ab85..e5f7ed6e70231c447f3983ae181e23acc6f69de6 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2169,19 +2169,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2247,19 +2247,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
private boolean isPositionTickingWithEntitiesLoaded(long chunkPos) {
@ -39,10 +39,10 @@ index 5009ad1a758e192eaf6ca59baab26d2ba58a6c66..894186d25863a437e49ef0c10b2f2dab
private final class EntityCallbacks implements LevelCallback<Entity> {
diff --git a/src/main/java/net/minecraft/world/level/ChunkPos.java b/src/main/java/net/minecraft/world/level/ChunkPos.java
index 4335132883e959f0c9649d5640b703a291d8a7aa..22d95316eac3731c66dd7dde960e4d71a6b565e2 100644
index 2d41f619577b41d6420159668bbab70fb6c762eb..ed0b136e99def41d4377f2004477826b3546a145 100644
--- a/src/main/java/net/minecraft/world/level/ChunkPos.java
+++ b/src/main/java/net/minecraft/world/level/ChunkPos.java
@@ -50,7 +50,7 @@ public class ChunkPos {
@@ -60,7 +60,7 @@ public class ChunkPos {
}
public static long asLong(BlockPos pos) {
@ -52,7 +52,7 @@ index 4335132883e959f0c9649d5640b703a291d8a7aa..22d95316eac3731c66dd7dde960e4d71
public static int getX(long pos) {
diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
index 1407f30d467fa78bc207a91da0e6395c0a9ba83d..2110cb437807f99994838b57653caefe2f01a9c5 100644
index e55ec74ac0363def04c2d7bf1b2a9d873388ea70..823489437dad68f52213f25d84d84ac64f7cc208 100644
--- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
+++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
@@ -383,6 +383,11 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Fix villager trading demand - MC-163962
Prevent demand from going negative and tending to negative infinity
diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
index 510730fecc8a88dd0588689512863bd30ac248c7..f3cf16ce1e1d6c8f76ca5823f532925253ae64aa 100644
index 987e65332058f364fcef0a29c97b206b14ad6457..8b46e494ecd0cce5ab0b2bf8e50cf50dc7e2a7e5 100644
--- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
+++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
@@ -113,7 +113,7 @@ public class MerchantOffer {

Datei anzeigen

@ -15,10 +15,10 @@ Previously maps would load all chunks in a certain radius depending on
five ticks that movement occur in anyways.
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
index f3c0d48f1f6bc6a1a20d4b25d943b01c8736bb36..d15d87208d21173912cf489b55b1c5d226ea998b 100644
index 339dfd9fdffbc1c49b9112ba43ef6f05d85bdf86..44bfc5560a1b43925aabfd8137495e169da32fa2 100644
--- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -130,9 +130,9 @@ public class MapItem extends ComplexItem {
@@ -131,9 +131,9 @@ public class MapItem extends ComplexItem {
int k2 = (j / i + k1 - 64) * i;
int l2 = (k / i + l1 - 64) * i;
Multiset<MaterialColor> multiset = LinkedHashMultiset.create();

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Use seed based lookup for Treasure Maps - Fixes lag from
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
index d15d87208d21173912cf489b55b1c5d226ea998b..6f86f00d33cd50a2b67409c2f0f5400c869b802a 100644
index 44bfc5560a1b43925aabfd8137495e169da32fa2..d407cf849a31a7a77fda07aa687ebb254f43d6ab 100644
--- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -251,14 +251,13 @@ public class MapItem extends ComplexItem {
@@ -252,14 +252,13 @@ public class MapItem extends ComplexItem {
boolean[] aboolean = new boolean[16384];
int l = j / i - 64;
int i1 = k / i - 64;
@ -20,8 +20,8 @@ index d15d87208d21173912cf489b55b1c5d226ea998b..6f86f00d33cd50a2b67409c2f0f5400c
for (j1 = 0; j1 < 128; ++j1) {
for (k1 = 0; k1 < 128; ++k1) {
- Biome.BiomeCategory biomebase_geography = Biome.getBiomeCategory(world.getBiome(blockposition_mutableblockposition.set((l + k1) * i, 0, (i1 + j1) * i)));
+ Biome.BiomeCategory biomebase_geography = Biome.getBiomeCategory(world.getUncachedNoiseBiome((l + k1) * i, 0, (i1 + j1) * i)); // Paper
- Holder<Biome> holder = world.getBiome(blockposition_mutableblockposition.set((l + k1) * i, 0, (i1 + j1) * i));
+ Holder<Biome> holder = world.getUncachedNoiseBiome((l + k1) * i, 0, (i1 + j1) * i); // Paper
aboolean[j1 * 128 + k1] = biomebase_geography == Biome.BiomeCategory.OCEAN || biomebase_geography == Biome.BiomeCategory.RIVER || biomebase_geography == Biome.BiomeCategory.SWAMP;
aboolean[j1 * 128 + k1] = holder.is(BiomeTags.WATER_ON_MAP_OUTLINES);
}

Datei anzeigen

@ -49,10 +49,10 @@ index 62a0f6772bacfb8ad90c15493e0d48e29b70fac1..c639557108ad9c59ccdd0b543b5507fb
+
}
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 edb599da2431fa32f6e656dd3de8f4a6f5e2ed4f..f4f49cc4109d4ae72c0a50f7acbd181d05bf415a 100644
index 272279244f558c8ea298b35605c0421c037aad48..053bb85355c1b0fd93477187f4cedc582c6a480b 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
@@ -409,14 +409,26 @@ public class PistonBaseBlock extends DirectionalBlock {
@@ -411,14 +411,26 @@ public class PistonBaseBlock extends DirectionalBlock {
}
for (k = list.size() - 1; k >= 0; --k) {

Datei anzeigen

@ -14,10 +14,10 @@ behaviour, we need to move all of this dangerous logic outside
of the move call and into an appropriate place in the tick method.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9f80408a7cf39f1f8b58c688b91de4731208e93d..61d5b5001979751da986fd8a634a58094c172946 100644
index d5b7a909a26135abce682c062cedd9b2de0239d0..0693356f47cfbc4c3ff2573bf2ce4f28d41f5fd7 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1342,6 +1342,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1372,6 +1372,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9));
this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 61d5b5001979751da986fd8a634a58094c172946..5069017665f98a8b3900220b01ca4b99bc8d2f93 100644
index 0693356f47cfbc4c3ff2573bf2ce4f28d41f5fd7..90ce47c8ac50da05b3082402d56b295fc3293532 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2805,9 +2805,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2996,9 +2996,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
this.player.resetLastActionTime();
if (!this.player.isSpectator() && this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu instanceof RecipeBookMenu) {

Datei anzeigen

@ -9,10 +9,10 @@ on harddrives.
-DPaper.enable-sync-chunk-writes=true to enable
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
index a7938420f6840b9d3880fb895aaf709ebd844312..ebfaa8d5de5b905bd2dd7778728b8c9939d01252 100644
index cc92e2c5e6b62c6a67d0a6534b078e3a6029daf5..26345494ce190b5cd2ab58dd7d4b046796767b20 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -111,7 +111,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
@@ -136,7 +136,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
this.maxWorldSize = this.get("max-world-size", (integer) -> {
return Mth.clamp(integer, (int) 1, 29999984);
}, 29999984);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add permission for command blocks
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index d4f57fde2f02071dfde08cb2a5c8359984056aef..176e5bbac94cf39805dcacfcae3a3daa98b793b7 100644
index 312768054e02847bbc7d2ec7fa6198dad52b86d2..32a6b4d8e6c8f9c05cc7ca811c2188aa554f9e3e 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -403,7 +403,7 @@ public class ServerPlayerGameMode {
@@ -396,7 +396,7 @@ public class ServerPlayerGameMode {
BlockEntity tileentity = this.level.getBlockEntity(pos);
Block block = iblockdata.getBlock();
@ -18,32 +18,32 @@ index d4f57fde2f02071dfde08cb2a5c8359984056aef..176e5bbac94cf39805dcacfcae3a3daa
return false;
} else if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 5069017665f98a8b3900220b01ca4b99bc8d2f93..b03b8bb8e3f19de772d41bc5a9bda3192273df07 100644
index 90ce47c8ac50da05b3082402d56b295fc3293532..44b44548c33f5128fbf09ac36c6bab428b8a8c97 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -796,7 +796,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -828,7 +828,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (!this.server.isCommandBlockEnabled()) {
this.player.sendMessage(new TranslatableComponent("advMode.notEnabled"), Util.NIL_UUID);
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
- } else if (!this.player.canUseGameMasterBlocks()) {
+ } else if (!this.player.canUseGameMasterBlocks() && (!this.player.isCreative() || !this.player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission
this.player.sendMessage(new TranslatableComponent("advMode.notAllowed"), Util.NIL_UUID);
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
} else {
BaseCommandBlock commandblocklistenerabstract = null;
@@ -863,7 +863,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -895,7 +895,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (!this.server.isCommandBlockEnabled()) {
this.player.sendMessage(new TranslatableComponent("advMode.notEnabled"), Util.NIL_UUID);
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
- } else if (!this.player.canUseGameMasterBlocks()) {
+ } else if (!this.player.canUseGameMasterBlocks() && (!this.player.isCreative() || !this.player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission
this.player.sendMessage(new TranslatableComponent("advMode.notAllowed"), Util.NIL_UUID);
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
} else {
BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level);
diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
index 5b125aa77e769983a0aee7c5f6eb6a8a146fead0..fca57e5d1e25db6367c53ad04e49508ebf2223e7 100644
index da504702bc9423774b35dff792d2dbe7fc270fe3..c0195f73cd2c8721e882c681eaead65471710081 100644
--- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
+++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
@@ -199,7 +199,7 @@ public abstract class BaseCommandBlock implements CommandSource {
@@ -198,7 +198,7 @@ public abstract class BaseCommandBlock implements CommandSource {
}
public InteractionResult usedBy(Player player) {
@ -53,7 +53,7 @@ index 5b125aa77e769983a0aee7c5f6eb6a8a146fead0..fca57e5d1e25db6367c53ad04e49508e
} else {
if (player.getCommandSenderWorld().isClientSide) {
diff --git a/src/main/java/net/minecraft/world/level/block/CommandBlock.java b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
index 25a297968388f85108d7b9de96fdc7d368034e4d..1a48c5ea1f2f755abfa85469e26f37ea5f02d6da 100644
index 061a56e3828767cd6576d5a9edde5f3498e609d0..2e7c03b00bc941b86df6a7f1b2b188c9f0aede22 100644
--- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
@@ -130,7 +130,7 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Ensure Entity AABB's are never invalid
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 14b3f14d2489bdbeb89886a115db2ba78cb97ad7..5d51296954dc9e1c3c9576d7afb5287c76ab3afe 100644
index bbd94142c3519bc8a6602a31699a7132119e395c..36fa5864edb6da34ba005487fd62255421d6190f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -599,8 +599,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -621,8 +621,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public void setPos(double x, double y, double z) {
@ -19,7 +19,7 @@ index 14b3f14d2489bdbeb89886a115db2ba78cb97ad7..5d51296954dc9e1c3c9576d7afb5287c
}
protected AABB makeBoundingBox() {
@@ -3783,6 +3783,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3834,6 +3834,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public final void setPosRaw(double x, double y, double z) {
@ -31,8 +31,8 @@ index 14b3f14d2489bdbeb89886a115db2ba78cb97ad7..5d51296954dc9e1c3c9576d7afb5287c
if (this.position.x != x || this.position.y != y || this.position.z != z) {
this.position = new Vec3(x, y, z);
int i = Mth.floor(x);
@@ -3805,6 +3810,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
@@ -3851,6 +3856,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.levelCallback.onMove();
}
+ // Paper start - never allow AABB to become desynced from position

Datei anzeigen

@ -8,10 +8,10 @@ makes it so that the server keeps the last difficulty used instead
of restoring the server.properties every single load.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 12c1cee3b3055b44d0ca3196eb37e51879fce67b..f85ee370c89b59ad58f182da2ff6d0d11c6e3a8b 100644
index 9905dba12c6b3f584a6fab94517592b6d2c042f0..06e7ca13f24838bdb2305e1c12b1aeac9152612f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -820,7 +820,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -788,7 +788,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
chunkproviderserver.getLightEngine().setTaskPerBatch(worldserver.paperConfig.lightQueueSize); // Paper - increase light queue size
// CraftBukkit start
// this.updateMobSpawningFlags();
@ -20,7 +20,7 @@ index 12c1cee3b3055b44d0ca3196eb37e51879fce67b..f85ee370c89b59ad58f182da2ff6d0d1
this.forceTicks = false;
// CraftBukkit end
@@ -1733,11 +1733,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1692,11 +1692,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
@ -40,7 +40,7 @@ index 12c1cee3b3055b44d0ca3196eb37e51879fce67b..f85ee370c89b59ad58f182da2ff6d0d1
}
}
@@ -1751,7 +1754,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1710,7 +1713,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
@ -50,7 +50,7 @@ index 12c1cee3b3055b44d0ca3196eb37e51879fce67b..f85ee370c89b59ad58f182da2ff6d0d1
}
diff --git a/src/main/java/net/minecraft/server/commands/DifficultyCommand.java b/src/main/java/net/minecraft/server/commands/DifficultyCommand.java
index e23dca1a711955417ef3f590960d4e7a388b9147..36dd28498eb75152a79dae4353ef657a0485403d 100644
index 4bb29f86538552bb62125cc61210fd77b1ec671d..817193ca5fc15134d2985187bc2226ccbb4f0108 100644
--- a/src/main/java/net/minecraft/server/commands/DifficultyCommand.java
+++ b/src/main/java/net/minecraft/server/commands/DifficultyCommand.java
@@ -47,7 +47,7 @@ public class DifficultyCommand {
@ -59,53 +59,53 @@ index e23dca1a711955417ef3f590960d4e7a388b9147..36dd28498eb75152a79dae4353ef657a
} else {
- worldServer.serverLevelData.setDifficulty(difficulty); // CraftBukkit
+ minecraftserver.setDifficulty(worldServer, difficulty, true); // Paper - don't skip other difficulty-changing logic (fix upstream's fix)
source.sendSuccess(new TranslatableComponent("commands.difficulty.success", new Object[]{difficulty.getDisplayName()}), true);
source.sendSuccess(Component.translatable("commands.difficulty.success", difficulty.getDisplayName()), true);
return 0;
}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index cec0082718c2a729044d6f19d74b8e4425816725..8eca8825008713467a20f84d71ed0f32d5a40e47 100644
index ce700e9c74ad961703d95245febf95d060a7df8d..b789f68b84812a3a4bab50920f0c0b0aa13ef63b 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -369,7 +369,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -334,7 +334,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@Override
public void forceDifficulty() {
- this.setDifficulty(this.getProperties().difficulty, true);
+ //this.a(this.getDedicatedServerProperties().difficulty, true); // Paper - Don't overwrite level.dat's difficulty, keep current
+ // this.setDifficulty(this.getProperties().difficulty, true); // Paper - Don't overwrite level.dat's difficulty, keep current
}
@Override
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 90a844229e4a3ef5193cffc2c742b4c5a305a91c..d60d3ea1ec9c14dafda9f0fffd16ed2ba947789b 100644
index c62db939791f6c80f612b14db0f8b98f334a96b6..896fe621d47ff3fef40e109d63251480fea082a9 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1120,7 +1120,7 @@ public class ServerPlayer extends Player {
@@ -1129,7 +1129,7 @@ public class ServerPlayer extends Player {
this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
this.connection.send(new ClientboundRespawnPacket(worldserver.dimensionTypeRegistration(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true));
this.connection.send(new ClientboundRespawnPacket(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true, this.getLastDeathLocation()));
- this.connection.send(new ClientboundChangeDifficultyPacket(this.level.getDifficulty(), this.level.getLevelData().isDifficultyLocked()));
+ this.connection.send(new ClientboundChangeDifficultyPacket(worldserver.getDifficulty(), this.level.getLevelData().isDifficultyLocked())); // Paper - fix difficulty sync issue
PlayerList playerlist = this.server.getPlayerList();
playerlist.sendPlayerPermissionLevel(this);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b03b8bb8e3f19de772d41bc5a9bda3192273df07..6acc4ee50ba32a208930bda89d37f155e3f4835a 100644
index 44b44548c33f5128fbf09ac36c6bab428b8a8c97..fdf77097cff7c3af87e390b0bfd9e8aadf7c55ec 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3063,7 +3063,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3257,7 +3257,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) {
- this.server.setDifficulty(packet.getDifficulty(), false);
+ //this.minecraftServer.a(packetplayindifficultychange.b(), false); // Paper - don't allow clients to change this
+ // this.server.setDifficulty(packet.getDifficulty(), false); // Paper - don't allow clients to change this
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0e339c13f58419a6af39b99782160ac3155b0606..0c736a05aaaaaaba65730ca9c731045ac1c9338c 100644
index 69e2be4906ec9cb2efaca51bda05b7e3bd8aee54..f16737dcdff71c047284fc61ad0b74d65cd6dc3c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -945,8 +945,8 @@ public final class CraftServer implements Server {
@@ -940,8 +940,8 @@ public final class CraftServer implements Server {
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); // Paper
for (ServerLevel world : this.console.getAllLevels()) {