geforkt von Mirrors/Paper
Fix jukeboxes
Dieser Commit ist enthalten in:
Ursprung
2c485d1485
Commit
28d49a1b58
58
patches/api/0420-Fix-Jukeboxes.patch
Normale Datei
58
patches/api/0420-Fix-Jukeboxes.patch
Normale Datei
@ -0,0 +1,58 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Tue, 14 Mar 2023 18:55:47 -0700
|
||||
Subject: [PATCH] Fix Jukeboxes
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Jukebox.java b/src/main/java/org/bukkit/block/Jukebox.java
|
||||
index 321e5e034a906129142341cec952fac3c1e7e360..37967acb9ee85f1d1c9b3b2d3472b460f41f7080 100644
|
||||
--- a/src/main/java/org/bukkit/block/Jukebox.java
|
||||
+++ b/src/main/java/org/bukkit/block/Jukebox.java
|
||||
@@ -8,7 +8,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a captured state of a jukebox.
|
||||
*/
|
||||
-public interface Jukebox extends TileState {
|
||||
+public interface Jukebox extends TileState, org.bukkit.inventory.BlockInventoryHolder { // Paper
|
||||
|
||||
/**
|
||||
* Gets the record inserted into the jukebox.
|
||||
@@ -62,4 +62,20 @@ public interface Jukebox extends TileState {
|
||||
* @throws IllegalStateException if this block state is not placed
|
||||
*/
|
||||
public boolean eject();
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * @return inventory
|
||||
+ * @see Container#getInventory()
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ org.bukkit.inventory.Inventory getInventory();
|
||||
+
|
||||
+ /**
|
||||
+ * @return snapshot inventory
|
||||
+ * @see Container#getSnapshotInventory()
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ org.bukkit.inventory.Inventory getSnapshotInventory();
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
||||
index 374b06a5e098f81dfe059df35f02139afd1e7991..6957d5b88c549f08dd3afe272f018be122f3a4a6 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
||||
@@ -146,6 +146,13 @@ public enum InventoryType {
|
||||
*/
|
||||
@Deprecated @org.jetbrains.annotations.ApiStatus.Experimental // Paper - 1.20
|
||||
SMITHING_NEW(4, "Upgrade Gear"),
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Pseudo jukebox inventory
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.ApiStatus.Experimental
|
||||
+ JUKEBOX(1, "Jukebox");
|
||||
+ // Paper end
|
||||
;
|
||||
|
||||
private final int size;
|
96
patches/server/0962-Fix-Jukeboxes.patch
Normale Datei
96
patches/server/0962-Fix-Jukeboxes.patch
Normale Datei
@ -0,0 +1,96 @@
|
||||
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/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java
|
||||
index 760b9ce8e081cc1b8ccda6e9e3752bbfb2f4bd6b..ee321e46f2a49b33e9939665d525badcf2a814bf 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java
|
||||
@@ -145,7 +145,7 @@ public class JukeboxBlockEntity extends BlockEntity implements Clearable, Contai
|
||||
|
||||
@Override
|
||||
public int getMaxStackSize() {
|
||||
- return 1;
|
||||
+ return this.maxStack; // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -197,4 +197,38 @@ public class JukeboxBlockEntity extends BlockEntity implements Clearable, Contai
|
||||
this.level.updateNeighborsAt(this.getBlockPos(), this.getBlockState().getBlock());
|
||||
this.setChanged();
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ public java.util.List<org.bukkit.entity.HumanEntity> transaction = new java.util.ArrayList<>();
|
||||
+ private int maxStack = 1;
|
||||
+ @Override
|
||||
+ public java.util.List<net.minecraft.world.item.ItemStack> getContents() {
|
||||
+ return this.items;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) {
|
||||
+ this.transaction.add(who);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) {
|
||||
+ this.transaction.remove(who);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
|
||||
+ return this.transaction;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setMaxStackSize(int size) {
|
||||
+ this.maxStack = size;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.Location getLocation() {
|
||||
+ return new org.bukkit.Location(this.level.getWorld(), this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ());
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
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;
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren