1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Merge pull request #2915 from Slimefun/fix/issue-2914

Fixes #2914
This commit is contained in:
Daniel Walsh 2021-03-27 23:02:13 +00:00 committed by GitHub
commit 73b5ef8b52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -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

View File

@ -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<ItemStack> getDisplayRecipes() {
List<ItemStack> 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);