From 64145dd66d87bcc9781bd9164ded8c649cad42c8 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 7 Dec 2023 08:37:37 +1100 Subject: [PATCH] SPIGOT-7534: Error when chunk with decorated pot trying to save By: md_5 --- .../entity/DecoratedPotBlockEntity.patch | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 paper-server/nms-patches/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.patch diff --git a/paper-server/nms-patches/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.patch b/paper-server/nms-patches/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.patch new file mode 100644 index 0000000000..29f01df753 --- /dev/null +++ b/paper-server/nms-patches/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.patch @@ -0,0 +1,61 @@ +--- a/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java ++++ b/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java +@@ -21,7 +21,58 @@ + import net.minecraft.world.level.block.state.properties.BlockProperties; + import net.minecraft.world.ticks.ContainerSingleItem; + ++// CraftBukkit start ++import java.util.ArrayList; ++import java.util.Arrays; ++import java.util.List; ++import org.bukkit.Location; ++import org.bukkit.craftbukkit.entity.CraftHumanEntity; ++import org.bukkit.craftbukkit.util.CraftLocation; ++import org.bukkit.entity.HumanEntity; ++// CraftBukkit end ++ + public class DecoratedPotBlockEntity extends TileEntity implements RandomizableContainer, ContainerSingleItem { ++ ++ // CraftBukkit start - add fields and methods ++ public List transaction = new ArrayList<>(); ++ private int maxStack = MAX_STACK; ++ ++ @Override ++ public List getContents() { ++ return Arrays.asList(this.item); ++ } ++ ++ @Override ++ public void onOpen(CraftHumanEntity who) { ++ transaction.add(who); ++ } ++ ++ @Override ++ public void onClose(CraftHumanEntity who) { ++ transaction.remove(who); ++ } ++ ++ @Override ++ public List getViewers() { ++ return transaction; ++ } ++ ++ @Override ++ public int getMaxStackSize() { ++ return maxStack; ++ } ++ ++ @Override ++ public void setMaxStackSize(int i) { ++ maxStack = i; ++ } ++ ++ @Override ++ public Location getLocation() { ++ if (level == null) return null; ++ return CraftLocation.toBukkit(worldPosition, level.getWorld()); ++ } ++ // CraftBukkit end + + public static final String TAG_SHERDS = "sherds"; + public static final String TAG_ITEM = "item";