Do not perform neighbour updates when using debug stick (Fixes #2134)

CB blindly drops any update flags when recording block modifications,
this causes the debug stick to blindly update neighbouring blocks on usage
in order to control this, we will special case this item, however, this
ideally should be fixed by recording the actual update flags used,
but will induce ABI breaks...

This patch also maintains the behavior of the BlockPlaceEvent, this
behavior will NOT be guaranteed in the future, however.
This commit is contained in:
Shane Freeder 2020-12-22 22:45:10 +00:00
parent a70924789b
commit 7ef05fbd8a
18 changed files with 111 additions and 41 deletions

View File

@ -2411,7 +2411,7 @@ index 1b2f415e3ed7f6dca12d13cd098cb4ec3af54020..64e8088d394ddcda59d0209883b778ab
@Override
public BlockPosition immutableCopy() {
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 22281e509e65bf179c041b33238f217fb7c856ad..157eccc8e45566db527c7d46d3b3d235c802c8f7 100644
index 225e8fef6741d9bdbc8ac86cd17e54ddbf04a9e8..4e1e7cb088f1b5d07ace5025c486f2ee67667511 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -26,7 +26,7 @@ public class Chunk implements IChunkAccess {
@ -3109,7 +3109,7 @@ index 1e7f5d77700a1ed98c5f50ea82fb57b5e556496a..09ac187ba8ff52f6fa1f0d5d00a13851
// CraftBukkit start - fire event
setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true);
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index b1edfd6f33a6eecbe47a2a2a4f5be844400eb283..fea94330301a7859cd7ab9af7a9cd3f6d2d8e79a 100644
index ce8d11eb47c1bf1d73eee69ba0f94d7a63cc5518..c6d3b5c8b14808e10a64d6bf1ef971f8bcdbd48f 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -138,6 +138,7 @@ public abstract class EntityLiving extends Entity {
@ -3907,6 +3907,19 @@ index 90223deae3376fd6828eddf3831dab96650afef2..63c4dbd327beb7b6ab42eb44650d68ac
if (packet.a()) {
throw new SkipEncodeException(throwable);
} else {
diff --git a/src/main/java/net/minecraft/server/PacketPlayInBEdit.java b/src/main/java/net/minecraft/server/PacketPlayInBEdit.java
index d7252b044288aadb1d235dd968038ee5c13cf701..185ba3789739d06bcb58979519e1f8ff8439be9f 100644
--- a/src/main/java/net/minecraft/server/PacketPlayInBEdit.java
+++ b/src/main/java/net/minecraft/server/PacketPlayInBEdit.java
@@ -4,7 +4,7 @@ import java.io.IOException;
public class PacketPlayInBEdit implements Packet<PacketListenerPlayIn> {
- private ItemStack a;
+ private ItemStack a; public ItemStack getBook() { return a; } // Paper - OBFHELPER
private boolean b;
private int c;
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
index 8bdda63a2807635e8780481244251f6e35c13627..36a7e41cc5036345929ebf4d2fa160a8c16c2c0a 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java

View File

@ -22,7 +22,7 @@ index ba7fdf482ef8536074fcc3867d7fc142fcfe8ce8..2aca8cc2be963b2b015e52cdec6b3843
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index cc141f02d5a2b1a5c50e5583d3537d5883762db1..8a322537f8418627d7fc6db2f1411bf5ca252dcc 100644
index cc141f02d5a2b1a5c50e5583d3537d5883762db1..4673efa3f540a6dc2c01a2a601a7c06ee791e8b4 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -20,6 +20,7 @@ import java.util.function.Consumer;
@ -33,14 +33,19 @@ index cc141f02d5a2b1a5c50e5583d3537d5883762db1..8a322537f8418627d7fc6db2f1411bf5
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -850,6 +851,42 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -850,6 +851,52 @@ public class PlayerConnection implements PacketListenerPlayIn {
@Override
public void a(PacketPlayInBEdit packetplayinbedit) {
+ // Paper start
+ ItemStack testStack = packetplayinbedit.b(); // TODO(Proximyst): Add obfhelper here
+ ItemStack testStack = packetplayinbedit.getBook();
+ if (!server.isPrimaryThread() && !testStack.isEmpty() && testStack.getTag() != null) {
+ NBTTagList pageList = testStack.getTag().getList("pages", 8);
+ if (pageList.size() > 50) {
+ PlayerConnection.LOGGER.warn(this.player.getName() + " tried to send a book with too many pages");
+ minecraftServer.scheduleOnMain(() -> this.disconnect("Book too large!"));
+ return;
+ }
+ long byteTotal = 0;
+ int maxBookPageSize = com.destroystokyo.paper.PaperConfig.maxBookPageSize;
+ double multiplier = Math.max(0.3D, Math.min(1D, com.destroystokyo.paper.PaperConfig.maxBookTotalSizeMultiplier));
@ -48,6 +53,11 @@ index cc141f02d5a2b1a5c50e5583d3537d5883762db1..8a322537f8418627d7fc6db2f1411bf5
+ for (int i = 0; i < pageList.size(); ++i) {
+ String testString = pageList.getString(i);
+ int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
+ if (byteLength > 256 * 4) {
+ PlayerConnection.LOGGER.warn(this.player.getName() + " tried to send a book with with a page too large!");
+ minecraftServer.scheduleOnMain(() -> this.disconnect("Book too large!"));
+ return;
+ }
+ byteTotal += byteLength;
+ int length = testString.length();
+ int multibytes = 0;

View File

@ -6,10 +6,10 @@ 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/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 8a322537f8418627d7fc6db2f1411bf5ca252dcc..237f4d381d9d81a1b13845ab3b594f7d99d2d94b 100644
index 4673efa3f540a6dc2c01a2a601a7c06ee791e8b4..d5397f670f3908a39b2a398ab59f7743c48bef47 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2682,7 +2682,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2692,7 +2692,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
TileEntitySign tileentitysign = (TileEntitySign) tileentity;

View File

@ -22,7 +22,7 @@ it only impacts data sent from the client.
Set -DPaper.maxSignLength=XX to change limit or -1 to disable
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 237f4d381d9d81a1b13845ab3b594f7d99d2d94b..05e5566bb42525b729dad9c31d6b1c3e4cfab6d0 100644
index d5397f670f3908a39b2a398ab59f7743c48bef47..af80dcddc4f65acc916b5b12bb7f9fb2effd3b90 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -108,6 +108,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -33,7 +33,7 @@ index 237f4d381d9d81a1b13845ab3b594f7d99d2d94b..05e5566bb42525b729dad9c31d6b1c3e
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
@@ -2696,7 +2697,17 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2706,7 +2707,17 @@ public class PlayerConnection implements PacketListenerPlayIn {
String[] lines = new String[4];
for (int i = 0; i < list.size(); ++i) {

View File

@ -22,10 +22,10 @@ index 216445778ce8432fe2506cd7ac4312f43f42ba33..e9bc1d22825850a1f1ef3267428c1984
this.f.accept(packet);
if (this.tracker instanceof EntityPlayer) {
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 05e5566bb42525b729dad9c31d6b1c3e4cfab6d0..88d6dbfe6a64ad6e2f5916ca3e87cc2ac5f30227 100644
index af80dcddc4f65acc916b5b12bb7f9fb2effd3b90..755c5778e0258878daa7ede1b26877e75d97a5ce 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2129,7 +2129,14 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2139,7 +2139,14 @@ public class PlayerConnection implements PacketListenerPlayIn {
if (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem) {
// Refresh the current entity metadata

View File

@ -8,10 +8,10 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk
load in that case).
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index e4d47589d2368c373f920066309b4c5a757906c5..ea6476aec59eec50323b0927b6261ebd077926be 100644
index 7f2a09f940902190fcf7045aab27fa3474eafd14..4dd57152cb0d09b2df08be68ab111623724d52fc 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1084,7 +1084,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1094,7 +1094,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
speed = player.abilities.walkSpeed * 10f;
}
// Paper start - Prevent moving into unloaded chunks

View File

@ -7,7 +7,7 @@ Fixes an AssertionError when setting the player's item in hand to null or a new
Fixes GH-2718
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 1685478f333a387d270ec4533319b9a62076a9ef..44793c443bd8c357832daa5c65cc2230ef031dc2 100644
index dbd212fc2f0c95ab1dcc4b6be86f0f87ac726fa7..37e3efa1fed858f735166a5c0cb97f886b2bbb4e 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2055,6 +2055,7 @@ public abstract class EntityLiving extends Entity {
@ -19,10 +19,10 @@ index 1685478f333a387d270ec4533319b9a62076a9ef..44793c443bd8c357832daa5c65cc2230
if (enumhand == EnumHand.MAIN_HAND) {
return this.getEquipment(EnumItemSlot.MAINHAND);
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index ea6476aec59eec50323b0927b6261ebd077926be..ec14c63fb20737aa9aab22d596bb4045a9a9c867 100644
index 4dd57152cb0d09b2df08be68ab111623724d52fc..a6b83cb349386ff1fb6f3267f0d610bf31df3f16 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1547,6 +1547,10 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1557,6 +1557,10 @@ public class PlayerConnection implements PacketListenerPlayIn {
this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524
return;
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent teleporting dead entities
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index ec14c63fb20737aa9aab22d596bb4045a9a9c867..8b464d2c05c636bd1412a9b68c9dcb484620da94 100644
index a6b83cb349386ff1fb6f3267f0d610bf31df3f16..e61efeccd4d9fc8ff55c2c914158e5982222ba74 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1309,6 +1309,10 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1319,6 +1319,10 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
private void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set) {

View File

@ -1146,10 +1146,10 @@ index fba7c9b5724114eab35a3d24febdee3cd3e30aa0..b6ae589548bdc75052f4986069b3374c
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 2c1fbea9c9d46f7e9e79324eb97c9871c5be5a87..57de31e07cf0986b64a1650dd28f9fee846a66aa 100644
index 2978f2e1b136f61e1519ce3aac2f679f650d2258..e76c01a33bfcee1a9d312247b8d08026055204c8 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1369,6 +1369,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1379,6 +1379,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
this.A = this.e;
this.player.setLocation(d0, d1, d2, f, f1);

View File

@ -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/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 57de31e07cf0986b64a1650dd28f9fee846a66aa..73e95ca9cb7f83970ff096084a646dd4dcf23db7 100644
index e76c01a33bfcee1a9d312247b8d08026055204c8..45379bf4903ca8044145504207acd59c221b7f26 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1166,6 +1166,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1176,6 +1176,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9));
this.player.setOnGround(packetplayinflying.b()); // CraftBukkit - SPIGOT-5810, SPIGOT-5835: reset by this.player.move

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 73e95ca9cb7f83970ff096084a646dd4dcf23db7..c33707d55c80341eaacd6c6a7526444ee5b2cc0a 100644
index 45379bf4903ca8044145504207acd59c221b7f26..c9b834c38f8d7b21d0a7a0d04762f66d41b0c39d 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2602,9 +2602,15 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2612,9 +2612,15 @@ public class PlayerConnection implements PacketListenerPlayIn {
PlayerConnectionUtils.ensureMainThread(packetplayinautorecipe, this, this.player.getWorldServer());
this.player.resetIdleTimer();
if (!this.player.isSpectator() && this.player.activeContainer.windowId == packetplayinautorecipe.b() && this.player.activeContainer.c(this.player) && this.player.activeContainer instanceof ContainerRecipeBook) {

View File

@ -63,10 +63,10 @@ index 450c04c5a1153ea9d11d005f3be623bbf8b26ce6..157f8f5e5255312b916aef200810ad38
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index b1156e31ec45b7515734a440f07331cf731c3ab6..aa7b907cee743640e30e25c95f3bbca49ec57e1e 100644
index 5240af35fcec03f350596cecc74a4230f257e7b4..9b54d690e09f719a18ba321a0c927bb31c71bf01 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2872,7 +2872,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2882,7 +2882,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
public void a(PacketPlayInDifficultyChange packetplayindifficultychange) {
PlayerConnectionUtils.ensureMainThread(packetplayindifficultychange, this, this.player.getWorldServer());
if (this.player.k(2) || this.isExemptPlayer()) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Move range check for block placing up
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index aa7b907cee743640e30e25c95f3bbca49ec57e1e..da172db2ccda64a7160282440d5548bd7e7eda80 100644
index 9b54d690e09f719a18ba321a0c927bb31c71bf01..f19fd40cdc1e758ebefb85201358e314428bd8c6 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1502,15 +1502,19 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1512,15 +1512,19 @@ public class PlayerConnection implements PacketListenerPlayIn {
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();
EnumDirection enumdirection = movingobjectpositionblock.getDirection();

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Brand support
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index da172db2ccda64a7160282440d5548bd7e7eda80..8a4a7888089a10416fc0cf88007b7a958e903a4c 100644
index f19fd40cdc1e758ebefb85201358e314428bd8c6..444355e81bd7f5d07e3ef5f4b9d91d1bf11428ef 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -5,6 +5,7 @@ import com.google.common.primitives.Doubles;
@ -25,7 +25,7 @@ index da172db2ccda64a7160282440d5548bd7e7eda80..8a4a7888089a10416fc0cf88007b7a95
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
this.minecraftServer = minecraftserver;
this.networkManager = networkmanager;
@@ -2831,6 +2834,8 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2841,6 +2844,8 @@ public class PlayerConnection implements PacketListenerPlayIn {
private static final MinecraftKey CUSTOM_REGISTER = new MinecraftKey("register");
private static final MinecraftKey CUSTOM_UNREGISTER = new MinecraftKey("unregister");
@ -34,7 +34,7 @@ index da172db2ccda64a7160282440d5548bd7e7eda80..8a4a7888089a10416fc0cf88007b7a95
@Override
public void a(PacketPlayInCustomPayload packetplayincustompayload) {
PlayerConnectionUtils.ensureMainThread(packetplayincustompayload, this, this.player.getWorldServer());
@@ -2858,6 +2863,16 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2868,6 +2873,16 @@ public class PlayerConnection implements PacketListenerPlayIn {
try {
byte[] data = new byte[packetplayincustompayload.data.readableBytes()];
packetplayincustompayload.data.readBytes(data);
@ -51,7 +51,7 @@ index da172db2ccda64a7160282440d5548bd7e7eda80..8a4a7888089a10416fc0cf88007b7a95
server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packetplayincustompayload.tag.toString(), data);
} catch (Exception ex) {
PlayerConnection.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@@ -2867,6 +2882,12 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2877,6 +2892,12 @@ public class PlayerConnection implements PacketListenerPlayIn {
}

View File

@ -9,7 +9,7 @@ as this is how Vanilla teleports entities.
Cancel any pending motion when teleported.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index bf0ef3998ff5dd71d3d6489184ece7fdce8afdd5..1f73ffbdd5b1b5906573ca4ba5c16a4f31b4c79a 100644
index 6aeea48d4cf4732f6a5a5dba12af873c2aee493b..fa0256a99c833e6035b8d3e873a93af2b674ef52 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -54,6 +54,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -35,7 +35,7 @@ index bf0ef3998ff5dd71d3d6489184ece7fdce8afdd5..1f73ffbdd5b1b5906573ca4ba5c16a4f
this.yaw = f;
this.pitch = f1;
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 8a4a7888089a10416fc0cf88007b7a958e903a4c..c0524ff9f49dffa4010bdeef301c0d7a059046d4 100644
index 444355e81bd7f5d07e3ef5f4b9d91d1bf11428ef..cef65c7bde4b759014312c6bcc3b0ac6c4b0c462 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -542,7 +542,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -47,7 +47,7 @@ index 8a4a7888089a10416fc0cf88007b7a958e903a4c..c0524ff9f49dffa4010bdeef301c0d7a
this.o = this.teleportPos.x;
this.p = this.teleportPos.y;
this.q = this.teleportPos.z;
@@ -1376,7 +1376,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1386,7 +1386,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
// CraftBukkit end
this.A = this.e;

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Fix for large move vectors crashing server
Check movement distance also based on current position.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index c0524ff9f49dffa4010bdeef301c0d7a059046d4..c1ce4d39e59d0e49996169dc9c26e8ccafde6e3e 100644
index cef65c7bde4b759014312c6bcc3b0ac6c4b0c462..e9715d7a44338af4104bfd44857df0af7a0df012 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -367,19 +367,24 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -41,7 +41,7 @@ index c0524ff9f49dffa4010bdeef301c0d7a059046d4..c1ce4d39e59d0e49996169dc9c26e8cc
// CraftBukkit start - handle custom speeds and skipped ticks
@@ -1071,7 +1076,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1081,7 +1086,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
double d2 = this.player.locZ();
double d3 = this.player.locY();
double d4 = packetplayinflying.a(this.player.locX());double toX = d4; // Paper - OBFHELPER
@ -50,7 +50,7 @@ index c0524ff9f49dffa4010bdeef301c0d7a059046d4..c1ce4d39e59d0e49996169dc9c26e8cc
double d6 = packetplayinflying.c(this.player.locZ());double toZ = d6; // Paper - OBFHELPER
float f = packetplayinflying.a(this.player.yaw);
float f1 = packetplayinflying.b(this.player.pitch);
@@ -1079,7 +1084,12 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1089,7 +1094,12 @@ public class PlayerConnection implements PacketListenerPlayIn {
double d8 = d5 - this.m;
double d9 = d6 - this.n;
double d10 = this.player.getMot().g();

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Limit recipe packets
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 6ab0a51b421dc696aec292f2db955311c9cc31e3..cdf1177ca7b4b1b0808176c455f62b395146da50 100644
index c14df29b190a9c0126545e0084b6283efc3ce7b0..152857012d46e05c185e2a3f62a770419f2dcbc6 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -326,6 +326,13 @@ public class PaperConfig {
@ -23,7 +23,7 @@ index 6ab0a51b421dc696aec292f2db955311c9cc31e3..cdf1177ca7b4b1b0808176c455f62b39
public static boolean velocityOnlineMode;
public static byte[] velocitySecretKey;
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 0aac84e9800788947bb75b04307ba6fffb57dab8..3e1f88bce8e0ba95f73bca204549db0c65b1465e 100644
index fbbb5d1019d894e0f05cffb05bcea1e2fdfcbf6e..4d3a427b16e1e0d6889faf4b913b212f8a6e938d 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1,5 +1,6 @@
@ -67,7 +67,7 @@ index 0aac84e9800788947bb75b04307ba6fffb57dab8..3e1f88bce8e0ba95f73bca204549db0c
/* Use thread-safe field access instead
if (this.chatThrottle > 0) {
--this.chatThrottle;
@@ -2617,6 +2622,14 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2627,6 +2632,14 @@ public class PlayerConnection implements PacketListenerPlayIn {
@Override
public void a(PacketPlayInAutoRecipe packetplayinautorecipe) {

View File

@ -0,0 +1,47 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Tue, 22 Dec 2020 22:41:12 +0000
Subject: [PATCH] Do not perform neighbour updates when using debug stick
CB blindly drops any update flags when recording block modifications,
this causes the debug stick to blindly update neighbouring blocks on usage
in order to control this, we will special case this item, however, this
ideally should be fixed by recording the actual update flags used,
but will induce ABI breaks...
This patch also maintains the behavior of the BlockPlaceEvent, this
behavior will NOT be guaranteed in the future, however.
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 3adb29f004d2fee36f3ee9b21ee5417e84b64837..5a62ac72edc49cd032cd02fa8d007959517d063b 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -211,6 +211,7 @@ public final class ItemStack {
}
public EnumInteractionResult placeItem(ItemActionContext itemactioncontext, EnumHand enumhand) { // CraftBukkit - add hand
+ boolean doPhysicsUpdate = true; // Paper
EntityHuman entityhuman = itemactioncontext.getEntity();
BlockPosition blockposition = itemactioncontext.getClickPosition();
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getWorld(), blockposition, false);
@@ -228,7 +229,11 @@ public final class ItemStack {
// special case bonemeal
if (this.getItem() == Items.BONE_MEAL) {
world.captureTreeGeneration = true;
+ // Paper start
+ } else if (this.getItem() instanceof ItemDebugStick) {
+ doPhysicsUpdate = false;
}
+ // Paper end
}
Item item = this.getItem();
EnumInteractionResult enuminteractionresult = item.a(itemactioncontext);
@@ -316,7 +321,7 @@ public final class ItemStack {
block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, itemactioncontext); // Paper - pass itemactioncontext
}
- world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getType(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
+ world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getType(newblockposition), updateFlag, 512 ^ (doPhysicsUpdate ? 0 : 16)); // send null chunk as chunk.k() returns false by this point // Paper
}
// Special case juke boxes as they update their tile entity. Copied from ItemRecord.