Updated Upstream (CraftBukkit)

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

CraftBukkit Changes:
e1fc95c50 Fix crash with 1.20 smithing table
04dfb921d Fix crash with juke boxes
1264a6fb5 Fix crash with composters
This commit is contained in:
Nassim Jahnke 2023-03-15 10:33:43 +01:00
parent 6e1f2c32b7
commit e71930939e
5 changed files with 4 additions and 69 deletions

View file

@ -134,7 +134,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static void callPrepareSmithingEvent(InventoryView view, ItemStack item) { // Paper - verify nothing uses return - handled below in PrepareResult
+ PrepareSmithingEvent event = new PrepareSmithingEvent(view, CraftItemStack.asCraftMirror(item)); // Paper - remove clone
+ //event.getView().getPlayer().getServer().getPluginManager().callEvent(event); // Paper - disable event
event.getInventory().setItem(2, event.getResult());
event.getInventory().setResult(event.getResult());
- return event;
+ //return event; // Paper
}

View file

@ -209,7 +209,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
public void gameEvent(GameEvent event, Vec3 emitterPos, GameEvent.Context emitter) {
- throw new UnsupportedOperationException("Not supported yet.");
- // Used by BlockComposter
+ // Used by ComposterBlock
}

View file

@ -4,58 +4,6 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
@@ -0,0 +0,0 @@ public class JukeboxBlockEntity extends BlockEntity implements Clearable, Contai
@Override
public int getMaxStackSize() {
- return 1;
+ return this.maxStack; // Paper
}
@Override
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 14 Mar 2023 20:03:21 -0700
Subject: [PATCH] Fix sniffer and new smithing table
Subject: [PATCH] Fix sniffer
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@ -40,16 +40,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -0,0 +0,0 @@ public class CraftEventFactory {
public static void callPrepareSmithingEvent(InventoryView view, ItemStack item) { // Paper - verify nothing uses return - handled below in PrepareResult
PrepareSmithingEvent event = new PrepareSmithingEvent(view, CraftItemStack.asCraftMirror(item)); // Paper - remove clone
//event.getView().getPlayer().getServer().getPluginManager().callEvent(event); // Paper - disable event
- event.getInventory().setItem(2, event.getResult());
+ event.getInventory().setItem(view.getType() == org.bukkit.event.inventory.InventoryType.SMITHING_NEW ? 3 : 2, event.getResult()); // Paper - use correct result slot index depending on inventory type
//return event; // Paper
}
// Paper end

@ -1 +1 @@
Subproject commit 703575fc7725efaf27b633c64316edf235860ae9
Subproject commit e1fc95c506834dfbb12c5adf00764ed5c46a2fca