geforkt von Mirrors/Paper
cfe3ad1b0f
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 45d9c73c SPIGOT-7043: EnderChest does not implement Lidded 86b95f34 SPIGOT-7047: Add Player#getLastDeathLocation CraftBukkit Changes: b2557f6ac SPIGOT-7041: Custom BiomeProvider not used when world set to type FLAT 732c50cab SPIGOT-7043: EnderChest does not implement Lidded 6209029ea SPIGOT-7048: addPassenger() not working when vehicle is player 3aa7836df SPIGOT-7047: Add Player#getLastDeathLocation 7d522cd26 SPIGOT-7050: Enchantment data of items will not be saved correctly when saved in YAML configuration file Spigot Changes: 1dffefb4 Rebuild patches
69 Zeilen
3.9 KiB
Diff
69 Zeilen
3.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Thu, 11 Mar 2021 03:03:32 -0800
|
|
Subject: [PATCH] Do not run close logic for inventories on chunk unload
|
|
|
|
Still call the event and change the active container though. We
|
|
want to avoid close logic because it's possible to load the
|
|
chunk through it. This should also be OK from a leak prevention/
|
|
state desync POV because the TE is getting unloaded anyways.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
index 5f35cfe1ab67cc77d4b7ad4e440bf1d4dc6642c6..3fc394d82217a273dad07b44cc18a66e1e3886c6 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -1333,9 +1333,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
// Spigot Start
|
|
for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) {
|
|
if (tileentity instanceof net.minecraft.world.Container) {
|
|
+ // Paper start - this area looks like it can load chunks, change the behavior
|
|
+ // chests for example can apply physics to the world
|
|
+ // so instead we just change the active container and call the event
|
|
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((net.minecraft.world.Container) tileentity).getViewers())) {
|
|
- h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper
|
|
+ ((org.bukkit.craftbukkit.entity.CraftHumanEntity)h).getHandle().closeUnloadedInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper
|
|
}
|
|
+ // Paper end
|
|
}
|
|
}
|
|
// Spigot End
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
index 157be83b74298b848a47436ab0fea9a04556a3ce..b98574dd173630e976177080613899400bef3552 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -1589,6 +1589,18 @@ public class ServerPlayer extends Player {
|
|
this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId));
|
|
this.doCloseContainer();
|
|
}
|
|
+ // Paper start - special close for unloaded inventory
|
|
+ @Override
|
|
+ public void closeUnloadedInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) {
|
|
+ // copied from above
|
|
+ CraftEventFactory.handleInventoryCloseEvent(this, reason); // CraftBukkit
|
|
+ // Paper end
|
|
+ // copied from below
|
|
+ this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId));
|
|
+ this.containerMenu = this.inventoryMenu;
|
|
+ // do not run close logic
|
|
+ }
|
|
+ // Paper end - special close for unloaded inventory
|
|
|
|
public void doCloseContainer() {
|
|
this.containerMenu.removed(this);
|
|
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 d6458ad451c9c7665f5ff0101962af4469029e2c..cd9cbfa5ef94994b3f7f2ecdde843620e7e6c071 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
@@ -505,6 +505,11 @@ public abstract class Player extends LivingEntity {
|
|
this.containerMenu = this.inventoryMenu;
|
|
}
|
|
// Paper end
|
|
+ // Paper start - special close for unloaded inventory
|
|
+ public void closeUnloadedInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) {
|
|
+ this.containerMenu = this.inventoryMenu;
|
|
+ }
|
|
+ // Paper end - special close for unloaded inventory
|
|
|
|
public void closeContainer() {
|
|
this.containerMenu = this.inventoryMenu;
|