Updated Upstream (Paper)

Upstream has released updates that appear to apply and compile correctly

Paper Changes:
a219c497bd Dont register multiple ASK_SERVER suggestions under one parent node (#7188)
329912b816 Expose isFuel and canSmelt methods to FurnaceInventory (#7181)
7b833ca18f Fix bees aging inside hives (#6466)
a99a33cdd9 Bucketable API (#7204)
721f14842f [ci skip] Change test logging settings to log by default (#7203)
2d458ee14f Check player world in endPortalSoundRadius (#6226)
686bbd33d4 Fix EntityLoadCrossbowEvent Sync Issue (#5739)
64f9225c94 Fix riding distance statistics (#7021/SPIGOT-6475) (#7033)
This commit is contained in:
BillyGalbreath
2021-12-31 05:35:42 -06:00
parent 3607ed47ad
commit ce115a0bfc
18 changed files with 35 additions and 290 deletions

View File

@@ -4,7 +4,7 @@ version = 1.18.1-R0.1-SNAPSHOT
mcVersion = 1.18.1
packageVersion = 1_18_R1
paperCommit = 6852c657cd09ed0d722df0437c2fed13f549c30f
paperCommit = 64f9225c94f3cd1b7793cb5234fa78423f222f23
org.gradle.caching = true
org.gradle.parallel = true

View File

@@ -1,35 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Thu, 23 Dec 2021 15:32:40 -0600
Subject: [PATCH] Expose isFuel and canSmelt methods to FurnaceInventory
diff --git a/src/main/java/org/bukkit/inventory/FurnaceInventory.java b/src/main/java/org/bukkit/inventory/FurnaceInventory.java
index 3f46259c1e0f82941ffc3038d1b51be199114abd..b9d4f05980d924a4831b1d213d4963199f5b9a5d 100644
--- a/src/main/java/org/bukkit/inventory/FurnaceInventory.java
+++ b/src/main/java/org/bukkit/inventory/FurnaceInventory.java
@@ -53,6 +53,24 @@ public interface FurnaceInventory extends Inventory {
*/
void setSmelting(@Nullable ItemStack stack);
+ // Paper start
+ /**
+ * Check if an item can be used as a fuel source in this furnace container
+ *
+ * @param item Item to check
+ * @return True if a valid fuel source
+ */
+ public boolean isFuel(@Nullable ItemStack item);
+
+ /**
+ * Check if an item can be smelted in this furnace container
+ *
+ * @param item Item to check
+ * @return True if can be smelt
+ */
+ public boolean canSmelt(@Nullable ItemStack item);
+ // Paper end
+
@Override
@Nullable
Furnace getHolder();

View File

@@ -17,10 +17,10 @@ index 7b23535a680d2a8534dcb8dd87770f66fb982c13..4b842e78d3e8fbca90f5f3d975bee654
public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b9e0dc98243bee3de7eb291dd3fb25049c0a8f2b..30c6df3fa13c3fb44e1fe5833fe0aaad236b0a82 100644
index 3c7e3d5b06409bf2e98a35d678564f0e477481a9..2e60ee66d091f01128c6467b02d0791726b5813a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3128,6 +3128,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3141,6 +3141,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
private static final ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support
@@ -28,7 +28,7 @@ index b9e0dc98243bee3de7eb291dd3fb25049c0a8f2b..30c6df3fa13c3fb44e1fe5833fe0aaad
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
@@ -3152,6 +3153,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3165,6 +3166,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
}

View File

@@ -73,10 +73,10 @@ index c516ad43cac2419bcf63e11eaa183785b462de5c..618595add09eef5381307ba2fe154adf
+
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 30c6df3fa13c3fb44e1fe5833fe0aaad236b0a82..28d5d52a9e2bbed40918be2e6641886a64919756 100644
index 2e60ee66d091f01128c6467b02d0791726b5813a..ff01b193a1f2372bc79bd864a689a6b36d53b4b8 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2439,6 +2439,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2452,6 +2452,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
ServerGamePacketListenerImpl.this.cserver.getPluginManager().callEvent(event);
@@ -4507,7 +4507,7 @@ index 642279bb7e15db9f662094ffd6ded2e3c7af3fd6..ab648e7dafd78f414646cef96b422e87
this.setTradingPlayer(player);
this.openTradingScreen(player, this.getDisplayName(), 1);
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 2c00a766130a7f682fc6c4c74321e10637ca7932..7eae138f3bbddd44c078b2fbcb5d5fd07d5bd9aa 100644
index 570d2325997e2465a8e17803ea882bc07ca64c38..957808b534592fd50cac78d2209a38c37950cb22 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -191,6 +191,19 @@ public abstract class Player extends LivingEntity {

View File

@@ -68,7 +68,7 @@ index 618595add09eef5381307ba2fe154adfc97b2a0e..100d01814aca6cbb26c721f55851df27
return this.stats;
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7aebd080238d7d0f789468c900e15a18f8cfb128..c170d014dc21d2ea94097a4d9c200bcac3896b62 100644
index ff01b193a1f2372bc79bd864a689a6b36d53b4b8..5267750302a16b43ec1ac5563322b798496234c8 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -294,6 +294,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -105,7 +105,7 @@ index 7aebd080238d7d0f789468c900e15a18f8cfb128..c170d014dc21d2ea94097a4d9c200bca
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
this.disconnect(new TranslatableComponent("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
}
@@ -662,6 +682,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -675,6 +695,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.lastYaw = to.getYaw();
this.lastPitch = to.getPitch();
@@ -114,7 +114,7 @@ index 7aebd080238d7d0f789468c900e15a18f8cfb128..c170d014dc21d2ea94097a4d9c200bca
// Skip the first time we do this
if (true) { // Spigot - don't skip any move events
Location oldTo = to.clone();
@@ -1425,7 +1447,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1438,7 +1460,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (!this.player.isChangingDimension() && d11 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot
flag1 = true; // Paper - diff on change, this should be moved wrongly
@@ -123,7 +123,7 @@ index 7aebd080238d7d0f789468c900e15a18f8cfb128..c170d014dc21d2ea94097a4d9c200bca
}
this.player.absMoveTo(d0, d1, d2, f, f1);
@@ -1475,6 +1497,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1488,6 +1510,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.lastYaw = to.getYaw();
this.lastPitch = to.getPitch();
@@ -182,7 +182,7 @@ index a7575b5ef56af6f53448d391abb4956e130148ca..0a9e4dc5d6d567605c587df9bcbb57d3
if (baseEntity == null) {
if (this.isCombat && (!targetEntity.canBeSeenAsEnemy() || targetEntity.level.getDifficulty() == Difficulty.PEACEFUL)) {
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 7eae138f3bbddd44c078b2fbcb5d5fd07d5bd9aa..46932d899db4050e6f7e55caaced409663330446 100644
index 957808b534592fd50cac78d2209a38c37950cb22..aad9de4019015ca42ad5509886ca35315aeb30d9 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -194,6 +194,13 @@ public abstract class Player extends LivingEntity {

View File

@@ -82,10 +82,10 @@ index 100d01814aca6cbb26c721f55851df27dc654880..7d8853191eadf5f5d909dcc0269740d6
public Scoreboard getScoreboard() {
return this.getBukkitEntity().getScoreboard().getHandle();
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index a4a9ce9b506b7df714157bfb9c821012524d6cff..5ad5b6c90aedf6f0c7387055fa07ff46548ac32e 100644
index 5267750302a16b43ec1ac5563322b798496234c8..9a2920d61111fd9ff99424ea356a6b64b47eead5 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1949,12 +1949,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1962,12 +1962,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@Override
public void handleResourcePackResponse(ServerboundResourcePackPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Alternative Keepalive Handling
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 5ad5b6c90aedf6f0c7387055fa07ff46548ac32e..e50198e2bdf773dbb6297b31bac23d8c66431840 100644
index 9a2920d61111fd9ff99424ea356a6b64b47eead5..96f2beae139609535a4ff79809ece95d99d0f01a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -227,6 +227,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -38,7 +38,7 @@ index 5ad5b6c90aedf6f0c7387055fa07ff46548ac32e..e50198e2bdf773dbb6297b31bac23d8c
if (this.keepAlivePending) {
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
@@ -3120,6 +3136,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3133,6 +3149,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@Override
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Allow color codes in books
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index c2e849f37c03839631f621065bf52b4c649e06c5..449f28ae5b6a3572c35d3fe4647ab2b7cf44662b 100644
index 96f2beae139609535a4ff79809ece95d99d0f01a..cceeff0b32a5b2f9fd625b28cb64c4fc24130b5f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1219,13 +1219,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1232,13 +1232,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
itemstack1.setTag(nbttagcompound.copy());
}
@@ -28,7 +28,7 @@ index c2e849f37c03839631f621065bf52b4c649e06c5..449f28ae5b6a3572c35d3fe4647ab2b7
this.updateBookPages(pages, (s) -> {
return Component.Serializer.toJson(new TextComponent(s));
@@ -1237,10 +1240,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1250,10 +1253,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
private void updateBookPages(List<TextFilter.FilteredText> list, UnaryOperator<String> unaryoperator, ItemStack itemstack, int slot, ItemStack handItem) { // CraftBukkit
ListTag nbttaglist = new ListTag();
@@ -44,7 +44,7 @@ index c2e849f37c03839631f621065bf52b4c649e06c5..449f28ae5b6a3572c35d3fe4647ab2b7
Objects.requireNonNull(nbttaglist);
stream.forEach(nbttaglist::add);
@@ -1250,10 +1256,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1263,10 +1269,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
for (int j = list.size(); i < j; ++i) {
TextFilter.FilteredText itextfilter_a = (TextFilter.FilteredText) list.get(i);
@@ -57,7 +57,7 @@ index c2e849f37c03839631f621065bf52b4c649e06c5..449f28ae5b6a3572c35d3fe4647ab2b7
if (!s.equals(s1)) {
nbttagcompound.putString(String.valueOf(i), (String) unaryoperator.apply(s1));
@@ -1269,6 +1275,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1282,6 +1288,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.getInventory().setItem(slot, CraftEventFactory.handleEditBookEvent(player, slot, handItem, itemstack)); // CraftBukkit // Paper - Don't ignore result (see other callsite for handleEditBookEvent)
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] PlayerBookTooLargeEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 449f28ae5b6a3572c35d3fe4647ab2b7cf44662b..6d8a12b0d568f87ea7d8e38ba75e0544db5078e9 100644
index cceeff0b32a5b2f9fd625b28cb64c4fc24130b5f..e95c07f01730613f2df8a093b12e05b8d31a2409 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1141,10 +1141,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1154,10 +1154,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
int maxBookPageSize = com.destroystokyo.paper.PaperConfig.maxBookPageSize;
double multiplier = Math.max(0.3D, Math.min(1D, com.destroystokyo.paper.PaperConfig.maxBookTotalSizeMultiplier));
long byteAllowed = maxBookPageSize;
@@ -21,7 +21,7 @@ index 449f28ae5b6a3572c35d3fe4647ab2b7cf44662b..6d8a12b0d568f87ea7d8e38ba75e0544
server.scheduleOnMain(() -> this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
return;
}
@@ -1168,6 +1170,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1181,6 +1183,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (byteTotal > byteAllowed) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Dont run with scissors!
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 6d8a12b0d568f87ea7d8e38ba75e0544db5078e9..6772febede955704eba60d4e3a0ca4b60485e4ad 100644
index e95c07f01730613f2df8a093b12e05b8d31a2409..2cbef1eca4a7e95b00773415ccaca7741ed860c8 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1574,6 +1574,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1587,6 +1587,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.resetFallDistance();
}
@@ -22,7 +22,7 @@ index 6d8a12b0d568f87ea7d8e38ba75e0544db5078e9..6772febede955704eba60d4e3a0ca4b6
this.player.checkMovementStatistics(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5);
this.lastGoodX = this.player.getX();
this.lastGoodY = this.player.getY();
@@ -1607,6 +1614,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1620,6 +1627,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
// Paper end - optimise out extra getCubes
@@ -36,7 +36,7 @@ index 6d8a12b0d568f87ea7d8e38ba75e0544db5078e9..6772febede955704eba60d4e3a0ca4b6
Iterable<VoxelShape> iterable = world.getCollisions(this.player, this.player.getBoundingBox().deflate(9.999999747378752E-6D));
VoxelShape voxelshape = Shapes.create(box.deflate(9.999999747378752E-6D));
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 600b9e9bc6a9c92920c8ec28764e64dfc1fd6e3f..47eb362ba73bb20e738af6dea60e86ffe5492315 100644
index 574f01f5b31c5d8110e2e8a80ef61f4b794e3d21..05a7c307da51d31f822730b03c83db9873296e25 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -165,6 +165,7 @@ public class PurpurConfig {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Allow infinity on crossbows
diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java
index 288776d2c6e4d3f214152910e6c1ccdafa2c3fbd..e39f1241b19d3ce8b847c880a414bca89ec80356 100644
index c0c211c7227f4ce5d1e0e433419425e6bb13046f..9122ce42d8349aabe31ab2bb025813963c72b8e4 100644
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
@@ -111,7 +111,7 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
@@ -114,7 +114,7 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
// Paper end
int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MULTISHOT, projectile);
int j = i == 0 ? 1 : 3;
@@ -17,7 +17,7 @@ index 288776d2c6e4d3f214152910e6c1ccdafa2c3fbd..e39f1241b19d3ce8b847c880a414bca8
ItemStack itemstack1 = shooter.getProjectile(projectile);
ItemStack itemstack2 = itemstack1.copy();
@@ -302,7 +302,7 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
@@ -305,7 +305,7 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable {
for (int i = 0; i < list.size(); ++i) {
ItemStack itemstack1 = (ItemStack) list.get(i);

View File

@@ -36,10 +36,10 @@ index 61d0fcaf3c96a2b241b35b2b21104b9fbf403160..c5c7fd414953fb432549e46918fe7e32
+ // Purpur end
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8a670eedd94ba8fb5e741b4c0b17737d00f1fba0..64b9be7e6604a0be1838b6bf8cfa6a032ae045bc 100644
index 2cbef1eca4a7e95b00773415ccaca7741ed860c8..0174e5cdfa34ff63949b72e5452e0ae643dc29b1 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1945,6 +1945,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1958,6 +1958,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
boolean cancelled;
if (movingobjectposition == null || movingobjectposition.getType() != HitResult.Type.BLOCK) {

View File

@@ -17,10 +17,10 @@ index e2e83d8b39ddb154c0e69b63d5b996644926ac43..a9885f92e0a3494b27376a7a01edbd0e
this.connection.send(new ClientboundBlockUpdatePacket(this.level, sign.getBlockPos()));
this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos()));
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 64b9be7e6604a0be1838b6bf8cfa6a032ae045bc..5b574c9eaa16993e8ae6fc5c2d7235f226cbbbe0 100644
index 0174e5cdfa34ff63949b72e5452e0ae643dc29b1..f9f817198f4569c9acd39cec12729469364f9097 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3143,11 +3143,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3156,11 +3156,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
// Paper end

View File

@@ -1,32 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Thu, 23 Dec 2021 15:32:50 -0600
Subject: [PATCH] PaperPR - Expose isFuel and canSmelt methods to
FurnaceInventory
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java
index 05c29a788c96282fc18066ae253cf0b5be37e95c..e8e53d3c7d8b1bba7d77dc0c76d242eb177ad851 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryFurnace.java
@@ -40,6 +40,20 @@ public class CraftInventoryFurnace extends CraftInventory implements FurnaceInve
setItem(0, stack);
}
+ // Paper start
+ @Override
+ public boolean isFuel(ItemStack stack) {
+ return stack != null && !stack.getType().isEmpty() && AbstractFurnaceBlockEntity.isFuel(CraftItemStack.asNMSCopy(stack));
+ }
+
+ @Override
+ public boolean canSmelt(ItemStack stack) {
+ // data packs are always loaded in the main world
+ net.minecraft.server.level.ServerLevel world = ((org.bukkit.craftbukkit.CraftWorld) org.bukkit.Bukkit.getWorlds().get(0)).getHandle();
+ return stack != null && !stack.getType().isEmpty() && world.getRecipeManager().getRecipeFor(((AbstractFurnaceBlockEntity) this.inventory).recipeType, new net.minecraft.world.SimpleContainer(CraftItemStack.asNMSCopy(stack)), world).isPresent();
+ }
+ // Paper end
+
@Override
public Furnace getHolder() {
return (Furnace) inventory.getOwner();

View File

@@ -1,71 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 25 Dec 2021 01:33:00 -0600
Subject: [PATCH] PaperPR - Dont register multiple ASK_SERVER suggestions under
one parent node
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
index c20c7c9a6eb299e1a8d3d3e9bdf986ea282dd98a..0e0701eee1353859f7d746a9e9ae7aa995d5613e 100644
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
@@ -361,4 +361,21 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
return this.source.getBukkitSender(this);
}
// CraftBukkit end
+
+ // Paper start - override getSelectedEntities
+ @Override
+ public Collection<String> getSelectedEntities() {
+ if (com.destroystokyo.paper.PaperConfig.fixTargetSelectorTagCompletion && this.source instanceof ServerPlayer player) {
+ double pickDistance = player.gameMode.getGameModeForPlayer().isCreative() ? 5.0F : 4.5F;
+ Vec3 min = player.getEyePosition(1.0F);
+ Vec3 viewVector = player.getViewVector(1.0F);
+ Vec3 max = min.add(viewVector.x * pickDistance, viewVector.y * pickDistance, viewVector.z * pickDistance);
+ net.minecraft.world.phys.AABB aabb = player.getBoundingBox().expandTowards(viewVector.scale(pickDistance)).inflate(1.0D, 1.0D, 1.0D);
+ pickDistance = player.gameMode.getGameModeForPlayer().isCreative() ? 6.0F : pickDistance;
+ net.minecraft.world.phys.EntityHitResult hitResult = net.minecraft.world.entity.projectile.ProjectileUtil.getEntityHitResult(player, min, max, aabb, (e) -> !e.isSpectator() && e.isPickable(), pickDistance);
+ return hitResult != null ? java.util.Collections.singletonList(hitResult.getEntity().getStringUUID()) : SharedSuggestionProvider.super.getSelectedEntities();
+ }
+ return SharedSuggestionProvider.super.getSelectedEntities();
+ }
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index e61a05c91e6e567b9c5b99f460bd96ca4da6c4e8..2fe8500467ef90739921525750539b4a6436d0cf 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -414,7 +414,7 @@ public class Commands {
private void fillUsableCommands(CommandNode<CommandSourceStack> tree, CommandNode<SharedSuggestionProvider> result, CommandSourceStack source, Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> resultNodes) {
Iterator iterator = tree.getChildren().iterator();
-
+ boolean registeredAskServerSuggestionsForTree = false; // Paper - tell clients to ask server for suggestions for EntityArguments
while (iterator.hasNext()) {
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
if ( !org.spigotmc.SpigotConfig.sendNamespaced && commandnode2.getName().contains( ":" ) ) continue; // Spigot
@@ -436,6 +436,12 @@ public class Commands {
if (requiredargumentbuilder.getSuggestionsProvider() != null) {
requiredargumentbuilder.suggests(SuggestionProviders.safelySwap(requiredargumentbuilder.getSuggestionsProvider()));
+ // Paper start - tell clients to ask server for suggestions for EntityArguments
+ registeredAskServerSuggestionsForTree = requiredargumentbuilder.getSuggestionsProvider() == net.minecraft.commands.synchronization.SuggestionProviders.ASK_SERVER;
+ } else if (com.destroystokyo.paper.PaperConfig.fixTargetSelectorTagCompletion && !registeredAskServerSuggestionsForTree && requiredargumentbuilder.getType() instanceof net.minecraft.commands.arguments.EntityArgument) {
+ requiredargumentbuilder.suggests(requiredargumentbuilder.getType()::listSuggestions);
+ registeredAskServerSuggestionsForTree = true; // You can only
+ // Paper end - tell clients to ask server for suggestions for EntityArguments
}
}
@@ -460,11 +466,6 @@ public class Commands {
}
public static <T> RequiredArgumentBuilder<CommandSourceStack, T> argument(String name, ArgumentType<T> type) {
- // Paper start
- if (com.destroystokyo.paper.PaperConfig.fixTargetSelectorTagCompletion && type.getClass() == net.minecraft.commands.arguments.EntityArgument.class) {
- return RequiredArgumentBuilder.<CommandSourceStack, T>argument(name, type).suggests(type::listSuggestions);
- }
- // Paper end
return RequiredArgumentBuilder.argument(name, type);
}

View File

@@ -1,117 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Thu, 30 Dec 2021 09:56:43 -0600
Subject: [PATCH] Give bee counts in beehives to Purpur clients
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 58143bf03bd3314a4b7b40acb72e203aebce7fa6..149621028a3bc28d65cbd4c53baff36bb58df6e8 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1135,6 +1135,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void safeShutdown(boolean flag, boolean isRestarting) {
org.purpurmc.purpur.task.BossBarTask.stopAll(); // Purpur
+ org.purpurmc.purpur.task.BeehiveTask.instance().unregister(); // Purpur
this.isRestarting = isRestarting;
this.hasLoggedStop = true; // Paper
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 9412a238aa3538bf958cf3b5ce2be5a9beead90f..880902f068ca9d78d9263a9cf234c61d26e76a4c 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -380,6 +380,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
org.purpurmc.purpur.task.BossBarTask.startAll(); // Purpur
+ org.purpurmc.purpur.task.BeehiveTask.instance().register(); // Purpur
return true;
}
diff --git a/src/main/java/org/purpurmc/purpur/task/BeehiveTask.java b/src/main/java/org/purpurmc/purpur/task/BeehiveTask.java
new file mode 100644
index 0000000000000000000000000000000000000000..055dd307e9d5ac0d4623c961164c84bab1edd3bd
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/task/BeehiveTask.java
@@ -0,0 +1,81 @@
+package org.purpurmc.purpur.task;
+
+import com.google.common.io.ByteArrayDataInput;
+import com.google.common.io.ByteArrayDataOutput;
+import com.google.common.io.ByteStreams;
+import io.netty.buffer.Unpooled;
+import net.minecraft.core.BlockPos;
+import net.minecraft.network.FriendlyByteBuf;
+import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.server.level.ServerPlayer;
+import net.minecraft.world.level.block.entity.BeehiveBlockEntity;
+import net.minecraft.world.level.block.entity.BlockEntity;
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.bukkit.craftbukkit.scheduler.MinecraftInternalPlugin;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.PluginBase;
+import org.bukkit.plugin.messaging.PluginMessageListener;
+import org.jetbrains.annotations.NotNull;
+
+public class BeehiveTask implements PluginMessageListener {
+ public static final ResourceLocation BEEHIVE_C2S = new ResourceLocation("purpur", "beehive_c2s");
+ public static final ResourceLocation BEEHIVE_S2C = new ResourceLocation("purpur", "beehive_s2c");
+
+ private static BeehiveTask instance;
+
+ public static BeehiveTask instance() {
+ if (instance == null) {
+ instance = new BeehiveTask();
+ }
+ return instance;
+ }
+
+ private final PluginBase plugin = new MinecraftInternalPlugin();
+
+ private BeehiveTask() {
+ }
+
+ public void register() {
+ Bukkit.getMessenger().registerOutgoingPluginChannel(this.plugin, BEEHIVE_S2C.toString());
+ Bukkit.getMessenger().registerIncomingPluginChannel(this.plugin, BEEHIVE_C2S.toString(), this);
+ }
+
+ public void unregister() {
+ Bukkit.getMessenger().unregisterOutgoingPluginChannel(this.plugin, BEEHIVE_S2C.toString());
+ Bukkit.getMessenger().unregisterIncomingPluginChannel(this.plugin, BEEHIVE_C2S.toString());
+ }
+
+ @Override
+ public void onPluginMessageReceived(@NotNull String channel, Player player, byte[] bytes) {
+ ByteArrayDataInput in = in(bytes);
+ long packedPos = in.readLong();
+ BlockPos pos = BlockPos.of(packedPos);
+
+ ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle();
+
+ BlockEntity blockEntity = serverPlayer.level.getBlockEntity(pos);
+ if (!(blockEntity instanceof BeehiveBlockEntity beehive)) {
+ return;
+ }
+
+ ByteArrayDataOutput out = out();
+
+ out.writeInt(beehive.getOccupantCount());
+ out.writeLong(packedPos);
+
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.wrappedBuffer(out.toByteArray()));
+ serverPlayer.connection.send(new ClientboundCustomPayloadPacket(BEEHIVE_S2C, buf));
+ }
+
+ @SuppressWarnings("UnstableApiUsage")
+ private static ByteArrayDataOutput out() {
+ return ByteStreams.newDataOutput();
+ }
+
+ @SuppressWarnings("UnstableApiUsage")
+ private static ByteArrayDataInput in(byte[] bytes) {
+ return ByteStreams.newDataInput(bytes);
+ }
+}