From cb2052ec933a7614b6c9f7e04782de38b453f590 Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Sat, 27 Mar 2021 22:52:14 +0000 Subject: [PATCH] Fixes #2914 --- CHANGELOG.md | 1 + .../implementation/items/geo/GEOMiner.java | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a65e0cd63..a4240b5a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ * Fixed #2906 * Fixed #2903 * Fixed #2913 +* Fixed #2914 ## Release Candidate 21 (14 Mar 2021) https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#21 diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/GEOMiner.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/GEOMiner.java index 84aa14c10..acb93acf4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/GEOMiner.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/GEOMiner.java @@ -54,6 +54,9 @@ public class GEOMiner extends AContainer implements RecipeDisplayItem, HologramO super(category, item, recipeType, recipe); addItemHandler(onPlace(), onBreak()); + + // Unregister the Block handler from AContainer (Fixes #2914) + registerBlockHandler(getId(), null); } @Nonnull @@ -87,26 +90,31 @@ public class GEOMiner extends AContainer implements RecipeDisplayItem, HologramO }; } + @Nonnull @Override public String getMachineIdentifier() { return "GEO_MINER"; } + @Nonnull @Override public ItemStack getProgressBar() { return new ItemStack(Material.DIAMOND_PICKAXE); } + @Nonnull @Override public int[] getInputSlots() { return new int[0]; } + @Nonnull @Override public int[] getOutputSlots() { return OUTPUT_SLOTS; } + @Nonnull @Override public List getDisplayRecipes() { List displayRecipes = new LinkedList<>(); @@ -120,13 +128,14 @@ public class GEOMiner extends AContainer implements RecipeDisplayItem, HologramO return displayRecipes; } + @Nonnull @Override public String getLabelLocalPath() { return "guide.tooltips.recipes.miner"; } @Override - protected void constructMenu(BlockMenuPreset preset) { + protected void constructMenu(@Nonnull BlockMenuPreset preset) { for (int i : BORDER) { preset.addItem(i, new CustomItem(Material.GRAY_STAINED_GLASS_PANE, " "), (p, slot, item, action) -> false); } @@ -154,7 +163,7 @@ public class GEOMiner extends AContainer implements RecipeDisplayItem, HologramO } @Override - protected void tick(Block b) { + protected void tick(@Nonnull Block b) { BlockMenu inv = BlockStorage.getInventory(b); if (isProcessing(b)) { @@ -183,7 +192,7 @@ public class GEOMiner extends AContainer implements RecipeDisplayItem, HologramO } } - private void start(Block b, BlockMenu inv) { + private void start(@Nonnull Block b, @Nonnull BlockMenu inv) { for (GEOResource resource : SlimefunPlugin.getRegistry().getGEOResources().values()) { if (resource.isObtainableFromGEOMiner()) { OptionalInt optional = SlimefunPlugin.getGPSNetwork().getResourceManager().getSupplies(resource, b.getWorld(), b.getX() >> 4, b.getZ() >> 4);