1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00
This commit is contained in:
TheBusyBiscuit 2020-06-14 13:34:31 +02:00
parent 2733b8a17b
commit 2bead0cd3d
2 changed files with 17 additions and 4 deletions

View File

@ -58,6 +58,7 @@
* Fixed #1985
* Fixed a missing texture in the Android Script Editor
* Fixed #1992
* Possibly fixed #1951
## Release Candidate 12 (27 May 2020)
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#12

View File

@ -1,8 +1,8 @@
package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import org.bukkit.Material;
@ -56,12 +56,20 @@ public abstract class ElectricSmeltery extends AContainer {
@Override
public int[] getSlotsAccessedByItemTransport(DirtyChestMenu menu, ItemTransportFlow flow, ItemStack item) {
if (flow == ItemTransportFlow.WITHDRAW) return getOutputSlots();
if (flow == ItemTransportFlow.WITHDRAW) {
return getOutputSlots();
}
List<Integer> slots = new ArrayList<>();
int fullSlots = 0;
List<Integer> slots = new LinkedList<>();
for (int slot : getInputSlots()) {
if (SlimefunUtils.isItemSimilar(menu.getItemInSlot(slot), item, true)) {
ItemStack stack = menu.getItemInSlot(slot);
if (stack != null && SlimefunUtils.isItemSimilar(stack, item, true)) {
if (stack.getAmount() < stack.getMaxStackSize()) {
fullSlots++;
}
slots.add(slot);
}
}
@ -69,6 +77,10 @@ public abstract class ElectricSmeltery extends AContainer {
if (slots.isEmpty()) {
return getInputSlots();
}
else if (fullSlots == slots.size()) {
// All slots with that item are already full
return new int[0];
}
else {
Collections.sort(slots, compareSlots(menu));
int[] array = new int[slots.size()];