crafting microoptimization
This commit is contained in:
@@ -33,12 +33,14 @@ import appeng.core.sync.packets.PacketInformPlayer;
|
|||||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
|
import appeng.util.item.MeaningfulItemIterator;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -110,32 +112,37 @@ public class CraftingTreeNode {
|
|||||||
if (this.parent.details.canSubstitute()) {
|
if (this.parent.details.canSubstitute()) {
|
||||||
for (IAEItemStack subs : this.parent.details.getSubstituteInputs(this.slot)) {
|
for (IAEItemStack subs : this.parent.details.getSubstituteInputs(this.slot)) {
|
||||||
if (damageableItem) {
|
if (damageableItem) {
|
||||||
for (IAEItemStack i : inventoryList.findFuzzy(subs, FuzzyMode.IGNORE_ALL)) {
|
Iterator<IAEItemStack> it = new MeaningfulItemIterator<>(inventoryList.findFuzzy(this.what, FuzzyMode.IGNORE_ALL));
|
||||||
itemList.add(i);
|
while (it.hasNext()) {
|
||||||
|
IAEItemStack i = it.next();
|
||||||
|
if (i.getStackSize() > 0) {
|
||||||
|
itemList.add(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subs = inventoryList.findPrecise(subs);
|
subs = inventoryList.findPrecise(subs);
|
||||||
if (subs != null) {
|
if (subs != null && subs.getStackSize() > 0) {
|
||||||
itemList.add(subs);
|
itemList.add(subs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (damageableItem) {
|
if (damageableItem) {
|
||||||
for (IAEItemStack i : inventoryList.findFuzzy(this.what, FuzzyMode.IGNORE_ALL)) {
|
Iterator<IAEItemStack> it = new MeaningfulItemIterator<>(inventoryList.findFuzzy(this.what, FuzzyMode.IGNORE_ALL));
|
||||||
itemList.add(i);
|
while (it.hasNext()) {
|
||||||
|
IAEItemStack i = it.next();
|
||||||
|
if (i.getStackSize() > 0) {
|
||||||
|
itemList.add(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final IAEItemStack item = inventoryList.findPrecise(this.what);
|
final IAEItemStack item = inventoryList.findPrecise(this.what);
|
||||||
if (item != null) {
|
if (item != null && item.getStackSize() > 0) {
|
||||||
itemList.add(item);
|
itemList.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IAEItemStack fuzz : itemList) {
|
for (IAEItemStack fuzz : itemList) {
|
||||||
if (fuzz.getStackSize() == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (this.parent.details.isValidItemForSlot(this.getSlot(), fuzz.getDefinition(), this.world)) {
|
if (this.parent.details.isValidItemForSlot(this.getSlot(), fuzz.getDefinition(), this.world)) {
|
||||||
fuzz = fuzz.copy();
|
fuzz = fuzz.copy();
|
||||||
fuzz.setStackSize(l);
|
fuzz.setStackSize(l);
|
||||||
|
|||||||
Reference in New Issue
Block a user