Allow old views to continue updating its content to player pre interaction

This commit is contained in:
masmc05 2024-10-13 01:00:34 +03:00
parent 86cfb0435e
commit 6aafb11f5a
No known key found for this signature in database
GPG key ID: 9EC8F5B2CFD24E42

View file

@ -7,7 +7,7 @@ Subject: [PATCH] Fix and enhance openInventory(InventoryView)
public net.minecraft.world.inventory.HorseInventoryMenu horse
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 7dcfb45c24d7743956be514c7d554e06aac77b3e..c3ee999a4ec2f2256f53322be70b7878af870bb1 100644
index 7dcfb45c24d7743956be514c7d554e06aac77b3e..883130e8280c1c518cfb00198eba3c726a409003 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -436,6 +436,18 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@ -29,7 +29,7 @@ index 7dcfb45c24d7743956be514c7d554e06aac77b3e..c3ee999a4ec2f2256f53322be70b7878
Preconditions.checkArgument(this.equals(inventory.getPlayer()), "InventoryView must belong to the opening player");
if (!(this.getHandle() instanceof ServerPlayer)) return; // TODO: NPC support?
if (((ServerPlayer) this.getHandle()).connection == null) return;
@@ -461,14 +473,23 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@@ -461,14 +473,24 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
}
// Now open the window
@ -52,6 +52,7 @@ index 7dcfb45c24d7743956be514c7d554e06aac77b3e..c3ee999a4ec2f2256f53322be70b7878
+ player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title)));
+ }
+ }
+ container.resumeRemoteUpdates();
+ // Paper end - fix and enhance openInventory(InventoryView)
player.containerMenu = container;
player.initMenu(container);