From 4b86eeff64957c56c811ee92ecddac20c3ce6232 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 17 Jun 2021 08:29:15 +1000 Subject: [PATCH] SPIGOT-6570: Missing InventoryType: COMPOSTER By: md_5 --- .../world/level/block/BlockComposter.patch | 22 ++++++++++++++----- .../craftbukkit/inventory/CraftInventory.java | 3 +++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/paper-server/nms-patches/net/minecraft/world/level/block/BlockComposter.patch b/paper-server/nms-patches/net/minecraft/world/level/block/BlockComposter.patch index 7c4733fdf2..17f64ba329 100644 --- a/paper-server/nms-patches/net/minecraft/world/level/block/BlockComposter.patch +++ b/paper-server/nms-patches/net/minecraft/world/level/block/BlockComposter.patch @@ -86,7 +86,7 @@ return iblockdata; } else { int j = i + 1; -@@ -322,7 +349,8 @@ +@@ -322,10 +349,11 @@ public IWorldInventory a(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) { int i = (Integer) iblockdata.get(BlockComposter.LEVEL); @@ -95,7 +95,11 @@ + return (IWorldInventory) (i == 8 ? new BlockComposter.ContainerOutput(iblockdata, generatoraccess, blockposition, new ItemStack(Items.BONE_MEAL)) : (i < 7 ? new BlockComposter.ContainerInput(iblockdata, generatoraccess, blockposition) : new BlockComposter.ContainerEmpty(generatoraccess, blockposition))); } - private static class ContainerOutput extends InventorySubcontainer implements IWorldInventory { +- private static class ContainerOutput extends InventorySubcontainer implements IWorldInventory { ++ public static class ContainerOutput extends InventorySubcontainer implements IWorldInventory { + + private final IBlockData state; + private final GeneratorAccess level; @@ -337,6 +365,7 @@ this.state = iblockdata; this.level = generatoraccess; @@ -104,7 +108,7 @@ } @Override -@@ -361,8 +390,15 @@ +@@ -361,12 +390,19 @@ @Override public void update() { @@ -122,6 +126,11 @@ } } +- private static class ContainerInput extends InventorySubcontainer implements IWorldInventory { ++ public static class ContainerInput extends InventorySubcontainer implements IWorldInventory { + + private final IBlockData state; + private final GeneratorAccess level; @@ -375,6 +411,7 @@ public ContainerInput(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) { @@ -130,9 +139,12 @@ this.state = iblockdata; this.level = generatoraccess; this.pos = blockposition; -@@ -417,8 +454,9 @@ +@@ -415,10 +452,11 @@ + } + } - private static class ContainerEmpty extends InventorySubcontainer implements IWorldInventory { +- private static class ContainerEmpty extends InventorySubcontainer implements IWorldInventory { ++ public static class ContainerEmpty extends InventorySubcontainer implements IWorldInventory { - public ContainerEmpty() { + public ContainerEmpty(GeneratorAccess generatoraccess, BlockPosition blockposition) { // CraftBukkit diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index 4211bdfb21..1da7c834af 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -8,6 +8,7 @@ import net.minecraft.world.entity.player.PlayerInventory; import net.minecraft.world.inventory.InventoryCrafting; import net.minecraft.world.inventory.InventoryEnderChest; import net.minecraft.world.inventory.InventoryMerchant; +import net.minecraft.world.level.block.BlockComposter; import net.minecraft.world.level.block.entity.IHopper; import net.minecraft.world.level.block.entity.TileEntityBarrel; import net.minecraft.world.level.block.entity.TileEntityBlastFurnace; @@ -496,6 +497,8 @@ public class CraftInventory implements Inventory { return InventoryType.GRINDSTONE; } else if (this instanceof CraftInventoryStonecutter) { return InventoryType.STONECUTTER; + } else if (inventory instanceof BlockComposter.ContainerEmpty || inventory instanceof BlockComposter.ContainerInput || inventory instanceof BlockComposter.ContainerOutput) { + return InventoryType.COMPOSTER; } else { return InventoryType.CHEST; }