Update to Minecraft 1.20.3

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-12-06 03:40:00 +11:00
parent afdb1d9bc3
commit 8398e12b34
256 changed files with 2745 additions and 1911 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/network/PlayerConnection.java
+++ b/net/minecraft/server/network/PlayerConnection.java
@@ -180,6 +180,66 @@
@@ -183,6 +183,67 @@
import net.minecraft.world.phys.shapes.VoxelShapes;
import org.slf4j.Logger;
@@ -9,6 +9,7 @@
+import java.util.Arrays;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Function;
+import net.minecraft.network.chat.OutgoingChatMessage;
+import net.minecraft.network.protocol.game.PacketPlayOutAttachEntity;
+import net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment;
@@ -67,7 +68,7 @@
public class PlayerConnection extends ServerCommonPacketListenerImpl implements PacketListenerPlayIn, ServerPlayerConnection, TickablePacketListener {
static final Logger LOGGER = LogUtils.getLogger();
@@ -191,7 +251,9 @@
@@ -194,7 +255,9 @@
public final PlayerChunkSender chunkSender;
private int tickCount;
private int ackBlockChangesUpTo = -1;
@@ -78,19 +79,19 @@
private int dropSpamTickCount;
private double firstGoodX;
private double firstGoodY;
@@ -227,7 +289,7 @@
@@ -229,7 +292,7 @@
private boolean waitingForSwitchToConfig;
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer, CommonListenerCookie commonlistenercookie) {
- super(minecraftserver, networkmanager, commonlistenercookie);
+ super(minecraftserver, networkmanager, commonlistenercookie, entityplayer); // CraftBukkit
this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH);
this.lastSeenMessages = new LastSeenMessagesValidator(20);
this.messageSignatureCache = MessageSignatureCache.createDefault();
@@ -237,9 +299,25 @@
entityplayer.connection = this;
entityplayer.getTextFilter().join();
this.signedMessageDecoder = minecraftserver.enforceSecureProfile() ? SignedMessageChain.b.REJECT_ALL : SignedMessageChain.b.unsigned(entityplayer.getUUID());
this.chunkSender = new PlayerChunkSender(networkmanager.isMemoryConnection());
networkmanager.setListener(this);
this.player = entityplayer;
@@ -239,9 +302,25 @@
Objects.requireNonNull(minecraftserver);
this.signedMessageDecoder = SignedMessageChain.b.unsigned(uuid, minecraftserver::enforceSecureProfile);
- this.chatMessageChain = new FutureChain(minecraftserver);
+ this.chatMessageChain = new FutureChain(minecraftserver.chatExecutor); // CraftBukkit - async chat
}
@@ -114,7 +115,7 @@
@Override
public void tick() {
if (this.ackBlockChangesUpTo > -1) {
@@ -291,15 +369,21 @@
@@ -293,15 +372,21 @@
}
this.keepConnectionAlive();
@@ -136,7 +137,7 @@
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.idling"));
}
@@ -390,7 +474,34 @@
@@ -392,7 +477,34 @@
double d9 = entity.getDeltaMovement().lengthSqr();
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
@@ -172,7 +173,7 @@
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8});
this.send(new PacketPlayOutVehicleMove(entity));
return;
@@ -430,14 +541,72 @@
@@ -432,14 +544,72 @@
}
entity.absMoveTo(d3, d4, d5, f, f1);
@@ -245,7 +246,7 @@
this.player.serverLevel().getChunkSource().move(this.player);
this.player.checkMovementStatistics(this.player.getX() - d0, this.player.getY() - d1, this.player.getZ() - d2);
this.clientVehicleIsFloating = d11 >= -0.03125D && !flag1 && !this.server.isFlightAllowed() && !entity.isNoGravity() && this.noBlocksAround(entity);
@@ -471,6 +640,7 @@
@@ -473,6 +643,7 @@
}
this.awaitingPositionFromClient = null;
@@ -253,7 +254,7 @@
}
}
@@ -478,7 +648,7 @@
@@ -480,7 +651,7 @@
@Override
public void handleRecipeBookSeenRecipePacket(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipedisplayed, this, this.player.serverLevel());
@@ -262,7 +263,7 @@
RecipeBookServer recipebookserver = this.player.getRecipeBook();
Objects.requireNonNull(recipebookserver);
@@ -488,6 +658,7 @@
@@ -490,6 +661,7 @@
@Override
public void handleRecipeBookChangeSettingsPacket(PacketPlayInRecipeSettings packetplayinrecipesettings) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipesettings, this, this.player.serverLevel());
@@ -270,7 +271,7 @@
this.player.getRecipeBook().setBookSetting(packetplayinrecipesettings.getBookType(), packetplayinrecipesettings.isOpen(), packetplayinrecipesettings.isFiltering());
}
@@ -508,6 +679,12 @@
@@ -510,6 +682,12 @@
@Override
public void handleCustomCommandSuggestions(PacketPlayInTabComplete packetplayintabcomplete) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayintabcomplete, this, this.player.serverLevel());
@@ -283,7 +284,7 @@
StringReader stringreader = new StringReader(packetplayintabcomplete.getCommand());
if (stringreader.canRead() && stringreader.peek() == '/') {
@@ -517,6 +694,7 @@
@@ -519,6 +697,7 @@
ParseResults<CommandListenerWrapper> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
@@ -291,7 +292,7 @@
this.send(new PacketPlayOutTabComplete(packetplayintabcomplete.getId(), suggestions));
});
}
@@ -762,6 +940,13 @@
@@ -766,6 +945,13 @@
if (container instanceof ContainerMerchant) {
ContainerMerchant containermerchant = (ContainerMerchant) container;
@@ -305,7 +306,7 @@
if (!containermerchant.stillValid(this.player)) {
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, containermerchant);
@@ -776,6 +961,13 @@
@@ -780,6 +966,13 @@
@Override
public void handleEditBook(PacketPlayInBEdit packetplayinbedit) {
@@ -319,7 +320,7 @@
int i = packetplayinbedit.getSlot();
if (PlayerInventory.isHotbarSlot(i) || i == 40) {
@@ -784,7 +976,7 @@
@@ -788,7 +981,7 @@
Objects.requireNonNull(list);
optional.ifPresent(list::add);
@@ -328,7 +329,7 @@
Objects.requireNonNull(list);
stream.forEach(list::add);
@@ -802,7 +994,7 @@
@@ -806,7 +999,7 @@
ItemStack itemstack = this.player.getInventory().getItem(i);
if (itemstack.is(Items.WRITABLE_BOOK)) {
@@ -337,7 +338,7 @@
}
}
@@ -827,16 +1019,16 @@
@@ -831,16 +1024,16 @@
this.updateBookPages(list, (s) -> {
return IChatBaseComponent.ChatSerializer.toJson(IChatBaseComponent.literal(s));
@@ -358,7 +359,7 @@
return NBTTagString.valueOf((String) unaryoperator.apply(filteredtext.filteredOrEmpty()));
});
@@ -862,6 +1054,7 @@
@@ -866,6 +1059,7 @@
}
itemstack.addTagElement("pages", nbttaglist);
@@ -366,7 +367,7 @@
}
@Override
@@ -898,7 +1091,7 @@
@@ -922,7 +1116,7 @@
} else {
WorldServer worldserver = this.player.serverLevel();
@@ -375,7 +376,7 @@
if (this.tickCount == 0) {
this.resetPosition();
}
@@ -908,7 +1101,7 @@
@@ -932,7 +1126,7 @@
this.awaitingTeleportTime = this.tickCount;
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
}
@@ -384,7 +385,7 @@
} else {
this.awaitingTeleportTime = this.tickCount;
double d0 = clampHorizontal(packetplayinflying.getX(this.player.getX()));
@@ -920,7 +1113,15 @@
@@ -944,7 +1138,15 @@
if (this.player.isPassenger()) {
this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1);
this.player.serverLevel().getChunkSource().move(this.player);
@@ -400,43 +401,43 @@
double d3 = this.player.getX();
double d4 = this.player.getY();
double d5 = this.player.getZ();
@@ -939,15 +1140,33 @@
++this.receivedMovePacketCount;
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
@@ -964,15 +1166,33 @@
++this.receivedMovePacketCount;
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
- if (i > 5) {
+ // CraftBukkit start - handle custom speeds and skipped ticks
+ this.allowedPlayerTicks += (System.currentTimeMillis() / 50) - this.lastTick;
+ this.allowedPlayerTicks = Math.max(this.allowedPlayerTicks, 1);
+ this.lastTick = (int) (System.currentTimeMillis() / 50);
- if (i > 5) {
+ // CraftBukkit start - handle custom speeds and skipped ticks
+ this.allowedPlayerTicks += (System.currentTimeMillis() / 50) - this.lastTick;
+ this.allowedPlayerTicks = Math.max(this.allowedPlayerTicks, 1);
+ this.lastTick = (int) (System.currentTimeMillis() / 50);
+
+ if (i > Math.max(this.allowedPlayerTicks, 5)) {
PlayerConnection.LOGGER.debug("{} is sending move packets too frequently ({} packets since last tick)", this.player.getName().getString(), i);
i = 1;
}
+ if (i > Math.max(this.allowedPlayerTicks, 5)) {
PlayerConnection.LOGGER.debug("{} is sending move packets too frequently ({} packets since last tick)", this.player.getName().getString(), i);
i = 1;
}
+ if (packetplayinflying.hasRot || d10 > 0) {
+ allowedPlayerTicks -= 1;
+ } else {
+ allowedPlayerTicks = 20;
+ }
+ double speed;
+ if (player.getAbilities().flying) {
+ speed = player.getAbilities().flyingSpeed * 20f;
+ } else {
+ speed = player.getAbilities().walkingSpeed * 10f;
+ }
+ if (packetplayinflying.hasRot || d10 > 0) {
+ allowedPlayerTicks -= 1;
+ } else {
+ allowedPlayerTicks = 20;
+ }
+ double speed;
+ if (player.getAbilities().flying) {
+ speed = player.getAbilities().flyingSpeed * 20f;
+ } else {
+ speed = player.getAbilities().walkingSpeed * 10f;
+ }
+
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) {
float f2 = this.player.isFallFlying() ? 300.0F : 100.0F;
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) {
float f2 = this.player.isFallFlying() ? 300.0F : 100.0F;
- if (d10 - d9 > (double) (f2 * (float) i) && !this.isSingleplayerOwner()) {
+ if (d10 - d9 > Math.max(f2, Math.pow((double) (10.0F * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
+ // CraftBukkit end
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d6, d7, d8});
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
return;
@@ -968,6 +1187,7 @@
- if (d10 - d9 > (double) (f2 * (float) i) && !this.isSingleplayerOwner()) {
+ if (d10 - d9 > Math.max(f2, Math.pow((double) (10.0F * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
+ // CraftBukkit end
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d6, d7, d8});
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
return;
@@ -994,6 +1214,7 @@
boolean flag1 = this.player.verticalCollisionBelow;
this.player.move(EnumMoveType.PLAYER, new Vec3D(d6, d7, d8));
@@ -444,7 +445,7 @@
double d11 = d7;
d6 = d0 - this.player.getX();
@@ -986,9 +1206,70 @@
@@ -1012,9 +1233,70 @@
}
if (!this.player.noPhysics && !this.player.isSleeping() && (flag2 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb, d0, d1, d2))) {
@@ -516,7 +517,7 @@
this.player.absMoveTo(d0, d1, d2, f, f1);
this.clientIsFloating = d11 >= -0.03125D && !flag1 && this.player.gameMode.getGameModeForPlayer() != EnumGamemode.SPECTATOR && !this.server.isFlightAllowed() && !this.player.getAbilities().mayfly && !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.isFallFlying() && !this.player.isAutoSpinAttack() && this.noBlocksAround(this.player);
this.player.serverLevel().getChunkSource().move(this.player);
@@ -1029,11 +1310,68 @@
@@ -1055,11 +1337,68 @@
return true;
}
@@ -586,7 +587,7 @@
double d3 = set.contains(RelativeMovement.X) ? this.player.getX() : 0.0D;
double d4 = set.contains(RelativeMovement.Y) ? this.player.getY() : 0.0D;
double d5 = set.contains(RelativeMovement.Z) ? this.player.getZ() : 0.0D;
@@ -1045,6 +1383,14 @@
@@ -1071,6 +1410,14 @@
this.awaitingTeleport = 0;
}
@@ -601,7 +602,7 @@
this.awaitingTeleportTime = this.tickCount;
this.player.absMoveTo(d0, d1, d2, f, f1);
this.player.connection.send(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport));
@@ -1053,6 +1399,7 @@
@@ -1079,6 +1426,7 @@
@Override
public void handlePlayerAction(PacketPlayInBlockDig packetplayinblockdig) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockdig, this, this.player.serverLevel());
@@ -609,7 +610,7 @@
BlockPosition blockposition = packetplayinblockdig.getPos();
this.player.resetLastActionTime();
@@ -1063,14 +1410,46 @@
@@ -1089,14 +1437,46 @@
if (!this.player.isSpectator()) {
ItemStack itemstack = this.player.getItemInHand(EnumHand.OFF_HAND);
@@ -658,7 +659,7 @@
this.player.drop(false);
}
@@ -1108,6 +1487,7 @@
@@ -1134,6 +1514,7 @@
@Override
public void handleUseItemOn(PacketPlayInUseItem packetplayinuseitem) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseitem, this, this.player.serverLevel());
@@ -666,7 +667,7 @@
this.player.connection.ackBlockChangesUpTo(packetplayinuseitem.getSequence());
WorldServer worldserver = this.player.serverLevel();
EnumHand enumhand = packetplayinuseitem.getHand();
@@ -1131,6 +1511,7 @@
@@ -1157,6 +1538,7 @@
if (blockposition.getY() < i) {
if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) {
@@ -674,7 +675,7 @@
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
if (enumdirection == EnumDirection.UP && !enuminteractionresult.consumesAction() && blockposition.getY() >= i - 1 && wasBlockPlacementAttempt(this.player, itemstack)) {
@@ -1159,6 +1540,7 @@
@@ -1185,6 +1567,7 @@
@Override
public void handleUseItem(PacketPlayInBlockPlace packetplayinblockplace) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockplace, this, this.player.serverLevel());
@@ -682,7 +683,7 @@
this.ackBlockChangesUpTo(packetplayinblockplace.getSequence());
WorldServer worldserver = this.player.serverLevel();
EnumHand enumhand = packetplayinblockplace.getHand();
@@ -1166,6 +1548,49 @@
@@ -1192,6 +1575,49 @@
this.player.resetLastActionTime();
if (!itemstack.isEmpty() && itemstack.isItemEnabled(worldserver.enabledFeatures())) {
@@ -732,7 +733,7 @@
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand);
if (enuminteractionresult.shouldSwing()) {
@@ -1186,7 +1611,7 @@
@@ -1212,7 +1638,7 @@
Entity entity = packetplayinspectate.getEntity(worldserver);
if (entity != null) {
@@ -741,7 +742,7 @@
return;
}
}
@@ -1209,6 +1634,13 @@
@@ -1235,6 +1661,13 @@
@Override
public void onDisconnect(IChatBaseComponent ichatbasecomponent) {
@@ -755,7 +756,7 @@
PlayerConnection.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), ichatbasecomponent.getString());
this.removePlayerFromWorld();
super.onDisconnect(ichatbasecomponent);
@@ -1216,10 +1648,18 @@
@@ -1242,10 +1675,18 @@
private void removePlayerFromWorld() {
this.chatMessageChain.close();
@@ -775,7 +776,7 @@
this.player.getTextFilter().leave();
}
@@ -1234,7 +1674,16 @@
@@ -1260,7 +1701,16 @@
@Override
public void handleSetCarriedItem(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinhelditemslot, this, this.player.serverLevel());
@@ -792,7 +793,7 @@
if (this.player.getInventory().selected != packetplayinhelditemslot.getSlot() && this.player.getUsedItemHand() == EnumHand.MAIN_HAND) {
this.player.stopUsingItem();
}
@@ -1243,18 +1692,25 @@
@@ -1269,18 +1719,25 @@
this.player.resetLastActionTime();
} else {
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@@ -811,7 +812,7 @@
if (isChatMessageIllegal(packetplayinchat.message())) {
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.illegal_characters"));
} else {
Optional<LastSeenMessages> optional = this.tryHandleChat(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.lastSeenMessages());
Optional<LastSeenMessages> optional = this.tryHandleChat(packetplayinchat.lastSeenMessages());
if (optional.isPresent()) {
- this.server.submit(() -> {
@@ -819,19 +820,25 @@
PlayerChatMessage playerchatmessage;
try {
@@ -1272,9 +1728,9 @@
PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent(ichatbasecomponent).filter(filteredtext.mask());
@@ -1290,7 +1747,7 @@
return;
}
this.broadcastChatMessage(playerchatmessage1);
- }, executor);
+ }, this.server.chatExecutor); // CraftBukkit - async chat
- CompletableFuture<FilteredText> completablefuture = this.filterTextPacket(playerchatmessage.signedContent());
+ CompletableFuture<FilteredText> completablefuture = this.filterTextPacket(playerchatmessage.signedContent()).thenApplyAsync(Function.identity(), this.server.chatExecutor); // CraftBukkit - async chat
IChatBaseComponent ichatbasecomponent = this.server.getChatDecorator().decorate(this.player, playerchatmessage.decoratedContent());
this.chatMessageChain.append(completablefuture, (filteredtext) -> {
@@ -1298,7 +1755,7 @@
this.broadcastChatMessage(playerchatmessage1);
});
- });
+ // }); // CraftBukkit - async chat
}
}
@@ -1289,6 +1745,12 @@
@@ -1313,6 +1770,12 @@
if (optional.isPresent()) {
this.server.submit(() -> {
@@ -844,7 +851,7 @@
this.performChatCommand(serverboundchatcommandpacket, (LastSeenMessages) optional.get());
this.detectRateSpam();
});
@@ -1298,12 +1760,25 @@
@@ -1322,12 +1785,25 @@
}
private void performChatCommand(ServerboundChatCommandPacket serverboundchatcommandpacket, LastSeenMessages lastseenmessages) {
@@ -872,7 +879,7 @@
} catch (SignedMessageChain.a signedmessagechain_a) {
this.handleMessageDecodeFailure(signedmessagechain_a);
return;
@@ -1311,10 +1786,10 @@
@@ -1335,10 +1811,10 @@
CommandSigningContext.a commandsigningcontext_a = new CommandSigningContext.a(map);
@@ -885,16 +892,16 @@
}
private void handleMessageDecodeFailure(SignedMessageChain.a signedmessagechain_a) {
@@ -1355,7 +1830,7 @@
} else {
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(lastseenmessages_b);
@@ -1375,7 +1851,7 @@
private Optional<LastSeenMessages> tryHandleChat(LastSeenMessages.b lastseenmessages_b) {
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(lastseenmessages_b);
- if (this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) {
+ if (this.player.isRemoved() || this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) { // CraftBukkit - dead men tell no tales
this.send(new ClientboundSystemChatPacket(IChatBaseComponent.translatable("chat.disabled.options").withStyle(EnumChatFormat.RED), false));
return Optional.empty();
} else {
@@ -1403,6 +1878,116 @@
- if (this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) {
+ if (this.player.isRemoved() || this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) { // CraftBukkit - dead men tell no tales
this.send(new ClientboundSystemChatPacket(IChatBaseComponent.translatable("chat.disabled.options").withStyle(EnumChatFormat.RED), false));
return Optional.empty();
} else {
@@ -1409,6 +1885,116 @@
return false;
}
@@ -1011,7 +1018,7 @@
private PlayerChatMessage getSignedMessage(PacketPlayInChat packetplayinchat, LastSeenMessages lastseenmessages) throws SignedMessageChain.a {
SignedMessageBody signedmessagebody = new SignedMessageBody(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.salt(), lastseenmessages);
@@ -1410,13 +1995,33 @@
@@ -1416,13 +2002,33 @@
}
private void broadcastChatMessage(PlayerChatMessage playerchatmessage) {
@@ -1048,7 +1055,7 @@
this.disconnect(IChatBaseComponent.translatable("disconnect.spam"));
}
@@ -1438,13 +2043,62 @@
@@ -1444,13 +2050,62 @@
@Override
public void handleAnimate(PacketPlayInArmAnimation packetplayinarmanimation) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinarmanimation, this, this.player.serverLevel());
@@ -1111,7 +1118,7 @@
this.player.resetLastActionTime();
Entity entity;
IJumpable ijumpable;
@@ -1526,6 +2180,12 @@
@@ -1532,6 +2187,12 @@
}
public void sendPlayerChatMessage(PlayerChatMessage playerchatmessage, ChatMessageType.a chatmessagetype_a) {
@@ -1124,7 +1131,7 @@
this.send(new ClientboundPlayerChatPacket(playerchatmessage.link().sender(), playerchatmessage.link().index(), playerchatmessage.signature(), playerchatmessage.signedBody().pack(this.messageSignatureCache), playerchatmessage.unsignedContent(), playerchatmessage.filterMask(), chatmessagetype_a.toNetwork(this.player.level().registryAccess())));
this.addPendingMessage(playerchatmessage);
}
@@ -1552,6 +2212,7 @@
@@ -1558,6 +2219,7 @@
@Override
public void handleInteract(PacketPlayInUseEntity packetplayinuseentity) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseentity, this, this.player.serverLevel());
@@ -1132,7 +1139,7 @@
final WorldServer worldserver = this.player.serverLevel();
final Entity entity = packetplayinuseentity.getTarget(worldserver);
@@ -1566,13 +2227,51 @@
@@ -1572,13 +2234,51 @@
if (axisalignedbb.distanceToSqr(this.player.getEyePosition()) < PlayerConnection.MAX_INTERACTION_DISTANCE) {
packetplayinuseentity.dispatch(new PacketPlayInUseEntity.c() {
@@ -1185,7 +1192,7 @@
if (enuminteractionresult.consumesAction()) {
CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(PlayerConnection.this.player, itemstack1, entity);
if (enuminteractionresult.shouldSwing()) {
@@ -1585,23 +2284,29 @@
@@ -1591,23 +2291,29 @@
@Override
public void onInteraction(EnumHand enumhand) {
@@ -1218,7 +1225,7 @@
}
} else {
PlayerConnection.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.invalid_entity_attacked"));
@@ -1624,14 +2329,14 @@
@@ -1630,14 +2336,14 @@
case PERFORM_RESPAWN:
if (this.player.wonGame) {
this.player.wonGame = false;
@@ -1235,7 +1242,7 @@
if (this.server.isHardcore()) {
this.player.setGameMode(EnumGamemode.SPECTATOR);
((GameRules.GameRuleBoolean) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server);
@@ -1647,15 +2352,21 @@
@@ -1653,15 +2359,21 @@
@Override
public void handleContainerClose(PacketPlayInCloseWindow packetplayinclosewindow) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.serverLevel());
@@ -1259,7 +1266,7 @@
this.player.containerMenu.sendAllDataToRemote();
} else if (!this.player.containerMenu.stillValid(this.player)) {
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
@@ -1668,7 +2379,284 @@
@@ -1674,7 +2386,284 @@
boolean flag = packetplayinwindowclick.getStateId() != this.player.containerMenu.getStateId();
this.player.containerMenu.suppressRemoteUpdates();
@@ -1545,7 +1552,7 @@
ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packetplayinwindowclick.getChangedSlots()).iterator();
while (objectiterator.hasNext()) {
@@ -1698,9 +2686,18 @@
@@ -1704,9 +2693,18 @@
if (!this.player.containerMenu.stillValid(this.player)) {
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
} else {
@@ -1566,7 +1573,7 @@
}
}
}
@@ -1708,6 +2705,7 @@
@@ -1714,6 +2712,7 @@
@Override
public void handleContainerButtonClick(PacketPlayInEnchantItem packetplayinenchantitem) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinenchantitem, this, this.player.serverLevel());
@@ -1574,7 +1581,7 @@
this.player.resetLastActionTime();
if (this.player.containerMenu.containerId == packetplayinenchantitem.getContainerId() && !this.player.isSpectator()) {
if (!this.player.containerMenu.stillValid(this.player)) {
@@ -1750,6 +2748,43 @@
@@ -1756,6 +2755,43 @@
boolean flag1 = packetplayinsetcreativeslot.getSlotNum() >= 1 && packetplayinsetcreativeslot.getSlotNum() <= 45;
boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
@@ -1618,7 +1625,7 @@
if (flag1 && flag2) {
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.getSlotNum()).setByPlayer(itemstack);
@@ -1772,6 +2807,7 @@
@@ -1778,6 +2814,7 @@
}
private void updateSignText(PacketPlayInUpdateSign packetplayinupdatesign, List<FilteredText> list) {
@@ -1626,7 +1633,7 @@
this.player.resetLastActionTime();
WorldServer worldserver = this.player.serverLevel();
BlockPosition blockposition = packetplayinupdatesign.getPos();
@@ -1793,7 +2829,17 @@
@@ -1799,7 +2836,17 @@
@Override
public void handlePlayerAbilities(PacketPlayInAbilities packetplayinabilities) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.serverLevel());
@@ -1645,7 +1652,7 @@
}
@Override
@@ -1852,7 +2898,7 @@
@@ -1858,7 +2905,7 @@
if (!this.waitingForSwitchToConfig) {
throw new IllegalStateException("Client acknowledged config, but none was requested");
} else {