mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
|
|
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
|
+++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
|
|
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/world/inventory/MerchantContainer.java
|
|
+++ b/src/main/java/net/minecraft/world/inventory/MerchantContainer.java
|
|
@@ -0,0 +0,0 @@ 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
|
|
|