mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 10:55:17 +00:00
Remove more redundant stack copying from recipe matching
This commit is contained in:
1 parent
ead59192e6
commit
80aea6f7be
5 files changed
+9
-29
No files matched your search
@@ -55,14 +55,9 @@ public class RecipeBrew {
|
||||
for(int j = 0; j < inputsMissing.size(); j++) {
|
||||
Object input = inputsMissing.get(j);
|
||||
if(input instanceof String) {
|
||||
List<ItemStack> validStacks = OreDictionary.getOres((String) input);
|
||||
boolean found = false;
|
||||
for(ItemStack ostack : validStacks) {
|
||||
ItemStack cstack = ostack.copy();
|
||||
if(cstack.getItemDamage() == Short.MAX_VALUE)
|
||||
cstack.setItemDamage(stack.getItemDamage());
|
||||
|
||||
if(stack.isItemEqual(cstack)) {
|
||||
for(ItemStack ostack : OreDictionary.getOres((String) input, false)) {
|
||||
if(OreDictionary.itemMatches(ostack, stack, false)) {
|
||||
oredictIndex = j;
|
||||
found = true;
|
||||
break;
|
||||
|
||||
@@ -35,22 +35,12 @@ public class RecipeManaInfusion {
|
||||
|
||||
public boolean matches(ItemStack stack) {
|
||||
if(input instanceof ItemStack) {
|
||||
ItemStack inputCopy = ((ItemStack) input).copy();
|
||||
if(inputCopy.getItemDamage() == Short.MAX_VALUE)
|
||||
inputCopy.setItemDamage(stack.getItemDamage());
|
||||
|
||||
return stack.isItemEqual(inputCopy);
|
||||
return OreDictionary.itemMatches((ItemStack) input, stack, false);
|
||||
}
|
||||
|
||||
if(input instanceof String) {
|
||||
List<ItemStack> validStacks = OreDictionary.getOres((String) input);
|
||||
|
||||
for(ItemStack ostack : validStacks) {
|
||||
ItemStack cstack = ostack.copy();
|
||||
if(cstack.getItemDamage() == Short.MAX_VALUE)
|
||||
cstack.setItemDamage(stack.getItemDamage());
|
||||
|
||||
if(stack.isItemEqual(cstack))
|
||||
for(ItemStack ostack : OreDictionary.getOres((String) input, false)) {
|
||||
if(OreDictionary.itemMatches(ostack, stack, false))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,14 +49,9 @@ public class RecipePetals {
|
||||
for(int j = 0; j < inputsMissing.size(); j++) {
|
||||
Object input = inputsMissing.get(j);
|
||||
if(input instanceof String) {
|
||||
List<ItemStack> validStacks = OreDictionary.getOres((String) input);
|
||||
boolean found = false;
|
||||
for(ItemStack ostack : validStacks) {
|
||||
ItemStack cstack = ostack.copy();
|
||||
if(cstack.getItemDamage() == Short.MAX_VALUE)
|
||||
cstack.setItemDamage(stack.getItemDamage());
|
||||
|
||||
if(stack.isItemEqual(cstack)) {
|
||||
for(ItemStack ostack : OreDictionary.getOres((String) input, false)) {
|
||||
if(OreDictionary.itemMatches(ostack, stack, false)) {
|
||||
oredictIndex = j;
|
||||
found = true;
|
||||
break;
|
||||
|
||||
@@ -84,7 +84,7 @@ public class SubTileHopperhock extends SubTileFunctional {
|
||||
List<ItemStack> filter = getFilterForInventory(pos_, true);
|
||||
boolean canAccept = canAcceptItem(stack, filter, filterType);
|
||||
|
||||
ItemStack simulate = ItemHandlerHelper.insertItem(inv.handler, stack.copy(), true);
|
||||
ItemStack simulate = ItemHandlerHelper.insertItem(inv.handler, stack, true);
|
||||
int availablePut = stack.getCount() - simulate.getCount();
|
||||
|
||||
canAccept &= availablePut > 0;
|
||||
|
||||
@@ -134,7 +134,7 @@ public class TileCraftCrate extends TileOpenCrate {
|
||||
if(stack.isEmpty() || isLocked(i) || stack.getItem() == ModItems.manaResource && stack.getItemDamage() == 11)
|
||||
continue;
|
||||
|
||||
craft.setInventorySlotContents(i, stack.copy());
|
||||
craft.setInventorySlotContents(i, stack);
|
||||
}
|
||||
|
||||
for(IRecipe recipe : ForgeRegistries.RECIPES)
|
||||
|
||||
Reference in new issue
Block a user