Update to Minecraft 1.17.1

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-07-07 00:00:00 +10:00
parent 0392f45e9c
commit e8c9836ec9
59 changed files with 428 additions and 492 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/network/PlayerConnection.java
+++ b/net/minecraft/server/network/PlayerConnection.java
@@ -158,6 +158,62 @@
@@ -157,6 +157,62 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -63,7 +63,7 @@
public class PlayerConnection implements ServerPlayerConnection, PacketListenerPlayIn {
static final Logger LOGGER = LogManager.getLogger();
@@ -169,7 +225,9 @@
@@ -168,7 +224,9 @@
private long keepAliveTime;
private boolean keepAlivePending;
private long keepAliveChallenge;
@@ -74,7 +74,7 @@
private int dropSpamTickCount;
private double firstGoodX;
private double firstGoodY;
@@ -203,7 +261,33 @@
@@ -202,7 +260,33 @@
this.player = entityplayer;
entityplayer.connection = this;
entityplayer.Q().a();
@@ -108,7 +108,7 @@
public void tick() {
this.syncPosition();
@@ -252,7 +336,7 @@
@@ -251,7 +335,7 @@
this.server.getMethodProfiler().enter("keepAlive");
long i = SystemUtils.getMonotonicMillis();
@@ -117,7 +117,7 @@
if (this.keepAlivePending) {
this.disconnect(new ChatMessage("disconnect.timeout"));
} else {
@@ -264,15 +348,21 @@
@@ -263,15 +347,21 @@
}
this.server.getMethodProfiler().exit();
@@ -139,7 +139,7 @@
this.disconnect(new ChatMessage("multiplayer.disconnect.idling"));
}
@@ -296,16 +386,46 @@
@@ -295,16 +385,46 @@
return this.server.a(this.player.getProfile());
}
@@ -187,7 +187,7 @@
}
private <T, R> void a(T t0, Consumer<R> consumer, BiFunction<ITextFilter, T, CompletableFuture<R>> bifunction) {
@@ -323,11 +443,11 @@
@@ -322,11 +442,11 @@
}
private void a(String s, Consumer<ITextFilter.a> consumer) {
@@ -201,7 +201,7 @@
}
@Override
@@ -372,7 +492,34 @@
@@ -371,7 +491,34 @@
double d9 = entity.getMot().g();
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
@@ -237,7 +237,7 @@
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), d6, d7, d8);
this.connection.sendPacket(new PacketPlayOutVehicleMove(entity));
return;
@@ -402,14 +549,72 @@
@@ -401,14 +548,72 @@
}
entity.setLocation(d3, d4, d5, f, f1);
@@ -310,7 +310,7 @@
this.player.getWorldServer().getChunkProvider().movePlayer(this.player);
this.player.checkMovement(this.player.locX() - d0, this.player.locY() - d1, this.player.locZ() - d2);
this.clientVehicleIsFloating = d11 >= -0.03125D && !this.server.getAllowFlight() && this.a(entity);
@@ -428,7 +633,7 @@
@@ -427,7 +632,7 @@
@Override
public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) {
PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.getWorldServer());
@@ -319,7 +319,7 @@
this.player.setLocation(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
this.lastGoodX = this.awaitingPositionFromClient.x;
this.lastGoodY = this.awaitingPositionFromClient.y;
@@ -438,6 +643,7 @@
@@ -437,6 +642,7 @@
}
this.awaitingPositionFromClient = null;
@@ -327,7 +327,7 @@
}
}
@@ -445,7 +651,7 @@
@@ -444,7 +650,7 @@
@Override
public void a(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
PlayerConnectionUtils.ensureMainThread(packetplayinrecipedisplayed, this, this.player.getWorldServer());
@@ -336,7 +336,7 @@
RecipeBookServer recipebookserver = this.player.getRecipeBook();
Objects.requireNonNull(recipebookserver);
@@ -475,6 +681,12 @@
@@ -474,6 +680,12 @@
@Override
public void a(PacketPlayInTabComplete packetplayintabcomplete) {
PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer());
@@ -349,7 +349,7 @@
StringReader stringreader = new StringReader(packetplayintabcomplete.c());
if (stringreader.canRead() && stringreader.peek() == '/') {
@@ -484,6 +696,7 @@
@@ -483,6 +695,7 @@
ParseResults<CommandListenerWrapper> parseresults = this.server.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener());
this.server.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
@@ -357,7 +357,7 @@
this.connection.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions));
});
}
@@ -716,6 +929,7 @@
@@ -715,6 +928,7 @@
if (container instanceof ContainerMerchant) {
ContainerMerchant containermerchant = (ContainerMerchant) container;
@@ -365,7 +365,7 @@
containermerchant.d(i);
containermerchant.g(i);
@@ -725,6 +939,13 @@
@@ -724,6 +938,13 @@
@Override
public void a(PacketPlayInBEdit packetplayinbedit) {
@@ -379,7 +379,16 @@
int i = packetplayinbedit.d();
if (PlayerInventory.d(i) || i == 40) {
@@ -761,7 +982,7 @@
@@ -732,7 +953,7 @@
Objects.requireNonNull(list);
optional.ifPresent(list::add);
- Stream stream = packetplayinbedit.b().stream().limit(100L);
+ Stream<String> stream = packetplayinbedit.b().stream().limit(100L); // CraftBukkit - decompile error
Objects.requireNonNull(list);
stream.forEach(list::add);
@@ -748,7 +969,7 @@
ItemStack itemstack = this.player.getInventory().getItem(i);
if (itemstack.a(Items.WRITABLE_BOOK)) {
@@ -388,7 +397,7 @@
}
}
@@ -786,16 +1007,16 @@
@@ -773,16 +994,16 @@
this.a(list, (s) -> {
return IChatBaseComponent.ChatSerializer.a((IChatBaseComponent) (new ChatComponentText(s)));
@@ -409,7 +418,7 @@
return NBTTagString.a((String) unaryoperator.apply(itextfilter_a.b()));
});
@@ -823,6 +1044,7 @@
@@ -810,6 +1031,7 @@
}
itemstack.a("pages", (NBTBase) nbttaglist);
@@ -417,7 +426,7 @@
}
@Override
@@ -859,7 +1081,7 @@
@@ -846,7 +1068,7 @@
} else {
WorldServer worldserver = this.player.getWorldServer();
@@ -426,7 +435,7 @@
if (this.tickCount == 0) {
this.syncPosition();
}
@@ -869,7 +1091,7 @@
@@ -856,7 +1078,7 @@
this.awaitingTeleportTime = this.tickCount;
this.b(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
}
@@ -435,7 +444,7 @@
} else {
this.awaitingTeleportTime = this.tickCount;
double d0 = a(packetplayinflying.a(this.player.locX()));
@@ -881,7 +1103,15 @@
@@ -868,7 +1090,15 @@
if (this.player.isPassenger()) {
this.player.setLocation(this.player.locX(), this.player.locY(), this.player.locZ(), f, f1);
this.player.getWorldServer().getChunkProvider().movePlayer(this.player);
@@ -451,7 +460,7 @@
double d3 = this.player.locX();
double d4 = this.player.locY();
double d5 = this.player.locZ();
@@ -901,15 +1131,33 @@
@@ -888,15 +1118,33 @@
++this.receivedMovePacketCount;
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
@@ -487,7 +496,7 @@
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getDisplayName().getString(), d7, d8, d9);
this.b(this.player.locX(), this.player.locY(), this.player.locZ(), this.player.getYRot(), this.player.getXRot());
return;
@@ -928,6 +1176,7 @@
@@ -915,6 +1163,7 @@
}
this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9));
@@ -495,7 +504,7 @@
double d12 = d8;
d7 = d0 - this.player.locX();
@@ -949,10 +1198,74 @@
@@ -936,10 +1185,74 @@
if (!this.player.noPhysics && !this.player.isSleeping() && (flag1 && worldserver.getCubes(this.player, axisalignedbb) || this.a((IWorldReader) worldserver, axisalignedbb))) {
this.b(d3, d4, d5, f, f1);
} else {
@@ -572,7 +581,7 @@
if (flag) {
this.player.fallDistance = 0.0F;
}
@@ -980,19 +1293,80 @@
@@ -967,19 +1280,80 @@
});
}
@@ -657,7 +666,7 @@
double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.locX() : 0.0D;
double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY() : 0.0D;
double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.locZ() : 0.0D;
@@ -1004,6 +1378,14 @@
@@ -991,6 +1365,14 @@
this.awaitingTeleport = 0;
}
@@ -672,7 +681,7 @@
this.awaitingTeleportTime = this.tickCount;
this.player.setLocation(d0, d1, d2, f, f1);
this.player.connection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport, flag));
@@ -1012,6 +1394,7 @@
@@ -999,6 +1381,7 @@
@Override
public void a(PacketPlayInBlockDig packetplayinblockdig) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer());
@@ -680,7 +689,7 @@
BlockPosition blockposition = packetplayinblockdig.b();
this.player.resetIdleTimer();
@@ -1022,14 +1405,46 @@
@@ -1009,14 +1392,46 @@
if (!this.player.isSpectator()) {
ItemStack itemstack = this.player.b(EnumHand.OFF_HAND);
@@ -729,7 +738,7 @@
this.player.dropItem(false);
}
@@ -1066,6 +1481,7 @@
@@ -1053,6 +1468,7 @@
@Override
public void a(PacketPlayInUseItem packetplayinuseitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinuseitem, this, this.player.getWorldServer());
@@ -737,7 +746,7 @@
WorldServer worldserver = this.player.getWorldServer();
EnumHand enumhand = packetplayinuseitem.b();
ItemStack itemstack = this.player.b(enumhand);
@@ -1078,6 +1494,14 @@
@@ -1065,6 +1481,14 @@
if (blockposition.getY() < i) {
if (this.awaitingPositionFromClient == null && this.player.h((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.a((EntityHuman) this.player, blockposition)) {
@@ -752,7 +761,7 @@
EnumInteractionResult enuminteractionresult = this.player.gameMode.a(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
if (enumdirection == EnumDirection.UP && !enuminteractionresult.a() && blockposition.getY() >= i - 1 && a(this.player, itemstack)) {
@@ -1101,12 +1525,51 @@
@@ -1088,12 +1512,51 @@
@Override
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.getWorldServer());
@@ -804,7 +813,7 @@
EnumInteractionResult enuminteractionresult = this.player.gameMode.a(this.player, worldserver, itemstack, enumhand);
if (enuminteractionresult.b()) {
@@ -1127,7 +1590,7 @@
@@ -1114,7 +1577,7 @@
Entity entity = packetplayinspectate.a(worldserver);
if (entity != null) {
@@ -813,7 +822,7 @@
return;
}
}
@@ -1142,6 +1605,7 @@
@@ -1129,6 +1592,7 @@
PlayerConnection.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getDisplayName());
this.disconnect(new ChatMessage("multiplayer.requiredTexturePrompt.disconnect"));
}
@@ -821,7 +830,7 @@
}
@@ -1161,11 +1625,26 @@
@@ -1148,11 +1612,26 @@
@Override
public void a(IChatBaseComponent ichatbasecomponent) {
@@ -849,7 +858,7 @@
this.player.Q().b();
if (this.isExemptPlayer()) {
PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out");
@@ -1180,6 +1659,15 @@
@@ -1167,6 +1646,15 @@
}
public void a(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) {
@@ -865,7 +874,7 @@
try {
this.connection.sendPacket(packet, genericfuturelistener);
} catch (Throwable throwable) {
@@ -1196,7 +1684,16 @@
@@ -1183,7 +1671,16 @@
@Override
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer());
@@ -882,7 +891,7 @@
if (this.player.getInventory().selected != packetplayinhelditemslot.b() && this.player.getRaisedHand() == EnumHand.MAIN_HAND) {
this.player.clearActiveItem();
}
@@ -1205,11 +1702,18 @@
@@ -1192,11 +1689,18 @@
this.player.resetIdleTimer();
} else {
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getDisplayName().getString());
@@ -901,7 +910,7 @@
String s = StringUtils.normalizeSpace(packetplayinchat.b());
for (int i = 0; i < s.length(); ++i) {
@@ -1223,20 +1727,42 @@
@@ -1210,20 +1714,42 @@
PlayerConnectionUtils.ensureMainThread(packetplayinchat, this, this.player.getWorldServer());
this.a(ITextFilter.a.a(s));
} else {
@@ -948,7 +957,7 @@
} else {
String s1 = itextfilter_a.b();
ChatMessage chatmessage = s1.isEmpty() ? null : new ChatMessage("chat.type.text", new Object[]{this.player.getScoreboardDisplayName(), s1});
@@ -1247,28 +1773,198 @@
@@ -1234,28 +1760,198 @@
}, ChatMessageType.CHAT, this.player.getUniqueID());
}
@@ -1151,7 +1160,7 @@
this.player.resetIdleTimer();
IJumpable ijumpable;
@@ -1326,6 +2022,7 @@
@@ -1313,6 +2009,7 @@
@Override
public void a(PacketPlayInUseEntity packetplayinuseentity) {
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.getWorldServer());
@@ -1159,7 +1168,7 @@
WorldServer worldserver = this.player.getWorldServer();
final Entity entity = packetplayinuseentity.a(worldserver);
@@ -1336,10 +2033,44 @@
@@ -1323,10 +2020,44 @@
if (this.player.f(entity) < 36.0D) {
packetplayinuseentity.a(new PacketPlayInUseEntity.c() {
@@ -1205,7 +1214,7 @@
if (enuminteractionresult.a()) {
CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.a(PlayerConnection.this.player, itemstack, entity);
if (enuminteractionresult.b()) {
@@ -1351,20 +2082,27 @@
@@ -1338,20 +2069,27 @@
@Override
public void a(EnumHand enumhand) {
@@ -1236,7 +1245,7 @@
} else {
PlayerConnection.this.disconnect(new ChatMessage("multiplayer.disconnect.invalid_entity_attacked"));
PlayerConnection.LOGGER.warn("Player {} tried to attack an invalid entity", PlayerConnection.this.player.getDisplayName().getString());
@@ -1409,19 +2147,302 @@
@@ -1396,21 +2134,304 @@
@Override
public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer());
@@ -1259,7 +1268,9 @@
+ if (false/*this.player.isSpectator()*/) { // CraftBukkit
this.player.containerMenu.updateInventory();
} else {
this.player.containerMenu.g();
boolean flag = packetplayinwindowclick.h() != this.player.containerMenu.getStateId();
this.player.containerMenu.h();
- this.player.containerMenu.a(packetplayinwindowclick.c(), packetplayinwindowclick.d(), packetplayinwindowclick.g(), this.player);
+ // CraftBukkit start - Call InventoryClickEvent
+ if (packetplayinwindowclick.c() < -1 && packetplayinwindowclick.c() != -999) {
@@ -1512,19 +1523,19 @@
+ case PLACE_SOME:
+ case PLACE_ONE:
+ case SWAP_WITH_CURSOR:
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.containerMenu.getCarried()));
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(this.player.containerMenu.containerId, packetplayinwindowclick.c(), this.player.containerMenu.getSlot(packetplayinwindowclick.c()).getItem()));
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.inventoryMenu.incrementStateId(), this.player.containerMenu.getCarried()));
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(this.player.containerMenu.containerId, this.player.inventoryMenu.incrementStateId(), packetplayinwindowclick.c(), this.player.containerMenu.getSlot(packetplayinwindowclick.c()).getItem()));
+ break;
+ // Modified clicked only
+ case DROP_ALL_SLOT:
+ case DROP_ONE_SLOT:
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(this.player.containerMenu.containerId, packetplayinwindowclick.c(), this.player.containerMenu.getSlot(packetplayinwindowclick.c()).getItem()));
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(this.player.containerMenu.containerId, this.player.inventoryMenu.incrementStateId(), packetplayinwindowclick.c(), this.player.containerMenu.getSlot(packetplayinwindowclick.c()).getItem()));
+ break;
+ // Modified cursor only
+ case DROP_ALL_CURSOR:
+ case DROP_ONE_CURSOR:
+ case CLONE_STACK:
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.containerMenu.getCarried()));
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.inventoryMenu.incrementStateId(), this.player.containerMenu.getCarried()));
+ break;
+ // Nothing
+ case NOTHING:
@@ -1542,7 +1553,7 @@
ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packetplayinwindowclick.f()).iterator();
while (objectiterator.hasNext()) {
@@ -1452,6 +2473,7 @@
@@ -1445,6 +2466,7 @@
@Override
public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer());
@@ -1550,7 +1561,7 @@
this.player.resetIdleTimer();
if (this.player.containerMenu.containerId == packetplayinenchantitem.b() && !this.player.isSpectator()) {
this.player.containerMenu.a((EntityHuman) this.player, packetplayinenchantitem.c());
@@ -1484,6 +2506,43 @@
@@ -1477,6 +2499,43 @@
boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45;
boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
@@ -1584,8 +1595,8 @@
+ case DENY:
+ // Reset the slot
+ if (packetplayinsetcreativeslot.b() >= 0) {
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(this.player.inventoryMenu.containerId, packetplayinsetcreativeslot.b(), this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.b()).getItem()));
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, ItemStack.EMPTY));
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(this.player.inventoryMenu.containerId, this.player.inventoryMenu.incrementStateId(), packetplayinsetcreativeslot.b(), this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.b()).getItem()));
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, this.player.inventoryMenu.incrementStateId(), -1, ItemStack.EMPTY));
+ }
+ return;
+ }
@@ -1593,8 +1604,8 @@
+ // CraftBukkit end
if (flag1 && flag2) {
if (itemstack.isEmpty()) {
@@ -1511,6 +2570,7 @@
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.b()).set(itemstack);
@@ -1499,6 +2558,7 @@
}
private void a(PacketPlayInUpdateSign packetplayinupdatesign, List<ITextFilter.a> list) {
@@ -1602,7 +1613,7 @@
this.player.resetIdleTimer();
WorldServer worldserver = this.player.getWorldServer();
BlockPosition blockposition = packetplayinupdatesign.b();
@@ -1527,18 +2587,37 @@
@@ -1515,18 +2575,37 @@
if (!tileentitysign.d() || !this.player.getUniqueID().equals(tileentitysign.f())) {
PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getDisplayName().getString());
@@ -1642,7 +1653,7 @@
tileentitysign.update();
worldserver.notify(blockposition, iblockdata, iblockdata, 3);
@@ -1548,6 +2627,7 @@
@@ -1536,6 +2615,7 @@
@Override
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
@@ -1650,7 +1661,7 @@
if (this.keepAlivePending && packetplayinkeepalive.b() == this.keepAliveChallenge) {
int i = (int) (SystemUtils.getMonotonicMillis() - this.keepAliveTime);
@@ -1562,7 +2642,17 @@
@@ -1550,7 +2630,17 @@
@Override
public void a(PacketPlayInAbilities packetplayinabilities) {
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer());
@@ -1669,7 +1680,7 @@
}
@Override
@@ -1571,8 +2661,50 @@
@@ -1559,8 +2649,50 @@
this.player.a(packetplayinsettings);
}