From 1d6c40afacc159b10eeb7752334ee94354d71fe4 Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Sun, 15 Dec 2024 16:11:42 +0100 Subject: [PATCH] readd chunk pos long optimization --- .../minecraft/world/level/BaseCommandBlock.java.patch | 2 +- .../net/minecraft/world/level/BaseSpawner.java.patch | 5 ++--- .../net/minecraft/world/level/ChunkPos.java.patch | 9 +++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/paper-server/patches/sources/net/minecraft/world/level/BaseCommandBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/BaseCommandBlock.java.patch index dc6271b85f..a00c43b741 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/BaseCommandBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/BaseCommandBlock.java.patch @@ -17,7 +17,7 @@ } }); - server.getCommands().performPrefixedCommand(commandSourceStack, this.command); -+ server.getCommands().dispatchServerCommand(commandSourceStack, this.command); // CraftBukkit ++ server.getCommands().dispatchServerCommand(commandSourceStack, this.command); // CraftBukkit } catch (Throwable var6) { CrashReport crashReport = CrashReport.forThrowable(var6, "Executing command block"); CrashReportCategory crashReportCategory = crashReport.addCategory("Command to be executed"); diff --git a/paper-server/patches/sources/net/minecraft/world/level/BaseSpawner.java.patch b/paper-server/patches/sources/net/minecraft/world/level/BaseSpawner.java.patch index 78ae4f91d8..273c487386 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/BaseSpawner.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/BaseSpawner.java.patch @@ -86,7 +86,7 @@ + flag = true; // Paper + // CraftBukkit start + if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { -+ continue; ++ continue; + } + if (!serverLevel.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER)) { + // CraftBukkit end @@ -106,12 +106,11 @@ } public void load(@Nullable Level level, BlockPos pos, CompoundTag tag) { -- this.spawnDelay = tag.getShort("Delay"); + // Paper start - use larger int if set + if (tag.contains("Paper.Delay")) { + this.spawnDelay = tag.getInt("Paper.Delay"); + } else { -+ this.spawnDelay = tag.getShort("Delay"); + this.spawnDelay = tag.getShort("Delay"); + } + // Paper end boolean flag = tag.contains("SpawnData", 10); diff --git a/paper-server/patches/sources/net/minecraft/world/level/ChunkPos.java.patch b/paper-server/patches/sources/net/minecraft/world/level/ChunkPos.java.patch index 1b795bb313..891340e337 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/ChunkPos.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/ChunkPos.java.patch @@ -28,3 +28,12 @@ } public static ChunkPos minFromRegion(int chunkX, int chunkZ) { +@@ -74,7 +_,7 @@ + } + + public long toLong() { +- return asLong(this.x, this.z); ++ return this.longKey; // Paper + } + + public static long asLong(int x, int z) {