mirror of
https://github.com/GTNewHorizons/NotEnoughEnergistics.git
synced 2026-10-25 20:32:19 +00:00
压缩同类物品
This commit is contained in:
1 parent
5bb9d6f1cc
commit
2c7d498bb9
1 file changed
+20
@@ -15,6 +15,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -50,8 +51,27 @@ public class NEECraftingHandler implements IOverlayHandler {
|
||||
for (IRecipeProcessor processor : RecipeProcessor.recipeProcessors) {
|
||||
List<PositionedStack> inputs = processor.getRecipeInput(recipe, recipeIndex, identifier);
|
||||
List<PositionedStack> outputs = processor.getRecipeOutput(recipe, recipeIndex, identifier);
|
||||
|
||||
List<PositionedStack> tInputs = new ArrayList<>();
|
||||
|
||||
if (inputs != null && outputs != null) {
|
||||
|
||||
for (PositionedStack positionedStack : inputs) {
|
||||
ItemStack currentStack = positionedStack.items[0];
|
||||
boolean find = false;
|
||||
for (PositionedStack storedStack : tInputs) {
|
||||
ItemStack StoredStack = storedStack.items[0];
|
||||
if (StoredStack.isItemEqual(currentStack) && (StoredStack.stackSize + currentStack.stackSize) <= StoredStack.getMaxStackSize()) {
|
||||
find = true;
|
||||
storedStack.items[0].stackSize = StoredStack.stackSize + currentStack.stackSize;
|
||||
}
|
||||
}
|
||||
if (!find) {
|
||||
tInputs.add(positionedStack);
|
||||
}
|
||||
}
|
||||
|
||||
for (PositionedStack positionedStack : tInputs) {
|
||||
ItemStack currentStack = positionedStack.items[0];
|
||||
for (ItemStack stack : positionedStack.items) {
|
||||
if (Platform.isRecipePrioritized(stack)) {
|
||||
|
||||
Reference in new issue
Block a user