mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 04:02:50 +01:00
45 lines
2.1 KiB
Diff
45 lines
2.1 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||
|
Date: Tue, 14 Mar 2023 18:55:56 -0700
|
||
|
Subject: [PATCH] Fix Jukeboxes
|
||
|
|
||
|
|
||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java b/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java
|
||
|
index 639b5a0452e919960094087933f96b9fca4a3398..d20fafee259b170d4ca770865ab15617c4e127b6 100644
|
||
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java
|
||
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java
|
||
|
@@ -91,4 +91,18 @@ public class CraftJukebox extends CraftBlockEntityState<JukeboxBlockEntity> impl
|
||
|
jukebox.popOutRecord();
|
||
|
return result;
|
||
|
}
|
||
|
+ // Paper start
|
||
|
+ @Override
|
||
|
+ public org.bukkit.inventory.Inventory getInventory() {
|
||
|
+ if (!this.isPlaced()) {
|
||
|
+ return this.getSnapshotInventory();
|
||
|
+ }
|
||
|
+ return new org.bukkit.craftbukkit.inventory.CraftInventory(this.getTileEntity());
|
||
|
+ }
|
||
|
+
|
||
|
+ @Override
|
||
|
+ public org.bukkit.inventory.Inventory getSnapshotInventory() {
|
||
|
+ return new org.bukkit.craftbukkit.inventory.CraftInventory(this.getSnapshot());
|
||
|
+ }
|
||
|
+ // Paper end
|
||
|
}
|
||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
|
||
|
index 00959a31e172632d9bf047347f345140fca3198c..44eba9e20651c29a84def786f4a350750fdbdeeb 100644
|
||
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
|
||
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
|
||
|
@@ -535,6 +535,10 @@ public class CraftInventory implements Inventory {
|
||
|
return InventoryType.COMPOSTER;
|
||
|
} else if (this instanceof CraftInventorySmithingNew) {
|
||
|
return InventoryType.SMITHING_NEW;
|
||
|
+ // Paper start
|
||
|
+ } else if (this.inventory instanceof net.minecraft.world.level.block.entity.JukeboxBlockEntity) {
|
||
|
+ return InventoryType.JUKEBOX;
|
||
|
+ // Paper end
|
||
|
} else {
|
||
|
return InventoryType.CHEST;
|
||
|
}
|