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 72a9f8a9b8
commit 3bc992d8f2
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
8 changed files with 15 additions and 80 deletions

View File

@ -7677,10 +7677,10 @@ index 1d41e9d1682df8fa000a36eab5196dcca810c769..eff182a54cbb84693d6cad96b51f743b
public static byte toLegacyData(BlockState data) {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
index bbc2ab1972d9b88530282225650ec14b521d413f..9a80e0c390d13453a4a79e00d18c20b79afd3c7f 100644
index d2026d218405a40a6949c5f491c04704811b72b5..629178347039893fb9de710810fe8112499bb91c 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
@@ -213,7 +213,23 @@ public class DummyGeneratorAccess implements WorldGenLevel {
@@ -212,7 +212,23 @@ public class DummyGeneratorAccess implements WorldGenLevel {
public FluidState getFluidState(BlockPos pos) {
return Fluids.EMPTY.defaultFluidState(); // SPIGOT-6634
}

View File

@ -15922,7 +15922,7 @@ index e96a0ca47e4701ba187555bd92c968345bc85677..73b96f804079288e9c5fcc11da54e61e
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index c1980d00c622c32e7fdbd2a6fa487ba61020e7b5..504f3ddca160797a13a39bc813eb12322359ce50 100644
index f4db9e1f22e8954665d8a971b5f044e113fa173b..c1db84d0ed569dd44d1f54cca227f77890e0f66a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -778,6 +778,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -17520,7 +17520,7 @@ index b9b50c56e79297bb824a92355f437a5d4d7e6760..18ef7025f7f4dc2a4aff85ca65ff5a2d
while (objectiterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
index c6bbf2e695a6b572271c4fde3bea3bddc1dda339..fc5901a257ffd6ec878d1acbf97b9e6be664c52e 100644
index b0c8a0e64c7a5d41c1b4cc1e39c4399c142b56af..0887cba39bfc4279abec21c6c316abab28beb0a3 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java
@@ -34,27 +34,28 @@ import net.minecraft.world.level.ChunkPos;
@ -18102,10 +18102,10 @@ index 61767be202f95df16155e7a4c36701b21619f317..a9673a804d597599c35c83f4f245510c
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
index 9a80e0c390d13453a4a79e00d18c20b79afd3c7f..57acc7195f83b23c9b84ec4b94e0d7ab22851604 100644
index 629178347039893fb9de710810fe8112499bb91c..d5861dfa771c4eb217e082e3c832c3a6c603710d 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
@@ -259,4 +259,20 @@ public class DummyGeneratorAccess implements WorldGenLevel {
@@ -258,4 +258,20 @@ public class DummyGeneratorAccess implements WorldGenLevel {
public boolean destroyBlock(BlockPos pos, boolean drop, Entity breakingEntity, int maxUpdateDepth) {
return false; // SPIGOT-6515
}

View File

@ -94,7 +94,7 @@ index 665b01ff3579c8fd87074edfc6da6b7ef07693b2..24c31e96be460bcb5062a1fcf7f86c1a
private void setupRecipeList(Container input, ItemStack stack) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index eb8b13becd2d72c4cac12a11e27aa467d1901b7e..2cbe470e30807f7c54d1726a824c3c265fd3265c 100644
index 28c3518a5adde4bc3f3e0ee17c76b7ca34af1d9c..31ac732071811a09e3b9771f612a0b8f38c0823a 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1593,26 +1593,53 @@ public class CraftEventFactory {
@ -134,7 +134,7 @@ index eb8b13becd2d72c4cac12a11e27aa467d1901b7e..2cbe470e30807f7c54d1726a824c3c26
+ 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

@ -48,10 +48,10 @@ index 4bd59614606962a5371fd0da54bde25bf6a01325..602ce766f00dfde057c735eae3351068
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
index 57acc7195f83b23c9b84ec4b94e0d7ab22851604..b303eb2989be28dadf183d12a4bd706e43d1fa98 100644
index d5861dfa771c4eb217e082e3c832c3a6c603710d..80026dcdb66cc88a080b33ef290a6a7fb7bcbbaa 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
@@ -274,5 +274,17 @@ public class DummyGeneratorAccess implements WorldGenLevel {
@@ -273,5 +273,17 @@ public class DummyGeneratorAccess implements WorldGenLevel {
@Override
public <T> void getEntitiesByClass(Class<? extends T> clazz, Entity except, AABB box, List<? super T> into, Predicate<? super T> predicate) {}

View File

@ -202,14 +202,14 @@ index 53f4a000079f4c056500d03eca71991ae14483a9..e81bda56c58df6c3109382c17e86f4cc
world.levelEvent(1500, pos, state != iblockdata1 ? 1 : 0);
player.awardStat(Stats.ITEM_USED.get(itemstack.getItem()));
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
index b303eb2989be28dadf183d12a4bd706e43d1fa98..59cd4f331d9051369bc7c47678be7cd10ec41443 100644
index 80026dcdb66cc88a080b33ef290a6a7fb7bcbbaa..0b7d882551bcb8be149754209aad5fe4142f0fac 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
@@ -121,7 +121,7 @@ public class DummyGeneratorAccess implements WorldGenLevel {
@@ -120,7 +120,7 @@ public class DummyGeneratorAccess implements WorldGenLevel {
@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 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

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 efcfce93d17507bb6cc870a94eaa777429050d18..5719172a31f005ce419f365011d53712
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 109e6afb8fcce0fb539ef93c6c872daa010dc3ff..f60e94560b89a3c6ed1ad0f8bc636d58bf48d222 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1668,7 +1668,7 @@ 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