mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-11 17:31:06 +01:00
38be4f873b
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: 2c64d8c4 SPIGOT-7309: Add API for jukebox inventories a6d7e4ca PR-826: Add Sniffer API CraftBukkit Changes: 93813509b SPIGOT-7309: Add API for jukebox inventories 2d5209e8d PR-1153: Handle teleport reason in spreadplayers command f5b61387e SPIGOT-7308: Fix NullPointerException when calling Jukebox#setRecord() 388d458a6 SPIGOT-7306: Fix reset of coords in default teleportTo in EntityPlayer 40b87e1af PR-1150: Add Sniffer API and handle EntityItemDropEvent Spigot Changes: 6ad4b93c SPIGOT-7298: Fix debug stick always permission left click toggle
59 lines
3.3 KiB
Diff
59 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 certain inventories returning null Locations
|
|
|
|
Wandering Trader, AbstractHorse, and Beacon inventories returned null locations
|
|
when a block or entity location is readily available
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
index f9496f757bcf7000fab1f16386e775d54d96e47a..47cd69f91bbc2e2be9ec970674adc522e21593c8 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
@@ -346,7 +346,15 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
|
public void createInventory() {
|
|
SimpleContainer inventorysubcontainer = this.inventory;
|
|
|
|
- this.inventory = new SimpleContainer(this.getInventorySize(), (org.bukkit.entity.AbstractHorse) this.getBukkitEntity()); // CraftBukkit
|
|
+ // Paper start
|
|
+ this.inventory = new SimpleContainer(this.getInventorySize(), (org.bukkit.entity.AbstractHorse) this.getBukkitEntity()) // CraftBukkit
|
|
+ {
|
|
+ @Override
|
|
+ public org.bukkit.Location getLocation() {
|
|
+ return AbstractHorse.this.getBukkitEntity().getLocation();
|
|
+ }
|
|
+ };
|
|
+ // Paper end
|
|
if (inventorysubcontainer != null) {
|
|
inventorysubcontainer.removeListener(this);
|
|
int i = Math.min(inventorysubcontainer.getContainerSize(), this.inventory.getContainerSize());
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
|
index 1ffbb43bfdb173689fdd9d2398b021846e0246fa..e56ddc7983f58f5b7634b8a6efbb67fa64703ab7 100644
|
|
--- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
|
+++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
|
@@ -49,6 +49,12 @@ public class BeaconMenu extends AbstractContainerMenu {
|
|
public int getMaxStackSize() {
|
|
return 1;
|
|
}
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public org.bukkit.Location getLocation() {
|
|
+ return context.getLocation();
|
|
+ }
|
|
+ // Paper end
|
|
};
|
|
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..98cbcf67d8fdb1c80fb7ba8ba7734821e2818da6 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
|
|
}
|
|
// CraftBukkit end
|
|
|