fix container items breaking not being taken into account during simulation properly
optimize crafting with container items by checking IF WE HAVE ANY of before LOOKING UP IF THE RECIPE MATCHES with the item we DONT HAVE
This commit is contained in:
@@ -39,7 +39,6 @@ import net.minecraft.world.World;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -143,6 +142,9 @@ public class CraftingTreeNode {
|
||||
}
|
||||
|
||||
for (IAEItemStack fuzz : itemList) {
|
||||
if (fuzz.getStackSize() == 0) {
|
||||
continue;
|
||||
}
|
||||
if (this.parent.details.isValidItemForSlot(this.getSlot(), fuzz.getDefinition(), this.world)) {
|
||||
fuzz = fuzz.copy();
|
||||
fuzz.setStackSize(l);
|
||||
@@ -150,7 +152,6 @@ public class CraftingTreeNode {
|
||||
final IAEItemStack available = inv.extractItems(fuzz, Actionable.MODULATE, src);
|
||||
|
||||
if (available != null) {
|
||||
|
||||
if (available.getItem().hasContainerItem(available.getDefinition())) {
|
||||
final ItemStack is2 = Platform.getContainerItem(available.createItemStack());
|
||||
final IAEItemStack o = AEItemStack.fromItemStack(is2);
|
||||
@@ -264,19 +265,16 @@ public class CraftingTreeNode {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.parent != null) {
|
||||
if (what.getItem().hasContainerItem(what.createItemStack())) {
|
||||
final ItemStack is2 = Platform.getContainerItem(what.copy().setStackSize(1).createItemStack());
|
||||
if (job.isSimulation()) {
|
||||
this.bytes += l;
|
||||
if (parent != null && this.what.getItem().hasContainerItem(this.what.getDefinition())) {
|
||||
final ItemStack is2 = Platform.getContainerItem(this.what.copy().setStackSize(1).createItemStack());
|
||||
final IAEItemStack o = AEItemStack.fromItemStack(is2);
|
||||
|
||||
if (o != null) {
|
||||
this.parent.addContainers(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (job.isSimulation()) {
|
||||
this.bytes += l;
|
||||
this.missing += l;
|
||||
final IAEItemStack rv = this.what.copy();
|
||||
rv.setStackSize(l);
|
||||
|
||||
@@ -26,8 +26,6 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.item.OreHelper;
|
||||
import appeng.util.item.OreReference;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -39,8 +37,6 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.crafting.IShapedRecipe;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -243,22 +239,6 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (this.standardRecipe instanceof ShapedOreRecipe) {
|
||||
final OreReference aOR = OreHelper.INSTANCE.getOre(this.crafting.getStackInSlot(slotIndex)).orElse(null);
|
||||
if (aOR != null) {
|
||||
final OreReference bOR = OreHelper.INSTANCE.getOre(i).orElse(null);
|
||||
|
||||
if (OreHelper.INSTANCE.sameOre(aOR, bOR)) {
|
||||
this.markItemAs(slotIndex, i, TestStatus.ACCEPT);
|
||||
return true;
|
||||
}
|
||||
|
||||
this.markItemAs(slotIndex, i, TestStatus.DECLINE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.standardRecipe.matches(this.testFrame, w)) {
|
||||
final ItemStack testOutput = this.standardRecipe.getCraftingResult(this.testFrame);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user