mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-21 18:15:54 +01:00
Fix certain inventories returning null Locations (#8985)
This commit is contained in:
parent
646f590779
commit
85a67dadf2
@ -89,6 +89,19 @@ index 43e77cef0fce75f59aeb05e161668bebb8fca229..ef50fbf8cb3f008827850b5ed3342200
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index 13031576c20bda3bb12c926f6cd938fa5fb105f2..f14c4ec49e7206b8192050f1bd20a18e78f392fa 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -91,7 +91,7 @@ public class ServerPlayerGameMode {
|
||||
return event; // Paper
|
||||
}
|
||||
// CraftBukkit end
|
||||
- this.setGameModeForPlayer(gameMode, this.previousGameModeForPlayer);
|
||||
+ this.setGameModeForPlayer(gameMode, this.gameModeForPlayer); // Paper - Fix MC-259571
|
||||
this.player.onUpdateAbilities();
|
||||
this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, this.player), this.player); // CraftBukkit
|
||||
this.level.updateSleepingPlayerList();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Saddleable.java b/src/main/java/net/minecraft/world/entity/Saddleable.java
|
||||
index effe4c4fb37fe13aece70cdef4966047d4719af9..7152674d3f3fb98198585cb5ece2bb88877345f9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Saddleable.java
|
||||
@ -251,17 +264,3 @@ index 5e70b5f643faabfc05989de9592d8c5c787102e3..2a786c9fd29dc2139cf487fa645cd433
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index 58b093bb1de78ee3b3b2ea364aa50474883f443a..2be2f87454fc6acaa3ca9f67f869f7ac76afc751 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -91,7 +91,7 @@ public class ServerPlayerGameMode {
|
||||
return event; // Paper
|
||||
}
|
||||
// CraftBukkit end
|
||||
- this.setGameModeForPlayer(gameMode, this.previousGameModeForPlayer);
|
||||
+ this.setGameModeForPlayer(gameMode, this.gameModeForPlayer); // Paper - Fix MC-259571
|
||||
this.player.onUpdateAbilities();
|
||||
this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, this.player), this.player); // CraftBukkit
|
||||
this.level.updateSleepingPlayerList();
|
||||
|
@ -0,0 +1,59 @@
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user