and here's some more patches

This commit is contained in:
Jake 2021-11-23 17:53:24 -08:00 committed by MiniDigger | Martin
parent d9c1c30c58
commit 753267a57e
15 changed files with 83 additions and 69 deletions

View File

@ -10,7 +10,7 @@ This made the Bukkit RecipeChoice API not work for Shapeless.
This reimplements vanilla logic using the same test logic as Shaped This reimplements vanilla logic using the same test logic as Shaped
diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
index 4e1159b3188d39c998e6887c2846209c10b701f9..6b960f0a31175bcfd8d477ee5b3c4d783303cdd5 100644 index 56835129a63ed22677b7bbd9576c4bdcc8bf5ac7..ffe5476d8ed15ee4384b679c341688787205ce59 100644
--- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java --- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
@@ -76,16 +76,49 @@ public class ShapelessRecipe implements CraftingRecipe { @@ -76,16 +76,49 @@ public class ShapelessRecipe implements CraftingRecipe {

View File

@ -22,10 +22,10 @@ it only impacts data sent from the client.
Set -DPaper.maxSignLength=XX to change limit or -1 to disable Set -DPaper.maxSignLength=XX to change limit or -1 to disable
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2ea1e58cf721a8ae339cbfd6192f3312061249ba..b9f9314befff581e70ae7d8d4eab9040e4e4d26d 100644 index be5f7b5e8537aa3bf4088fa8c2e9d6cce17c64ac..5d0836c8bc38e3d29f47359b273c58330805b396 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -254,6 +254,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -253,6 +253,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
private int aboveGroundVehicleTickCount; private int aboveGroundVehicleTickCount;
private int receivedMovePacketCount; private int receivedMovePacketCount;
private int knownMovePacketCount; private int knownMovePacketCount;
@ -33,7 +33,7 @@ index 2ea1e58cf721a8ae339cbfd6192f3312061249ba..b9f9314befff581e70ae7d8d4eab9040
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit 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) { public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
@@ -2848,6 +2849,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -2861,6 +2862,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
for (int i = 0; i < signText.size(); ++i) { for (int i = 0; i < signText.size(); ++i) {
TextFilter.FilteredText currentLine = signText.get(i); TextFilter.FilteredText currentLine = signText.get(i);

View File

@ -7,10 +7,10 @@ property lookups arent super cheap. they synchronize, validate
and check security managers. and check security managers.
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 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 589fbdd5c86655244aa92a42e5f45747b5c5026e..9b5d11ece006d7aa893360a84ba652c666517ac1 100644 index 3a2e2adeefe73981b443216724270023408c1feb..615c4f9d9841f7ddc3e5c854e90f41c3905c2e8f 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -26,6 +26,7 @@ import net.minecraft.world.phys.Vec2; @@ -25,6 +25,7 @@ import net.minecraft.world.phys.Vec2;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
public class SignBlockEntity extends BlockEntity implements CommandSource { // CraftBukkit - implements public class SignBlockEntity extends BlockEntity implements CommandSource { // CraftBukkit - implements
@ -18,7 +18,7 @@ index 589fbdd5c86655244aa92a42e5f45747b5c5026e..9b5d11ece006d7aa893360a84ba652c6
public static final int LINES = 4; public static final int LINES = 4;
private static final String[] RAW_TEXT_FIELD_NAMES = new String[]{"Text1", "Text2", "Text3", "Text4"}; private static final String[] RAW_TEXT_FIELD_NAMES = new String[]{"Text1", "Text2", "Text3", "Text4"};
@@ -66,7 +67,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C @@ -65,7 +66,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
} }
// CraftBukkit start // CraftBukkit start

View File

@ -28,7 +28,7 @@ and then catch exceptions and close if they fire.
Part of this commit was authored by: Spottedleaf Part of this commit was authored by: Spottedleaf
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index b96ef2374b689ad715ce3b3a7c0b599a56b4c2d1..a3bfc12e34754dc5f8f53b968451a07f3a0ab496 100644 index 821f22b8fde2d76bfcb417138f9bd83af766dcd7..f13e24eede7f09ecc8f375df5e27e385f589005d 100644
--- a/src/main/java/net/minecraft/network/Connection.java --- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java
@@ -87,6 +87,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -87,6 +87,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -143,7 +143,7 @@ index b96ef2374b689ad715ce3b3a7c0b599a56b4c2d1..a3bfc12e34754dc5f8f53b968451a07f
private void sendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> callback) { private void sendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> callback) {
@@ -226,33 +299,79 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -226,33 +299,79 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
this.setProtocol(enumprotocol); this.setProtocol(packetState);
} }
+ // Paper start + // Paper start
@ -297,7 +297,7 @@ index 74bfe0d3942259c45702b099efdc4e101a4e3022..e8fcd56906d26f6dc87959e32c4c7c78
return false; return false;
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index abcd335f5577dae6d613e5e0dd2656e1ab3ee9f0..4e08fdf47fd201c26223fc8efb0ef4f6e884f8c7 100644 index 526e07d8ea21af42c271bee4da5bccd766227006..6bf39699700075e295a693b56d237391de4e4f58 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -63,10 +63,12 @@ public class ServerConnectionListener { @@ -63,10 +63,12 @@ public class ServerConnectionListener {

View File

@ -0,0 +1,64 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 6 May 2020 05:00:57 -0400
Subject: [PATCH] Handle Oversized Tile Entities in chunks
Splits out Extra Packets if too many TE's are encountered to prevent
creating too large of a packet to sed.
Co authored by Spottedleaf
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
index 4ed3b1291ac443502e9b99f83ecf02b22509451c..dba11f277f3703e1ee7f5a62f021d319e4ab18fc 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
@@ -24,6 +24,14 @@ public class ClientboundLevelChunkPacketData {
private final CompoundTag heightmaps;
private final byte[] buffer;
private final List<ClientboundLevelChunkPacketData.BlockEntityInfo> blockEntitiesData;
+ // Paper start
+ private final java.util.List<net.minecraft.network.protocol.Packet> extraPackets = new java.util.ArrayList<>();
+ private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750);
+
+ public List<net.minecraft.network.protocol.Packet> getExtraPackets() {
+ return this.extraPackets;
+ }
+ // Paper end
public ClientboundLevelChunkPacketData(LevelChunk chunk) {
this.heightmaps = new CompoundTag();
@@ -37,8 +45,18 @@ public class ClientboundLevelChunkPacketData {
this.buffer = new byte[calculateChunkSize(chunk)];
extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk);
this.blockEntitiesData = Lists.newArrayList();
+ int totalTileEntities = 0; // Paper
for(Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) {
+ // Paper start
+ if (++totalTileEntities > TE_LIMIT) {
+ var packet = entry2.getValue().getUpdatePacket();
+ if (packet != null) {
+ this.extraPackets.add(packet);
+ continue;
+ }
+ }
+ // Paper end
this.blockEntitiesData.add(ClientboundLevelChunkPacketData.BlockEntityInfo.create(entry2.getValue()));
}
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
index ad1d33a251bb7dc68fffc85491cc68e64e7dda1c..079734654c0fd421561b5f9003cd318bad5787a9 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java
@@ -57,4 +57,11 @@ public class ClientboundLevelChunkWithLightPacket implements Packet<ClientGamePa
public ClientboundLightUpdatePacketData getLightData() {
return this.lightData;
}
+
+ // Paper start - handle over-sized TE packets
+ @Override
+ public java.util.List<Packet> getExtraPackets() {
+ return this.chunkData.getExtraPackets();
+ }
+ // Paper end
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Set Zombie last tick at start of drowning process
Fixes GH-1887 Fixes GH-1887
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 96d172c428c6293b346201159422e2a581e350d9..4f328c3281663a55eef879604d713ff38d797298 100644 index 8c7c621f09e8669a6874a2ce101972cb1c03f8ae..a54af7c5b970102e8ff7f46bf4dd34b19faf3b8a 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -225,6 +225,7 @@ public class Zombie extends Monster { @@ -222,6 +222,7 @@ public class Zombie extends Monster {
++this.inWaterTime; ++this.inWaterTime;
if (this.inWaterTime >= 600) { if (this.inWaterTime >= 600) {
this.startUnderWaterConversion(300); this.startUnderWaterConversion(300);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index b2e418db3b8b1b88b92234a9fc913a09d1325793..bc73d5052611dba90c2d9c86854447be6a31fdac 100644 index e9447ac47a858fbc9e16559c18e377517b8089ac..601eb789e19efe4a2fa697c0b5e7c28b245f0990 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1124,6 +1124,7 @@ public abstract class PlayerList { @@ -1123,6 +1123,7 @@ public abstract class PlayerList {
} }
public void setUsingWhiteList(boolean whitelistEnabled) { public void setUsingWhiteList(boolean whitelistEnabled) {

View File

@ -6,19 +6,18 @@ Subject: [PATCH] Use proper max length when serialising BungeeCord text
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
index a64780b4b49d01322d8f755ff540a9622c89e983..26a229f7aa3f4425ed572e2d50730b4e978bf33e 100644 index a64780b4b49d01322d8f755ff540a9622c89e983..4047e177e3f336aa089ad7645ba8bd9e0863178e 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
@@ -8,7 +8,7 @@ import net.minecraft.network.chat.Component; @@ -9,6 +9,7 @@ import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.Packet;
public class ClientboundChatPacket implements Packet<ClientGamePacketListener> { public class ClientboundChatPacket implements Packet<ClientGamePacketListener> {
-
+ private static final int MAX_LENGTH = Short.MAX_VALUE * 8 + 8; // Paper + private static final int MAX_LENGTH = Short.MAX_VALUE * 8 + 8; // Paper
private final Component message; private final Component message;
public net.kyori.adventure.text.Component adventure$message; // Paper public net.kyori.adventure.text.Component adventure$message; // Paper
public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot
@@ -39,9 +39,9 @@ public class ClientboundChatPacket implements Packet<ClientGamePacketListener> { @@ -39,9 +40,9 @@ public class ClientboundChatPacket implements Packet<ClientGamePacketListener> {
// buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(components)); // Paper - comment, replaced with below // buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(components)); // Paper - comment, replaced with below
// Paper start - don't nest if we don't need to so that we can preserve formatting // Paper start - don't nest if we don't need to so that we can preserve formatting
if (this.components.length == 1) { if (this.components.length == 1) {

View File

@ -1,50 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 6 May 2020 05:00:57 -0400
Subject: [PATCH] Handle Oversized Tile Entities in chunks
Splits out Extra Packets if too many TE's are encountered to prevent
creating too large of a packet to sed.
Co authored by Spottedleaf
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 96626835fee3c0fdb452acacdc9f737ad90c08de..c28879f32b004f36ff746ea2274f91ddd9501e71 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java
@@ -27,6 +27,15 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
private final int[] biomes;
private final byte[] buffer;
private final List<CompoundTag> blockEntitiesTags;
+ // Paper start
+ private final java.util.List<Packet> extraPackets = new java.util.ArrayList<>();
+ private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750);
+
+ @Override
+ public java.util.List<Packet> getExtraPackets() {
+ return extraPackets;
+ }
+ // Paper end
public ClientboundLevelChunkPacket(LevelChunk chunk) {
ChunkPos chunkPos = chunk.getPos();
@@ -44,9 +53,19 @@ public class ClientboundLevelChunkPacket implements Packet<ClientGamePacketListe
this.buffer = new byte[this.calculateChunkSize(chunk)];
this.availableSections = this.extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk);
this.blockEntitiesTags = Lists.newArrayList();
+ int totalTileEntities = 0; // Paper
for(Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) {
BlockEntity blockEntity = entry2.getValue();
+ // Paper start - improve oversized chunk data packet handling
+ if (++totalTileEntities > TE_LIMIT) {
+ ClientboundBlockEntityDataPacket updatePacket = blockEntity.getUpdatePacket();
+ if (updatePacket != null) {
+ this.extraPackets.add(updatePacket);
+ continue;
+ }
+ }
+ // Paper end
CompoundTag compoundTag = blockEntity.getUpdateTag();
if (blockEntity instanceof net.minecraft.world.level.block.entity.SkullBlockEntity) { net.minecraft.world.level.block.entity.SkullBlockEntity.sanitizeTileEntityUUID(compoundTag); } // Paper
this.blockEntitiesTags.add(compoundTag);

View File

@ -4,3 +4,4 @@ Check if PlayerNaturallySpawnedEvent is called correctly
Make sure fluids aren't completly fucked, there may be more sync loads to nuke there as well Make sure fluids aren't completly fucked, there may be more sync loads to nuke there as well
Improve Server Thread Pool and Thread Priorities: mojang added a max thread count property Improve Server Thread Pool and Thread Priorities: mojang added a max thread count property
Use Vanilla Minecart Speeds: is this needed? Use Vanilla Minecart Speeds: is this needed?
Handle Oversized Tile Entities: make sure impl is correct