From 9da160169a9475f9f64304d4c8111bf70a6470df Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Fri, 11 Jun 2021 23:24:50 -0700 Subject: [PATCH] even even even even even even even more work --- .../0039-Misc-Utils.patch} | 0 ...120-Cache-user-authenticator-threads.patch | 2 ++ ...ge-the-Entity-Random-seed-for-squids.patch | 1 + ...067-Use-a-Shared-Random-for-Entities.patch | 13 +++++++ ...-from-ArmorStand-and-SpawnEgg-items.patch} | 35 +++++++++---------- ...10-Cache-user-authenticator-threads.patch} | 24 ++++++++----- 6 files changed, 47 insertions(+), 28 deletions(-) rename patches/{api-unmapped/0038-Misc-Utils.patch => api/0039-Misc-Utils.patch} (100%) rename patches/{server-remapped => removed/1.17}/0120-Cache-user-authenticator-threads.patch (97%) rename patches/{server-remapped => removed/1.17}/0238-Don-t-change-the-Entity-Random-seed-for-squids.patch (94%) rename patches/{server-remapped/0119-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch => server/0109-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch} (60%) rename patches/{server-remapped/0121-Optimise-removeQueue.patch => server/0110-Cache-user-authenticator-threads.patch} (75%) diff --git a/patches/api-unmapped/0038-Misc-Utils.patch b/patches/api/0039-Misc-Utils.patch similarity index 100% rename from patches/api-unmapped/0038-Misc-Utils.patch rename to patches/api/0039-Misc-Utils.patch diff --git a/patches/server-remapped/0120-Cache-user-authenticator-threads.patch b/patches/removed/1.17/0120-Cache-user-authenticator-threads.patch similarity index 97% rename from patches/server-remapped/0120-Cache-user-authenticator-threads.patch rename to patches/removed/1.17/0120-Cache-user-authenticator-threads.patch index be4de8cb23..fbc0443e78 100644 --- a/patches/server-remapped/0120-Cache-user-authenticator-threads.patch +++ b/patches/removed/1.17/0120-Cache-user-authenticator-threads.patch @@ -4,6 +4,8 @@ Date: Wed, 23 Nov 2016 08:31:45 -0500 Subject: [PATCH] Cache user authenticator threads +TODO it looks like someone royally messed this one up, patch name doesn't remotely +describe contents. Good thing this patch is no longer relevant at all diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java index 0597c0c3e881dd43cf91bd3088ed30dfecfe8098..175bf535066afc42de8a3f0d11c46af66f3e3e52 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/patches/server-remapped/0238-Don-t-change-the-Entity-Random-seed-for-squids.patch b/patches/removed/1.17/0238-Don-t-change-the-Entity-Random-seed-for-squids.patch similarity index 94% rename from patches/server-remapped/0238-Don-t-change-the-Entity-Random-seed-for-squids.patch rename to patches/removed/1.17/0238-Don-t-change-the-Entity-Random-seed-for-squids.patch index 4887c3dd7e..56015aa8db 100644 --- a/patches/server-remapped/0238-Don-t-change-the-Entity-Random-seed-for-squids.patch +++ b/patches/removed/1.17/0238-Don-t-change-the-Entity-Random-seed-for-squids.patch @@ -4,6 +4,7 @@ Date: Thu, 19 Jul 2018 01:05:00 -0400 Subject: [PATCH] Don't change the Entity Random seed for squids +Rebased into the patch to add the shared entity random diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java index 5a7582fd4f8e883d2f08a0227932c17d7576b957..2e5a35565b6b7c4d3f7fdab45095f789c33f8937 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Squid.java diff --git a/patches/server/0067-Use-a-Shared-Random-for-Entities.patch b/patches/server/0067-Use-a-Shared-Random-for-Entities.patch index 27b07b1be0..a8e9435341 100644 --- a/patches/server/0067-Use-a-Shared-Random-for-Entities.patch +++ b/patches/server/0067-Use-a-Shared-Random-for-Entities.patch @@ -40,3 +40,16 @@ index e9e87dc8c80d83dc7c472b0611077d8f9f4e5fcf..eceaeed527f34860e1c55b9f96863f14 this.remainingFireTicks = -this.getFireImmuneTicks(); this.fluidHeight = new Object2DoubleArrayMap(2); this.firstTick = true; +diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java +index 2b88f5be9bd0766f28e07251175aa353242cf11f..5faa9e05e041a8bdcac88f3c3af7620353c10c3a 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java ++++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java +@@ -50,7 +50,7 @@ public class Squid extends WaterAnimal { + + public Squid(EntityType type, Level world) { + super(type, world); +- this.random.setSeed((long) this.getId()); ++ //this.random.setSeed((long) this.getId()); // Paper - we set the random to shared, do not clobber the seed + this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; + } + diff --git a/patches/server-remapped/0119-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch b/patches/server/0109-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch similarity index 60% rename from patches/server-remapped/0119-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch rename to patches/server/0109-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch index 782f93006e..0cef3ad756 100644 --- a/patches/server-remapped/0119-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch +++ b/patches/server/0109-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch @@ -5,18 +5,10 @@ Subject: [PATCH] Filter bad data from ArmorStand and SpawnEgg items diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 622affa0dc3cc1eadaed400511f2ca2cde3fca2a..e83216be5a00d5b927d8c2fc364551bd3077c974 100644 +index 96247356d7888d5681bff60567add1188aedb18b..e83216be5a00d5b927d8c2fc364551bd3077c974 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -2,6 +2,7 @@ package com.destroystokyo.paper; - - import java.util.List; - -+import org.bukkit.Bukkit; - import org.bukkit.configuration.file.YamlConfiguration; - import org.spigotmc.SpigotWorldConfig; - -@@ -305,4 +306,12 @@ public class PaperWorldConfig { +@@ -306,4 +306,12 @@ public class PaperWorldConfig { private void removeCorruptTEs() { removeCorruptTEs = getBoolean("remove-corrupt-tile-entities", false); } @@ -30,20 +22,25 @@ index 622affa0dc3cc1eadaed400511f2ca2cde3fca2a..e83216be5a00d5b927d8c2fc364551bd + } } diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index 1d87717cc9002ea202ee2ca614aaa8a4c7ea3cb2..ff8f7e4569a889ead1512b7c9908f9c5cad9eed5 100644 +index eb838fcad0593573f536d5e043cbd3f4bbe25d74..2332a00780edcf054ec63a60a42962033d0cc74a 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -270,6 +270,13 @@ public class FallingBlockEntity extends Entity { +@@ -308,6 +308,18 @@ public class FallingBlockEntity extends Entity { @Override - protected void readAdditionalSaveData(CompoundTag tag) { - this.blockState = NbtUtils.readBlockState(tag.getCompound("BlockState")); + protected void readAdditionalSaveData(CompoundTag nbt) { + this.blockState = NbtUtils.readBlockState(nbt.getCompound("BlockState")); + // Paper start - Block FallingBlocks with Command Blocks -+ // Check mappings on update - dc = "repeating_command_block" - dd = "chain_command_block" + final Block b = this.blockState.getBlock(); -+ if (this.level.paperConfig.filterNBTFromSpawnEgg && (b == Blocks.COMMAND_BLOCK || b == Blocks.REPEATING_COMMAND_BLOCK || b == Blocks.CHAIN_COMMAND_BLOCK)) { ++ if (this.level.paperConfig.filterNBTFromSpawnEgg ++ && (b == Blocks.COMMAND_BLOCK ++ || b == Blocks.REPEATING_COMMAND_BLOCK ++ || b == Blocks.CHAIN_COMMAND_BLOCK ++ || b == Blocks.JIGSAW ++ || b == Blocks.STRUCTURE_BLOCK ++ || b instanceof net.minecraft.world.level.block.GameMasterBlock)) { + this.blockState = Blocks.STONE.defaultBlockState(); + } + // Paper end - this.time = tag.getInt("Time"); - if (tag.contains("HurtEntities", 99)) { - this.hurtEntities = tag.getBoolean("HurtEntities"); + this.time = nbt.getInt("Time"); + if (nbt.contains("HurtEntities", 99)) { + this.hurtEntities = nbt.getBoolean("HurtEntities"); diff --git a/patches/server-remapped/0121-Optimise-removeQueue.patch b/patches/server/0110-Cache-user-authenticator-threads.patch similarity index 75% rename from patches/server-remapped/0121-Optimise-removeQueue.patch rename to patches/server/0110-Cache-user-authenticator-threads.patch index f3b8068513..01bdd6b870 100644 --- a/patches/server-remapped/0121-Optimise-removeQueue.patch +++ b/patches/server/0110-Cache-user-authenticator-threads.patch @@ -1,27 +1,33 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Alfie Cleveland Date: Fri, 25 Nov 2016 13:22:40 +0000 -Subject: [PATCH] Optimise removeQueue +Subject: [PATCH] Cache user authenticator threads diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 9dbb3bb79ae2de6635f71e5ee5bebeb5e57b624e..e3c1460c580ea348ee6d436018244441a5a1206e 100644 +index 11c0da9b36aecc1a7d3acb2dccdae962426dd2e7..3e57eb2e50f94085fd23b54a54d4cf7a0b7919c7 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -114,6 +114,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -117,6 +117,18 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener } + // Paper start - Cache authenticator threads + private static final AtomicInteger threadId = new AtomicInteger(0); + private static final java.util.concurrent.ExecutorService authenticatorPool = java.util.concurrent.Executors.newCachedThreadPool( -+ r -> new Thread(r, "User Authenticator #" + threadId.incrementAndGet()) ++ r -> { ++ Thread ret = new Thread(r, "User Authenticator #" + threadId.incrementAndGet()); ++ ++ ret.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)); ++ ++ return ret; ++ } + ); + // Paper end // Spigot start public void initUUID() { -@@ -193,8 +199,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -209,8 +221,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.nonce)); } else { // Spigot start @@ -32,8 +38,8 @@ index 9dbb3bb79ae2de6635f71e5ee5bebeb5e57b624e..e3c1460c580ea348ee6d436018244441 @Override public void run() { try { -@@ -205,7 +211,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener - server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + gameProfile.getName(), ex); +@@ -221,7 +233,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener + server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + ServerLoginPacketListenerImpl.this.gameProfile.getName(), ex); } } - }.start(); @@ -42,7 +48,7 @@ index 9dbb3bb79ae2de6635f71e5ee5bebeb5e57b624e..e3c1460c580ea348ee6d436018244441 // Spigot end } -@@ -234,7 +241,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -250,7 +263,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener throw new IllegalStateException("Protocol error", cryptographyexception); } @@ -52,7 +58,7 @@ index 9dbb3bb79ae2de6635f71e5ee5bebeb5e57b624e..e3c1460c580ea348ee6d436018244441 public void run() { GameProfile gameprofile = ServerLoginPacketListenerImpl.this.gameProfile; -@@ -279,10 +287,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -295,10 +309,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener return ServerLoginPacketListenerImpl.this.server.getPreventProxyConnections() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null; }