mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 00:10:32 +01:00
bd38e0318a
Updated Upstream (Bukkit/CraftBukkit) 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: f02baa38 PR-988: Add World#getIntersectingChunks(BoundingBox) 9321d665 Move getItemInUse up to LivingEntity 819eef73 PR-959: Add access to current item's remaining ticks c4fdadb0 SPIGOT-7601: Add AbstractArrow#getItem be8261ca Add support for Java 22 26119676 PR-979: Add more translation keys 66753362 PR-985: Correct book maximum pages and characters per page documentation c8be92fa PR-980: Improve getArmorContents() documentation f1120ee2 PR-983: Expose riptide velocity to PlayerRiptideEvent CraftBukkit Changes: dfaa89bbe PR-1369: Add World#getIntersectingChunks(BoundingBox) 51bbab2b9 Move getItemInUse up to LivingEntity 668e09602 PR-1331: Add access to current item's remaining ticks a639406d1 SPIGOT-7601: Add AbstractArrow#getItem 0398930fc SPIGOT-7602: Allow opening in-world horse and related inventories ffd15611c SPIGOT-7608: Allow empty lists to morph to any PDT list 2188dcfa9 Add support for Java 22 45d6a609f SPIGOT-7604: Revert "SPIGOT-7365: DamageCause blocked by shield should trigger invulnerableTime" 06d915943 SPIGOT-7365: DamageCause blocked by shield should trigger invulnerableTime ca3bc3707 PR-1361: Add more translation keys 366c3ca80 SPIGOT-7600: EntityChangeBlockEvent is not fired for frog eggs 06d0f9ba8 SPIGOT-7593: Fix sapling growth physics / client-side updates 45c2608e4 PR-1366: Expose riptide velocity to PlayerRiptideEvent 29b6bb79b SPIGOT-7587: Remove fixes for now-resolved MC-142590 and MC-109346
62 lines
3.3 KiB
Diff
62 lines
3.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Wed, 15 Mar 2023 18:29:45 -0700
|
|
Subject: [PATCH] Fix inventories returning null Locations
|
|
|
|
Wandering Trader, AbstractHorse, Beacon and Composter inventories returned null locations
|
|
when a block or entity location is readily available
|
|
|
|
Co-authored-by: Lukas Planz <lukas.planz@web.de>
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/SimpleContainer.java b/src/main/java/net/minecraft/world/SimpleContainer.java
|
|
index d5eeb2fcb119b815213aeffb3811d4a843502e50..ff1aba1e69cfde633fd01724f1a8d0af7f59437f 100644
|
|
--- a/src/main/java/net/minecraft/world/SimpleContainer.java
|
|
+++ b/src/main/java/net/minecraft/world/SimpleContainer.java
|
|
@@ -63,6 +63,16 @@ public class SimpleContainer implements Container, StackedContentsCompatible {
|
|
|
|
@Override
|
|
public Location getLocation() {
|
|
+ // Paper start - Fix inventories returning null Locations
|
|
+ // When the block inventory does not have a tile state that implements getLocation, e. g. composters
|
|
+ if (this.bukkitOwner instanceof org.bukkit.inventory.BlockInventoryHolder blockInventoryHolder) {
|
|
+ return blockInventoryHolder.getBlock().getLocation();
|
|
+ }
|
|
+ // When the bukkit owner is a bukkit entity, but does not implement Container itself, e. g. horses
|
|
+ if (this.bukkitOwner instanceof org.bukkit.entity.Entity entity) {
|
|
+ return entity.getLocation();
|
|
+ }
|
|
+ // Paper end - Fix inventories returning null Locations
|
|
return null;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
|
index 9599a5f96601030bf7f7cbd3392861d626959f9d..2813a87a01d0704a3de210cd005073f953d538f8 100644
|
|
--- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
|
+++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
|
@@ -51,6 +51,12 @@ public class BeaconMenu extends AbstractContainerMenu {
|
|
public int getMaxStackSize() {
|
|
return 1;
|
|
}
|
|
+ // Paper start - Fix inventories returning null Locations
|
|
+ @Override
|
|
+ public org.bukkit.Location getLocation() {
|
|
+ return context.getLocation();
|
|
+ }
|
|
+ // Paper end - Fix inventories returning null Locations
|
|
};
|
|
checkContainerDataCount(propertyDelegate, 3);
|
|
this.beaconData = propertyDelegate;
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/MerchantContainer.java b/src/main/java/net/minecraft/world/inventory/MerchantContainer.java
|
|
index 083e50e27685f441ede4c75e913d671fe45d1d15..ac4ec7157cf93b0cbc4472dc42fbbbff3402335a 100644
|
|
--- a/src/main/java/net/minecraft/world/inventory/MerchantContainer.java
|
|
+++ b/src/main/java/net/minecraft/world/inventory/MerchantContainer.java
|
|
@@ -65,7 +65,7 @@ public class MerchantContainer implements Container {
|
|
|
|
@Override
|
|
public Location getLocation() {
|
|
- return (this.merchant instanceof Villager) ? ((Villager) this.merchant).getBukkitEntity().getLocation() : null;
|
|
+ return (this.merchant instanceof AbstractVillager) ? ((AbstractVillager) this.merchant).getBukkitEntity().getLocation() : null; // Paper - Fix inventories returning null Locations
|
|
}
|
|
// CraftBukkit end
|
|
|