mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-26 23:13:09 +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;
|
||||
|
||||
Reference in new issue
Block a user