shady optimization
This commit is contained in:
@@ -40,6 +40,7 @@ import net.minecraft.world.World;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CraftingTreeNode {
|
public class CraftingTreeNode {
|
||||||
@@ -112,14 +113,16 @@ public class CraftingTreeNode {
|
|||||||
this.what.setStackSize(l);
|
this.what.setStackSize(l);
|
||||||
|
|
||||||
if (this.getSlot() >= 0 && this.parent != null && this.parent.details.isCraftable()) {
|
if (this.getSlot() >= 0 && this.parent != null && this.parent.details.isCraftable()) {
|
||||||
Collection<IAEItemStack> itemList = new ArrayList<>();
|
LinkedList<IAEItemStack> itemList = new LinkedList<>();
|
||||||
|
|
||||||
boolean damageableItem = this.what.getItem().isDamageable() || Platform.isGTDamageableItem(this.what.getItem());
|
boolean damageableItem = this.what.getItem().isDamageable() || Platform.isGTDamageableItem(this.what.getItem());
|
||||||
|
|
||||||
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) {
|
||||||
itemList.addAll(inventoryList.findFuzzy(subs, FuzzyMode.IGNORE_ALL));
|
for (IAEItemStack i : inventoryList.findFuzzy(subs, FuzzyMode.IGNORE_ALL)) {
|
||||||
|
itemList.add(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
subs = inventoryList.findPrecise(subs);
|
subs = inventoryList.findPrecise(subs);
|
||||||
if (subs != null) {
|
if (subs != null) {
|
||||||
@@ -128,7 +131,9 @@ public class CraftingTreeNode {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (damageableItem) {
|
if (damageableItem) {
|
||||||
itemList.addAll(inventoryList.findFuzzy(this.what, FuzzyMode.IGNORE_ALL));
|
for (IAEItemStack i : inventoryList.findFuzzy(this.what, FuzzyMode.IGNORE_ALL)) {
|
||||||
|
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) {
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import appeng.api.storage.data.IAEItemStack;
|
|||||||
import appeng.container.ContainerNull;
|
import appeng.container.ContainerNull;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
|
import appeng.util.item.OreHelper;
|
||||||
|
import appeng.util.item.OreReference;
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -37,6 +39,8 @@ import net.minecraft.nbt.NBTTagList;
|
|||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.crafting.IShapedRecipe;
|
import net.minecraftforge.common.crafting.IShapedRecipe;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -239,6 +243,22 @@ 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)) {
|
if (this.standardRecipe.matches(this.testFrame, w)) {
|
||||||
final ItemStack testOutput = this.standardRecipe.getCraftingResult(this.testFrame);
|
final ItemStack testOutput = this.standardRecipe.getCraftingResult(this.testFrame);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user