From 2fd2cea76bcf1e30528400c53201a0328409f932 Mon Sep 17 00:00:00 2001 From: Intybyte Date: Fri, 3 May 2024 19:09:44 +0200 Subject: [PATCH 1/3] Fix ChargingBench - ChargingBench can now only recharge ItemStacks with 1 item. --- .../items/electric/machines/ChargingBench.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java index e3395e9f64..39f38e9e7b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java @@ -44,6 +44,12 @@ protected void tick(Block b) { for (int slot : getInputSlots()) { ItemStack item = inv.getItemInSlot(slot); + if (item == null) + continue; + + if (item.getAmount() != 1) + continue; + if (charge(b, inv, slot, item)) { return; } From 0c397a7f3bbadcf3f6b977fc7fa2443b2e85db2a Mon Sep 17 00:00:00 2001 From: Vaan1310 <61906290+Intybyte@users.noreply.github.com> Date: Sat, 4 May 2024 13:46:07 +0200 Subject: [PATCH 2/3] Update src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java Co-authored-by: J3fftw <44972470+J3fftw1@users.noreply.github.com> --- .../items/electric/machines/ChargingBench.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java index 39f38e9e7b..22be838742 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java @@ -44,11 +44,13 @@ protected void tick(Block b) { for (int slot : getInputSlots()) { ItemStack item = inv.getItemInSlot(slot); - if (item == null) + if (item == null) { continue; + } - if (item.getAmount() != 1) + if (item.getAmount() != 1) { continue; + } if (charge(b, inv, slot, item)) { return; From f54ee0aa25d4639971efcdaa77d24d41a370f1ad Mon Sep 17 00:00:00 2001 From: JustAHuman-xD <65748158+JustAHuman-xD@users.noreply.github.com> Date: Thu, 30 May 2024 14:35:41 -0500 Subject: [PATCH 3/3] combine ifs --- .../items/electric/machines/ChargingBench.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java index 22be838742..b535e44b40 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java @@ -44,11 +44,7 @@ protected void tick(Block b) { for (int slot : getInputSlots()) { ItemStack item = inv.getItemInSlot(slot); - if (item == null) { - continue; - } - - if (item.getAmount() != 1) { + if (item == null || item.getAmount() != 1) { continue; }