From 4ec60d895824e917ba26a3478407af171263870b Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Sun, 13 Jun 2021 01:26:58 -0700 Subject: [PATCH] patches and patches --- ...-replace-OfflinePlayer-getLastPlayed.patch | 0 ...-ItemStack-Recipe-API-helper-methods.patch | 0 .../Add-PlayerConnectionCloseEvent.patch | 0 .../Add-WhitelistToggleEvent.patch | 0 .../Add-more-Zombie-API.patch | 0 .../BlockDestroyEvent.patch | 0 ...eserved-channel-check-to-be-sensible.patch | 0 ...ault-permission-message-configurable.patch | 0 ...tion-supression-of-EntityDismount-Ve.patch | 0 .../Fix-sign-edit-memory-leak.patch | 44 -------------- ...-replace-OfflinePlayer-getLastPlayed.patch | 10 ++-- .../Add-PlayerConnectionCloseEvent.patch | 15 ++--- .../Add-more-Zombie-API.patch | 32 +++++----- ...-remove-from-being-called-on-Players.patch | 0 .../BlockDestroyEvent.patch | 4 +- .../Book-Size-Limits.patch | 12 ++-- ...t-allow-digging-into-unloaded-chunks.patch | 6 +- ...-after-profile-lookups-if-not-needed.patch | 0 ...onRetractEvent-for-all-empty-pistons.patch | 0 ...om-Shapeless-Custom-Crafting-Recipes.patch | 6 +- .../Fix-SpongeAbsortEvent-handling.patch | 16 +---- ...e-Large-Packets-disconnecting-client.patch | 49 ++++++--------- ...er-Thread-Pool-and-Thread-Priorities.patch | 60 ++++++++----------- .../Limit-Client-Sign-length-more.patch | 26 ++++---- ...ault-permission-message-configurable.patch | 0 .../Optimize-World-Time-Updates.patch | 0 ...Prevent-Enderman-from-loading-chunks.patch | 20 +++---- ...Prevent-rayTrace-from-loading-chunks.patch | 2 +- .../Reset-players-airTicks-on-respawn.patch | 4 +- ...store-custom-InventoryHolder-support.patch | 6 +- .../Use-Vanilla-Minecart-Speeds.patch | 0 ...vehicle-tracking-issue-on-disconnect.patch | 2 +- ...entity-dismount-during-teleportation.patch | 14 ++--- 33 files changed, 126 insertions(+), 202 deletions(-) rename patches/{api-unmapped => api}/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch (100%) rename patches/{api-unmapped => api}/Add-ItemStack-Recipe-API-helper-methods.patch (100%) rename patches/{api-unmapped => api}/Add-PlayerConnectionCloseEvent.patch (100%) rename patches/{api-unmapped => api}/Add-WhitelistToggleEvent.patch (100%) rename patches/{api-unmapped => api}/Add-more-Zombie-API.patch (100%) rename patches/{api-unmapped => api}/BlockDestroyEvent.patch (100%) rename patches/{api-unmapped => api}/Change-the-reserved-channel-check-to-be-sensible.patch (100%) rename patches/{api-unmapped => api}/Make-the-default-permission-message-configurable.patch (100%) rename patches/{api-unmapped => api}/Support-cancellation-supression-of-EntityDismount-Ve.patch (100%) delete mode 100644 patches/server-remapped/Fix-sign-edit-memory-leak.patch rename patches/{server-remapped => server}/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch (96%) rename patches/{server-remapped => server}/Add-PlayerConnectionCloseEvent.patch (84%) rename patches/{server-remapped => server}/Add-more-Zombie-API.patch (82%) rename patches/{server-remapped => server}/Block-Entity-remove-from-being-called-on-Players.patch (100%) rename patches/{server-remapped => server}/BlockDestroyEvent.patch (94%) rename patches/{server-remapped => server}/Book-Size-Limits.patch (93%) rename patches/{server-remapped => server}/Don-t-allow-digging-into-unloaded-chunks.patch (95%) rename patches/{server-remapped => server}/Don-t-sleep-after-profile-lookups-if-not-needed.patch (100%) rename patches/{server-remapped => server}/Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch (100%) rename patches/{server-remapped => server}/Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch (94%) rename patches/{server-remapped => server}/Fix-SpongeAbsortEvent-handling.patch (53%) rename patches/{server-remapped => server}/Handle-Large-Packets-disconnecting-client.patch (76%) rename patches/{server-remapped => server}/Improve-Server-Thread-Pool-and-Thread-Priorities.patch (64%) rename patches/{server-remapped => server}/Limit-Client-Sign-length-more.patch (60%) rename patches/{server-remapped => server}/Make-the-default-permission-message-configurable.patch (100%) rename patches/{server-remapped => server}/Optimize-World-Time-Updates.patch (100%) rename patches/{server-remapped => server}/Prevent-Enderman-from-loading-chunks.patch (86%) rename patches/{server-remapped => server}/Prevent-rayTrace-from-loading-chunks.patch (95%) rename patches/{server-remapped => server}/Reset-players-airTicks-on-respawn.patch (91%) rename patches/{server-remapped => server}/Restore-custom-InventoryHolder-support.patch (89%) rename patches/{server-remapped => server}/Use-Vanilla-Minecart-Speeds.patch (100%) rename patches/{server-remapped => server}/Workaround-for-vehicle-tracking-issue-on-disconnect.patch (92%) rename patches/{server-remapped => server}/force-entity-dismount-during-teleportation.patch (94%) diff --git a/patches/api-unmapped/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch b/patches/api/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch similarity index 100% rename from patches/api-unmapped/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch rename to patches/api/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch diff --git a/patches/api-unmapped/Add-ItemStack-Recipe-API-helper-methods.patch b/patches/api/Add-ItemStack-Recipe-API-helper-methods.patch similarity index 100% rename from patches/api-unmapped/Add-ItemStack-Recipe-API-helper-methods.patch rename to patches/api/Add-ItemStack-Recipe-API-helper-methods.patch diff --git a/patches/api-unmapped/Add-PlayerConnectionCloseEvent.patch b/patches/api/Add-PlayerConnectionCloseEvent.patch similarity index 100% rename from patches/api-unmapped/Add-PlayerConnectionCloseEvent.patch rename to patches/api/Add-PlayerConnectionCloseEvent.patch diff --git a/patches/api-unmapped/Add-WhitelistToggleEvent.patch b/patches/api/Add-WhitelistToggleEvent.patch similarity index 100% rename from patches/api-unmapped/Add-WhitelistToggleEvent.patch rename to patches/api/Add-WhitelistToggleEvent.patch diff --git a/patches/api-unmapped/Add-more-Zombie-API.patch b/patches/api/Add-more-Zombie-API.patch similarity index 100% rename from patches/api-unmapped/Add-more-Zombie-API.patch rename to patches/api/Add-more-Zombie-API.patch diff --git a/patches/api-unmapped/BlockDestroyEvent.patch b/patches/api/BlockDestroyEvent.patch similarity index 100% rename from patches/api-unmapped/BlockDestroyEvent.patch rename to patches/api/BlockDestroyEvent.patch diff --git a/patches/api-unmapped/Change-the-reserved-channel-check-to-be-sensible.patch b/patches/api/Change-the-reserved-channel-check-to-be-sensible.patch similarity index 100% rename from patches/api-unmapped/Change-the-reserved-channel-check-to-be-sensible.patch rename to patches/api/Change-the-reserved-channel-check-to-be-sensible.patch diff --git a/patches/api-unmapped/Make-the-default-permission-message-configurable.patch b/patches/api/Make-the-default-permission-message-configurable.patch similarity index 100% rename from patches/api-unmapped/Make-the-default-permission-message-configurable.patch rename to patches/api/Make-the-default-permission-message-configurable.patch diff --git a/patches/api-unmapped/Support-cancellation-supression-of-EntityDismount-Ve.patch b/patches/api/Support-cancellation-supression-of-EntityDismount-Ve.patch similarity index 100% rename from patches/api-unmapped/Support-cancellation-supression-of-EntityDismount-Ve.patch rename to patches/api/Support-cancellation-supression-of-EntityDismount-Ve.patch diff --git a/patches/server-remapped/Fix-sign-edit-memory-leak.patch b/patches/server-remapped/Fix-sign-edit-memory-leak.patch deleted file mode 100644 index f74b1bf127..0000000000 --- a/patches/server-remapped/Fix-sign-edit-memory-leak.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 28 Feb 2019 00:15:28 -0500 -Subject: [PATCH] Fix sign edit memory leak - -when a player edits a sign, a reference to their Entity is never cleand up. - -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { - - SignBlockEntity tileentitysign = (SignBlockEntity) tileentity; - -- if (!tileentitysign.isEditable() || tileentitysign.getPlayerWhoMayEdit() != this.player) { -+ if (!tileentitysign.isEditable() || tileentitysign.signEditor == null || !tileentitysign.signEditor.equals(this.player.getUUID())) { - ServerGamePacketListenerImpl.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString()); - this.send(tileentity.getUpdatePacket()); // CraftBukkit - return; -diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -@@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C - private Player playerWhoMayEdit; - private final FormattedCharSequence[] renderMessages; - private DyeColor color; -+ public java.util.UUID signEditor; // Paper - - public SignBlockEntity() { - super(BlockEntityType.SIGN); -@@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C - } - - public void setAllowedPlayerEditor(Player player) { -- this.playerWhoMayEdit = player; -+ // Paper start -+ //this.c = entityhuman; -+ signEditor = player != null ? player.getUUID() : null; -+ // Paper end - } - - public Player getPlayerWhoMayEdit() { diff --git a/patches/server-remapped/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch b/patches/server/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch similarity index 96% rename from patches/server-remapped/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch rename to patches/server/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch index beedbbe8f0..39463b1b23 100644 --- a/patches/server-remapped/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch +++ b/patches/server/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch @@ -19,7 +19,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener { +@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { public int latency; public boolean wonGame; private int containerUpdateDelay; // Paper @@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java @@ -0,0 +0,0 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa - return getData() != null; + return this.getData() != null; } + // Paper start @@ -104,7 +104,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override public Location getBedSpawnLocation() { - CompoundTag data = getData(); + CompoundTag data = this.getData(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -134,7 +134,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end + public void readExtraData(CompoundTag nbttagcompound) { - hasPlayedBefore = true; + this.hasPlayedBefore = true; if (nbttagcompound.contains("bukkit")) { @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } @@ -146,7 +146,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 nbttagcompound.put("bukkit", new CompoundTag()); } @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - data.putLong("firstPlayed", getFirstPlayed()); + data.putLong("firstPlayed", this.getFirstPlayed()); data.putLong("lastPlayed", System.currentTimeMillis()); data.putString("lastKnownName", handle.getScoreboardName()); + diff --git a/patches/server-remapped/Add-PlayerConnectionCloseEvent.patch b/patches/server/Add-PlayerConnectionCloseEvent.patch similarity index 84% rename from patches/server-remapped/Add-PlayerConnectionCloseEvent.patch rename to patches/server/Add-PlayerConnectionCloseEvent.patch index 79c7d5d6ff..45d0c6d036 100644 --- a/patches/server-remapped/Add-PlayerConnectionCloseEvent.patch +++ b/patches/server/Add-PlayerConnectionCloseEvent.patch @@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler> { - this.getPacketListener().a(new TranslatableComponent("multiplayer.disconnect.generic")); + this.getPacketListener().onDisconnect(new TranslatableComponent("multiplayer.disconnect.generic")); } this.queue.clear(); // Free up packet queue. + // Paper start - Add PlayerConnectionCloseEvent @@ -70,13 +70,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener private final byte[] nonce = new byte[4]; - private final MinecraftServer server; + final MinecraftServer server; public final Connection connection; -- private ServerLoginPacketListenerImpl.State state; -+ private ServerLoginPacketListenerImpl.State state; public final ServerLoginPacketListenerImpl.State getLoginState() { return this.state; }; // Paper - OBFHELPER +- ServerLoginPacketListenerImpl.State state; ++ ServerLoginPacketListenerImpl.State state; public final ServerLoginPacketListenerImpl.State getLoginState() { return this.state; }; // Paper - OBFHELPER private int tick; -- private GameProfile gameProfile; private void setGameProfile(final GameProfile profile) { this.gameProfile = profile; } private GameProfile getGameProfile() { return this.gameProfile; } // Paper - OBFHELPER -+ private GameProfile gameProfile; private void setGameProfile(final GameProfile profile) { this.gameProfile = profile; } public GameProfile getGameProfile() { return this.gameProfile; } // Paper - OBFHELPER + @Nullable +- GameProfile gameProfile; ++ GameProfile gameProfile; private void setGameProfile(final GameProfile profile) { this.gameProfile = profile; } public GameProfile getGameProfile() { return this.gameProfile; } // Paper - OBFHELPER private final String serverId; - private SecretKey secretKey; + @Nullable private ServerPlayer delayedAcceptPlayer; diff --git a/patches/server-remapped/Add-more-Zombie-API.patch b/patches/server/Add-more-Zombie-API.patch similarity index 82% rename from patches/server-remapped/Add-more-Zombie-API.patch rename to patches/server/Add-more-Zombie-API.patch index 5bff5c4c28..fb685775bf 100644 --- a/patches/server-remapped/Add-more-Zombie-API.patch +++ b/patches/server/Add-more-Zombie-API.patch @@ -33,41 +33,41 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } -+ public boolean shouldBurnInDay() { return isSunSensitive(); } // Paper - OBFHELPER ++ public boolean isSunSensitivePublic() { return this.isSunSensitive(); } // Paper - public getter protected boolean isSunSensitive() { - return true; + return this.shouldBurnInDay; // Paper - use api value instead -+ } -+ + } + + // Paper start + public void setShouldBurnInDay(boolean shouldBurnInDay) { + this.shouldBurnInDay = shouldBurnInDay; - } ++ } + // Paper end - ++ @Override public boolean hurt(DamageSource source, float amount) { + if (!super.hurt(source, amount)) { @@ -0,0 +0,0 @@ public class Zombie extends Monster { - tag.putBoolean("CanBreakDoors", this.canBreakDoors()); - tag.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1); - tag.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1); -+ tag.putBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Paper + nbt.putBoolean("CanBreakDoors", this.canBreakDoors()); + nbt.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1); + nbt.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1); ++ nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper } @Override @@ -0,0 +0,0 @@ public class Zombie extends Monster { - if (tag.contains("DrownedConversionTime", 99) && tag.getInt("DrownedConversionTime") > -1) { - this.startUnderWaterConversion(tag.getInt("DrownedConversionTime")); + if (nbt.contains("DrownedConversionTime", 99) && nbt.getInt("DrownedConversionTime") > -1) { + this.startUnderWaterConversion(nbt.getInt("DrownedConversionTime")); } -- + // Paper start -+ if (tag.contains("Paper.ShouldBurnInDay")) { -+ shouldBurnInDay = tag.getBoolean("Paper.ShouldBurnInDay"); ++ if (nbt.contains("Paper.ShouldBurnInDay")) { ++ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay"); + } + // Paper end + } - @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java @@ -94,7 +94,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + public boolean shouldBurnInDay() { -+ return getHandle().shouldBurnInDay(); ++ return getHandle().isSunSensitivePublic(); + } + + @Override diff --git a/patches/server-remapped/Block-Entity-remove-from-being-called-on-Players.patch b/patches/server/Block-Entity-remove-from-being-called-on-Players.patch similarity index 100% rename from patches/server-remapped/Block-Entity-remove-from-being-called-on-Players.patch rename to patches/server/Block-Entity-remove-from-being-called-on-Players.patch diff --git a/patches/server-remapped/BlockDestroyEvent.patch b/patches/server/BlockDestroyEvent.patch similarity index 94% rename from patches/server-remapped/BlockDestroyEvent.patch rename to patches/server/BlockDestroyEvent.patch index 1e0d1ad18d..8fd9320d2d 100644 --- a/patches/server-remapped/BlockDestroyEvent.patch +++ b/patches/server/BlockDestroyEvent.patch @@ -14,8 +14,8 @@ diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.Packet; - import net.minecraft.network.protocol.game.ClientboundSetBorderPacket; +@@ -0,0 +0,0 @@ import net.minecraft.nbt.CompoundTag; + import net.minecraft.network.protocol.Packet; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MCUtil; diff --git a/patches/server-remapped/Book-Size-Limits.patch b/patches/server/Book-Size-Limits.patch similarity index 93% rename from patches/server-remapped/Book-Size-Limits.patch rename to patches/server/Book-Size-Limits.patch index bbe9a6fe54..b0fc41a32f 100644 --- a/patches/server-remapped/Book-Size-Limits.patch +++ b/patches/server/Book-Size-Limits.patch @@ -10,28 +10,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ public class PaperConfig { - velocitySecretKey = secret.getBytes(StandardCharsets.UTF_8); } } -+ + + public static int maxBookPageSize = 2560; + public static double maxBookTotalSizeMultiplier = 0.98D; + private static void maxBookSize() { + maxBookPageSize = getInt("settings.book-size.page-max", maxBookPageSize); + maxBookTotalSizeMultiplier = getDouble("settings.book-size.total-multiplier", maxBookTotalSizeMultiplier); + } - } ++ + public static boolean asyncChunks = false; + private static void asyncChunks() { + ConfigurationSection section; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void handleEditBook(ServerboundEditBookPacket packet) { + // Paper start + ItemStack testStack = packet.getBook(); -+ if (!craftServer.isPrimaryThread() && !testStack.isEmpty() && testStack.getTag() != null) { ++ if (!this.cserver.isPrimaryThread() && !testStack.isEmpty() && testStack.getTag() != null) { + ListTag pageList = testStack.getTag().getList("pages", 8); + if (pageList.size() > 100) { + ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with too many pages"); diff --git a/patches/server-remapped/Don-t-allow-digging-into-unloaded-chunks.patch b/patches/server/Don-t-allow-digging-into-unloaded-chunks.patch similarity index 95% rename from patches/server-remapped/Don-t-allow-digging-into-unloaded-chunks.patch rename to patches/server/Don-t-allow-digging-into-unloaded-chunks.patch index 2c14b89e26..49c3037f92 100644 --- a/patches/server-remapped/Don-t-allow-digging-into-unloaded-chunks.patch +++ b/patches/server/Don-t-allow-digging-into-unloaded-chunks.patch @@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.isDestroyingBlock = false; - if (!Objects.equals(this.destroyPos, pos)) { + if (!Objects.equals(this.destroyPos, pos) && !BlockPos.ZERO.equals(this.destroyPos)) { - ServerPlayerGameMode.LOGGER.debug("Mismatch in destroy block pos: " + this.destroyPos + " " + pos); // CraftBukkit - SPIGOT-5457 sent by client when interact event cancelled + ServerPlayerGameMode.LOGGER.debug("Mismatch in destroy block pos: {} {}", this.destroyPos, pos); // CraftBukkit - SPIGOT-5457 sent by client when interact event cancelled - this.level.destroyBlockProgress(this.player.getId(), this.destroyPos, -1); - this.player.connection.send(new ClientboundBlockBreakAckPacket(this.destroyPos, this.level.getBlockState(this.destroyPos), action, true, "aborted mismatched destroying")); + BlockState type = this.level.getTypeIfLoaded(this.destroyPos); // Paper - don't load unloaded chunks for stale records here @@ -54,7 +54,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser case START_DESTROY_BLOCK: case ABORT_DESTROY_BLOCK: case STOP_DESTROY_BLOCK: @@ -63,6 +63,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return; + } + // Paper end - Don't allow digging in unloaded chunks - this.player.gameMode.handleBlockBreakAction(blockposition, packetplayinblockdig_enumplayerdigtype, packet.getDirection(), this.server.getMaxBuildHeight()); + this.player.gameMode.handleBlockBreakAction(blockposition, packetplayinblockdig_enumplayerdigtype, packet.getDirection(), this.player.level.getMaxBuildHeight()); return; default: diff --git a/patches/server-remapped/Don-t-sleep-after-profile-lookups-if-not-needed.patch b/patches/server/Don-t-sleep-after-profile-lookups-if-not-needed.patch similarity index 100% rename from patches/server-remapped/Don-t-sleep-after-profile-lookups-if-not-needed.patch rename to patches/server/Don-t-sleep-after-profile-lookups-if-not-needed.patch diff --git a/patches/server-remapped/Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch b/patches/server/Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch similarity index 100% rename from patches/server-remapped/Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch rename to patches/server/Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch diff --git a/patches/server-remapped/Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch b/patches/server/Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch similarity index 94% rename from patches/server-remapped/Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch rename to patches/server/Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch index 97c50e06c0..65b71c50a6 100644 --- a/patches/server-remapped/Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch +++ b/patches/server/Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch @@ -22,8 +22,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + co.aikar.util.Counter matchedProvided = new co.aikar.util.Counter<>(); + co.aikar.util.Counter matchedIngredients = new co.aikar.util.Counter<>(); + // Paper end - for (int j = 0; j < inv.getContainerSize(); ++j) { - ItemStack itemstack = inv.getItem(j); + for (int j = 0; j < inventory.getContainerSize(); ++j) { + ItemStack itemstack = inventory.getItem(j); if (!itemstack.isEmpty()) { - ++i; @@ -65,4 +65,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end } - public ItemStack assemble(CraftingContainer inv) { + public ItemStack assemble(CraftingContainer inventory) { diff --git a/patches/server-remapped/Fix-SpongeAbsortEvent-handling.patch b/patches/server/Fix-SpongeAbsortEvent-handling.patch similarity index 53% rename from patches/server-remapped/Fix-SpongeAbsortEvent-handling.patch rename to patches/server/Fix-SpongeAbsortEvent-handling.patch index 2c125a3bf7..75ca22f6a8 100644 --- a/patches/server-remapped/Fix-SpongeAbsortEvent-handling.patch +++ b/patches/server/Fix-SpongeAbsortEvent-handling.patch @@ -5,18 +5,6 @@ Subject: [PATCH] Fix SpongeAbsortEvent handling Only process drops when the block is actually going to be removed -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/Block.java -+++ b/src/main/java/net/minecraft/world/level/block/Block.java -@@ -0,0 +0,0 @@ public class Block extends BlockBehaviour implements ItemLike { - - } - -+ public static void dropNaturally(BlockState iblockdata, LevelAccessor generatoraccess, BlockPos blockposition, @Nullable BlockEntity tileentity) { dropResources(iblockdata, generatoraccess, blockposition, tileentity); } - public static void dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity) { - if (world instanceof ServerLevel) { - getDrops(state, (ServerLevel) world, pos, blockEntity).forEach((itemstack) -> { diff --git a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java @@ -24,12 +12,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class SpongeBlock extends Block { // NOP } else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) { - BlockEntity tileentity = iblockdata.getBlock().isEntityBlock() ? world.getBlockEntity(blockposition2) : null; + BlockEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition2) : null; - - dropResources(iblockdata, world, blockposition2, tileentity); + // Paper start + if (block.getHandle().getMaterial() == Material.AIR) { -+ dropNaturally(iblockdata, world, blockposition2, tileentity); ++ dropResources(iblockdata, world, blockposition2, tileentity); + } + // Paper end } diff --git a/patches/server-remapped/Handle-Large-Packets-disconnecting-client.patch b/patches/server/Handle-Large-Packets-disconnecting-client.patch similarity index 76% rename from patches/server-remapped/Handle-Large-Packets-disconnecting-client.patch rename to patches/server/Handle-Large-Packets-disconnecting-client.patch index db1c835c1b..6924db6030 100644 --- a/patches/server-remapped/Handle-Large-Packets-disconnecting-client.patch +++ b/patches/server/Handle-Large-Packets-disconnecting-client.patch @@ -10,20 +10,12 @@ diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -0,0 +0,0 @@ import io.netty.channel.epoll.EpollEventLoopGroup; - import io.netty.channel.local.LocalChannel; - import io.netty.channel.local.LocalServerChannel; - import io.netty.channel.nio.NioEventLoopGroup; -+import io.netty.handler.codec.EncoderException; // Paper - import io.netty.handler.timeout.TimeoutException; - import io.netty.util.AttributeKey; - import io.netty.util.concurrent.Future; @@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler> { } public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) { + // Paper start -+ if (throwable instanceof EncoderException && throwable.getCause() instanceof PacketEncoder.PacketTooLargeException) { ++ if (throwable instanceof io.netty.handler.codec.EncoderException && throwable.getCause() instanceof PacketEncoder.PacketTooLargeException) { + if (((PacketEncoder.PacketTooLargeException) throwable.getCause()).getPacket().packetTooLarge(this)) { + return; + } else { @@ -39,12 +31,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java @@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder> { - throw throwable; + throw var9; } } + + // Paper start -+ int packetLength = bytebuf.readableBytes(); ++ int packetLength = friendlyByteBuf.readableBytes(); + if (packetLength > MAX_PACKET_SIZE) { + throw new PacketTooLargeException(packet, packetLength); + } @@ -79,7 +71,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 void handle(T listener); + // Paper start -+ default boolean packetTooLarge(NetworkManager manager) { ++ default boolean packetTooLarge(net.minecraft.network.Connection manager) { + return false; + } + // Paper end @@ -91,40 +83,33 @@ diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundContai index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java -@@ -0,0 +0,0 @@ import java.io.IOException; - import java.util.Iterator; - import java.util.List; - import net.minecraft.core.NonNullList; -+import net.minecraft.network.Connection; - import net.minecraft.network.FriendlyByteBuf; - import net.minecraft.network.protocol.Packet; - import net.minecraft.world.item.ItemStack; @@ -0,0 +0,0 @@ public class ClientboundContainerSetContentPacket implements Packet items; + private final int containerId; + private final List items; + //Paper start + @Override -+ public boolean packetTooLarge(Connection manager) { ++ public boolean packetTooLarge(net.minecraft.network.Connection manager) { + for (int i = 0 ; i < this.items.size() ; i++) { + manager.send(new ClientboundContainerSetSlotPacket(this.containerId, i, this.items.get(i))); + } + return true; + } + // Paper end - public ClientboundContainerSetContentPacket() {} - ++ public ClientboundContainerSetContentPacket(int syncId, NonNullList contents) { + this.containerId = syncId; + this.items = NonNullList.withSize(contents.size(), ItemStack.EMPTY); diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java @@ -0,0 +0,0 @@ public class ClientboundLevelChunkPacket implements Packet 2097152) { -+ if (i > 2097152) { // Paper - if this changes, update PacketEncoder - throw new RuntimeException("Chunk Packet trying to allocate too much memory on read."); } else { - this.buffer = new byte[i]; + this.biomes = buf.readVarIntArray(ChunkBiomeContainer.MAX_SIZE); + int i = buf.readVarInt(); +- if (i > 2097152) { ++ if (i > 2097152) { // Paper - diff on change - if this changes, update PacketEncoder + throw new RuntimeException("Chunk Packet trying to allocate too much memory on read."); + } else { + this.buffer = new byte[i]; diff --git a/patches/server-remapped/Improve-Server-Thread-Pool-and-Thread-Priorities.patch b/patches/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch similarity index 64% rename from patches/server-remapped/Improve-Server-Thread-Pool-and-Thread-Priorities.patch rename to patches/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch index 8bded12c1b..e50181f9a7 100644 --- a/patches/server-remapped/Improve-Server-Thread-Pool-and-Thread-Priorities.patch +++ b/patches/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch @@ -23,70 +23,58 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.minecraft.server.ServerWorkerThread; import net.minecraft.util.datafix.DataFixers; import net.minecraft.world.level.block.state.properties.Property; - import org.apache.logging.log4j.LogManager; + import org.apache.commons.io.IOUtils; @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - public class Util { + public class Util { private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1); - private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap"); - private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main"); -+ private static final ExecutorService BOOTSTRAP_EXECUTOR = a("Bootstrap", -2); // Paper - add -2 priority -+ private static final ExecutorService BACKGROUND_EXECUTOR = a("Main", -1); // Paper - add -1 priority ++ private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap", -2); // Paper - add -2 priority ++ private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - add -1 priority private static final ExecutorService IO_POOL = makeIoExecutor(); public static LongSupplier timeSource = System::nanoTime; - public static final UUID NIL_UUID = new UUID(0L, 0L); public static final UUID getNullUUID() {return NIL_UUID;} // Paper OBFHELPER + public static final UUID NIL_UUID = new UUID(0L, 0L); @@ -0,0 +0,0 @@ public class Util { return Instant.now().toEpochMilli(); } - private static ExecutorService makeExecutor(String name) { - int i = Mth.clamp(Runtime.getRuntime().availableProcessors() - 1, 1, 7); -- Object object; -+ private static ExecutorService a(String s, int priorityModifier) { // Paper - add priority ++ private static ExecutorService makeExecutor(String s, int priorityModifier) { // Paper - add priority + // Paper start - use simpler thread pool that allows 1 thread + int i = Math.min(8, Math.max(Runtime.getRuntime().availableProcessors() - 2, 1)); + i = Integer.getInteger("Paper.WorkerThreadCount", i); -+ ExecutorService object; - + ExecutorService executorService; ++ if (i <= 0) { - object = MoreExecutors.newDirectExecutorService(); + executorService = MoreExecutors.newDirectExecutorService(); } else { -- object = new ForkJoinPool(i, (forkjoinpool) -> { -- ForkJoinWorkerThread forkjoinworkerthread = new ForkJoinWorkerThread(forkjoinpool) { -+ object = new java.util.concurrent.ThreadPoolExecutor(i, i,0L, TimeUnit.MILLISECONDS, new java.util.concurrent.LinkedBlockingQueue(), target -> new ServerWorkerThread(target, s, priorityModifier)); +- executorService = new ForkJoinPool(i, (forkJoinPool) -> { +- ForkJoinWorkerThread forkJoinWorkerThread = new ForkJoinWorkerThread(forkJoinPool) { ++ executorService = new java.util.concurrent.ThreadPoolExecutor(i, i,0L, TimeUnit.MILLISECONDS, new java.util.concurrent.LinkedBlockingQueue(), target -> new ServerWorkerThread(target, s, priorityModifier)); + } + /* + @Override protected void onTermination(Throwable throwable) { if (throwable != null) { -- Util.LOGGER.warn("{} died", this.getName(), throwable); -+ SystemUtils.LOGGER.warn("{} died", this.getName(), throwable); - } else { -- Util.LOGGER.debug("{} shutdown", this.getName()); -+ SystemUtils.LOGGER.debug("{} shutdown", this.getName()); - } - - super.onTermination(throwable); - } - }; - -- forkjoinworkerthread.setName("Worker-" + name + "-" + Util.WORKER_COUNT.getAndIncrement()); -+ forkjoinworkerthread.setName("Worker-" + s + "-" + SystemUtils.c.getAndIncrement()); - return forkjoinworkerthread; -- }, Util::onThreadException, true); -+ }, SystemUtils::a, true); +@@ -0,0 +0,0 @@ public class Util { + return forkJoinWorkerThread; + }, Util::onThreadException, true); } + }*/ // Paper end - return (ExecutorService) object; + return executorService; } @@ -0,0 +0,0 @@ public class Util { - }); + throw t instanceof RuntimeException ? (RuntimeException)t : new RuntimeException(t); } -+ public static void onThreadError(Thread thread, Throwable throwable) { onThreadException(thread, throwable); } // Paper - OBFHELPER - private static void onThreadException(Thread thread, Throwable throwable) { - pauseInIde(throwable); - if (throwable instanceof CompletionException) { +- private static void onThreadException(Thread thread, Throwable t) { ++ public static void onThreadException(Thread thread, Throwable t) { // Paper - make public + pauseInIde(t); + if (t instanceof CompletionException) { + t = t.getCause(); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -116,6 +104,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + super(target, "Worker-" + poolName + "-" + threadId.getAndIncrement()); + setPriority(Thread.NORM_PRIORITY+prioritityModifier); // Deprioritize over main + this.setDaemon(true); -+ this.setUncaughtExceptionHandler(Util::onThreadError); ++ this.setUncaughtExceptionHandler(Util::onThreadException); + } +} diff --git a/patches/server-remapped/Limit-Client-Sign-length-more.patch b/patches/server/Limit-Client-Sign-length-more.patch similarity index 60% rename from patches/server-remapped/Limit-Client-Sign-length-more.patch rename to patches/server/Limit-Client-Sign-length-more.patch index 22a658ee94..b5b9082341 100644 --- a/patches/server-remapped/Limit-Client-Sign-length-more.patch +++ b/patches/server/Limit-Client-Sign-length-more.patch @@ -25,7 +25,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser private int aboveGroundVehicleTickCount; private int receivedMovePacketCount; private int knownMovePacketCount; @@ -33,22 +33,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser List lines = new java.util.ArrayList<>(); for (int i = 0; i < list.size(); ++i) { -- lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterAllowedChatCharacters(list.get(i)))); // Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created. + // Paper start - cap line length - modified clients can send longer data than normal -+ String currentLine = list.get(i); -+ if (MAX_SIGN_LINE_LENGTH > 0 && currentLine.length() > MAX_SIGN_LINE_LENGTH) { ++ net.minecraft.server.network.TextFilter.FilteredText currentLine = list.get(i); ++ if (MAX_SIGN_LINE_LENGTH > 0 && currentLine.getRaw().length() > MAX_SIGN_LINE_LENGTH) { + // This handles multibyte characters as 1 -+ int offset = currentLine.codePoints().limit(MAX_SIGN_LINE_LENGTH).map(Character::charCount).sum(); -+ if (offset < currentLine.length()) { -+ list.set(i, currentLine = currentLine.substring(0, offset)); ++ int offset = currentLine.getRaw().codePoints().limit(MAX_SIGN_LINE_LENGTH).map(Character::charCount).sum(); ++ if (offset < currentLine.getRaw().length()) { ++ list.set(i, currentLine = net.minecraft.server.network.TextFilter.FilteredText.passThrough(currentLine.getRaw().substring(0, offset))); // this will break any filtering, but filtering is NYI as of 1.17 + } + } + // Paper end -+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterAllowedChatCharacters(currentLine))); // Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created. + if (this.player.isTextFilteringEnabled()) { +- lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(list.get(i).getFiltered()))); ++ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(currentLine.getFiltered()))); + } else { +- lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(list.get(i).getRaw()))); ++ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(currentLine.getRaw()))); + } } - SignChangeEvent event = new SignChangeEvent(org.bukkit.craftbukkit.block.CraftBlock.at(worldserver, blockposition), this.getPlayer(), lines); - this.craftServer.getPluginManager().callEvent(event); + SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.cserver.getPlayer(this.player), lines); diff --git a/patches/server-remapped/Make-the-default-permission-message-configurable.patch b/patches/server/Make-the-default-permission-message-configurable.patch similarity index 100% rename from patches/server-remapped/Make-the-default-permission-message-configurable.patch rename to patches/server/Make-the-default-permission-message-configurable.patch diff --git a/patches/server-remapped/Optimize-World-Time-Updates.patch b/patches/server/Optimize-World-Time-Updates.patch similarity index 100% rename from patches/server-remapped/Optimize-World-Time-Updates.patch rename to patches/server/Optimize-World-Time-Updates.patch diff --git a/patches/server-remapped/Prevent-Enderman-from-loading-chunks.patch b/patches/server/Prevent-Enderman-from-loading-chunks.patch similarity index 86% rename from patches/server-remapped/Prevent-Enderman-from-loading-chunks.patch rename to patches/server/Prevent-Enderman-from-loading-chunks.patch index abf21f92fe..244c267f68 100644 --- a/patches/server-remapped/Prevent-Enderman-from-loading-chunks.patch +++ b/patches/server/Prevent-Enderman-from-loading-chunks.patch @@ -8,16 +8,6 @@ diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/sr index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java -@@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob { - int j = Mth.floor(this.enderman.getY() + random.nextDouble() * 3.0D); - int k = Mth.floor(this.enderman.getZ() - 2.0D + random.nextDouble() * 4.0D); - BlockPos blockposition = new BlockPos(i, j, k); -- BlockState iblockdata = world.getBlockState(blockposition); -+ BlockState iblockdata = world.getTypeIfLoaded(blockposition); // Paper -+ if (iblockdata == null) return; // Paper - Block block = iblockdata.getBlock(); - Vec3 vec3d = new Vec3((double) Mth.floor(this.enderman.getX()) + 0.5D, (double) j + 0.5D, (double) Mth.floor(this.enderman.getZ()) + 0.5D); - Vec3 vec3d1 = new Vec3((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D); @@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob { int j = Mth.floor(this.enderman.getY() + random.nextDouble() * 2.0D); int k = Mth.floor(this.enderman.getZ() - 1.0D + random.nextDouble() * 2.0D); @@ -28,3 +18,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BlockPos blockposition1 = blockposition.below(); BlockState iblockdata1 = world.getBlockState(blockposition1); BlockState iblockdata2 = this.enderman.getCarriedBlock(); +@@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob { + int j = Mth.floor(this.enderman.getY() + random.nextDouble() * 3.0D); + int k = Mth.floor(this.enderman.getZ() - 2.0D + random.nextDouble() * 4.0D); + BlockPos blockposition = new BlockPos(i, j, k); +- BlockState iblockdata = world.getBlockState(blockposition); ++ BlockState iblockdata = world.getTypeIfLoaded(blockposition); // Paper ++ if (iblockdata == null) return; // Paper + Vec3 vec3d = new Vec3((double) this.enderman.getBlockX() + 0.5D, (double) j + 0.5D, (double) this.enderman.getBlockZ() + 0.5D); + Vec3 vec3d1 = new Vec3((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D); + BlockHitResult movingobjectpositionblock = world.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.enderman)); diff --git a/patches/server-remapped/Prevent-rayTrace-from-loading-chunks.patch b/patches/server/Prevent-rayTrace-from-loading-chunks.patch similarity index 95% rename from patches/server-remapped/Prevent-rayTrace-from-loading-chunks.patch rename to patches/server/Prevent-rayTrace-from-loading-chunks.patch index 7dba071051..a7c058ce14 100644 --- a/patches/server-remapped/Prevent-rayTrace-from-loading-chunks.patch +++ b/patches/server/Prevent-rayTrace-from-loading-chunks.patch @@ -10,7 +10,7 @@ diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/BlockGetter.java +++ b/src/main/java/net/minecraft/world/level/BlockGetter.java -@@ -0,0 +0,0 @@ public interface BlockGetter { +@@ -0,0 +0,0 @@ public interface BlockGetter extends LevelHeightAccessor { // CraftBukkit start - moved block handling into separate method for use by Block#rayTrace default BlockHitResult rayTraceBlock(ClipContext raytrace1, BlockPos blockposition) { diff --git a/patches/server-remapped/Reset-players-airTicks-on-respawn.patch b/patches/server/Reset-players-airTicks-on-respawn.patch similarity index 91% rename from patches/server-remapped/Reset-players-airTicks-on-respawn.patch rename to patches/server/Reset-players-airTicks-on-respawn.patch index 30b050b749..b3638dc4af 100644 --- a/patches/server-remapped/Reset-players-airTicks-on-respawn.patch +++ b/patches/server/Reset-players-airTicks-on-respawn.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener { +@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { } this.setHealth(this.getMaxHealth()); @@ -20,7 +20,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } diff --git a/patches/server-remapped/Restore-custom-InventoryHolder-support.patch b/patches/server/Restore-custom-InventoryHolder-support.patch similarity index 89% rename from patches/server-remapped/Restore-custom-InventoryHolder-support.patch rename to patches/server/Restore-custom-InventoryHolder-support.patch index d5c9bd78b9..abeb3eb978 100644 --- a/patches/server-remapped/Restore-custom-InventoryHolder-support.patch +++ b/patches/server/Restore-custom-InventoryHolder-support.patch @@ -26,10 +26,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public Inventory createInventory(InventoryHolder holder, InventoryType type) { + // Paper start + if (holder != null) { -+ return DEFAULT_CONVERTER.createInventory(holder, type); ++ return this.DEFAULT_CONVERTER.createInventory(holder, type); + } + //noinspection ConstantConditions // Paper end - return converterMap.get(type).createInventory(holder, type); + return this.converterMap.get(type).createInventory(holder, type); } @@ -0,0 +0,0 @@ public final class CraftInventoryCreator { @@ -41,6 +41,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return DEFAULT_CONVERTER.createInventory(holder, type, title); + } + //noinspection ConstantConditions // Paper end - return converterMap.get(type).createInventory(holder, type, title); + return this.converterMap.get(type).createInventory(holder, type, title); } diff --git a/patches/server-remapped/Use-Vanilla-Minecart-Speeds.patch b/patches/server/Use-Vanilla-Minecart-Speeds.patch similarity index 100% rename from patches/server-remapped/Use-Vanilla-Minecart-Speeds.patch rename to patches/server/Use-Vanilla-Minecart-Speeds.patch diff --git a/patches/server-remapped/Workaround-for-vehicle-tracking-issue-on-disconnect.patch b/patches/server/Workaround-for-vehicle-tracking-issue-on-disconnect.patch similarity index 92% rename from patches/server-remapped/Workaround-for-vehicle-tracking-issue-on-disconnect.patch rename to patches/server/Workaround-for-vehicle-tracking-issue-on-disconnect.patch index 6bd7cb92df..fac4882100 100644 --- a/patches/server-remapped/Workaround-for-vehicle-tracking-issue-on-disconnect.patch +++ b/patches/server/Workaround-for-vehicle-tracking-issue-on-disconnect.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener { +@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { public void disconnect() { this.disconnected = true; this.ejectPassengers(); diff --git a/patches/server-remapped/force-entity-dismount-during-teleportation.patch b/patches/server/force-entity-dismount-during-teleportation.patch similarity index 94% rename from patches/server-remapped/force-entity-dismount-during-teleportation.patch rename to patches/server/force-entity-dismount-during-teleportation.patch index 423e9c9c17..2224f223c2 100644 --- a/patches/server-remapped/force-entity-dismount-during-teleportation.patch +++ b/patches/server/force-entity-dismount-during-teleportation.patch @@ -23,7 +23,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener { +@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { } } @@ -44,7 +44,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } @@ -62,7 +62,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n return true; // CraftBukkit } @@ -74,16 +74,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (entity.getVehicle() == this) { throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); } else { -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { +@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n + if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { VehicleExitEvent event = new VehicleExitEvent( - (Vehicle) getBukkitEntity(), + (Vehicle) this.getBukkitEntity(), - (LivingEntity) entity.getBukkitEntity() + (LivingEntity) entity.getBukkitEntity(), !suppressCancellation // Paper ); // Suppress during worldgen if (this.valid) { -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } // CraftBukkit end // Spigot start