Cleaned up a lot of different inspections

This commit is contained in:
Nicholas Ignoffo 2018-03-01 19:27:38 -08:00
parent 0dd0854bd9
commit 70d98455b7
207 changed files with 603 additions and 731 deletions

View file

@ -17,7 +17,7 @@ import java.util.List;
public class LivingArmourDowngradeRecipe {
protected LivingArmourUpgrade upgrade = null;
protected ItemStack keyStack = ItemStack.EMPTY;
protected List<Object> input = new ArrayList<Object>();
protected List<Object> input = new ArrayList<>();
public LivingArmourDowngradeRecipe(LivingArmourUpgrade upgrade, ItemStack keyStack, Object... recipe) {
this.upgrade = upgrade;
@ -32,12 +32,12 @@ public class LivingArmourDowngradeRecipe {
} else if (in instanceof String) {
input.add(OreDictionary.getOres((String) in));
} else {
String ret = "Invalid living armour downgrade recipe: ";
StringBuilder ret = new StringBuilder("Invalid living armour downgrade recipe: ");
for (Object tmp : recipe) {
ret += tmp + ", ";
ret.append(tmp).append(", ");
}
ret += upgrade.toString();
throw new RuntimeException(ret);
ret.append(upgrade.toString());
throw new RuntimeException(ret.toString());
}
}
}
@ -63,7 +63,7 @@ public class LivingArmourDowngradeRecipe {
return false;
}
ArrayList<Object> required = new ArrayList<Object>(input);
ArrayList<Object> required = new ArrayList<>(input);
for (ItemStack slot : checkedList) {
if (slot != null) {

View file

@ -14,7 +14,7 @@ import java.util.List;
public class TartaricForgeRecipe {
protected ItemStack output = null;
protected List<Object> input = new ArrayList<Object>();
protected List<Object> input = new ArrayList<>();
protected double minimumSouls;
protected double soulsDrained;
@ -40,12 +40,12 @@ public class TartaricForgeRecipe {
} else if (in instanceof String) {
input.add(OreDictionary.getOres((String) in));
} else {
String ret = "Invalid soul forge recipe: ";
StringBuilder ret = new StringBuilder("Invalid soul forge recipe: ");
for (Object tmp : recipe) {
ret += tmp + ", ";
ret.append(tmp).append(", ");
}
ret += output;
throw new RuntimeException(ret);
ret.append(output);
throw new RuntimeException(ret.toString());
}
}
}
@ -67,24 +67,19 @@ public class TartaricForgeRecipe {
*/
@SuppressWarnings("unchecked")
public boolean matches(List<ItemStack> checkedList, World world, BlockPos pos) {
ArrayList<Object> required = new ArrayList<Object>(input);
for (int x = 0; x < checkedList.size(); x++) {
ItemStack slot = checkedList.get(x);
ArrayList<Object> required = new ArrayList<>(input);
for (ItemStack slot : checkedList) {
if (slot != null) {
boolean inRecipe = false;
Iterator<Object> req = required.iterator();
while (req.hasNext()) {
for (Object aRequired : required) {
boolean match = false;
Object next = req.next();
if (next instanceof ItemStack) {
match = OreDictionary.itemMatches((ItemStack) next, slot, false);
} else if (next instanceof List) {
Iterator<ItemStack> itr = ((List<ItemStack>) next).iterator();
if (aRequired instanceof ItemStack) {
match = OreDictionary.itemMatches((ItemStack) aRequired, slot, false);
} else if (aRequired instanceof List) {
Iterator<ItemStack> itr = ((List<ItemStack>) aRequired).iterator();
while (itr.hasNext() && !match) {
match = OreDictionary.itemMatches(itr.next(), slot, false);
}
@ -92,7 +87,7 @@ public class TartaricForgeRecipe {
if (match) {
inRecipe = true;
required.remove(next);
required.remove(aRequired);
break;
}
}

View file

@ -19,11 +19,11 @@ public class AlchemyTableDyeableRecipe extends AlchemyTableRecipe {
public AlchemyTableDyeableRecipe(int lpDrained, int ticksRequired, int tierRequired, ItemStack inputItem) {
super(inputItem, lpDrained, ticksRequired, tierRequired);
ArrayList<ItemStack> validDyes = new ArrayList<ItemStack>();
ArrayList<ItemStack> validDyes = new ArrayList<>();
validDyes.add(new ItemStack(Items.NAME_TAG));
validDyes.add(new ItemStack(Items.DYE, 1, OreDictionary.WILDCARD_VALUE));
ArrayList<Object> recipe = new ArrayList<Object>();
ArrayList<Object> recipe = new ArrayList<>();
recipe.add(inputItem);
recipe.add(validDyes);

View file

@ -19,10 +19,8 @@ public class AlchemyTablePotionAugmentRecipe extends AlchemyTablePotionRecipe {
public AlchemyTablePotionAugmentRecipe(int lpDrained, int ticksRequired, int tierRequired, List<ItemStack> inputItems, PotionEffect baseEffect, double lengthAugment, int powerAugment) {
super(lpDrained, ticksRequired, tierRequired, inputItems, baseEffect);
ArrayList<Object> recipe = new ArrayList<Object>();
for (ItemStack stack : inputItems) {
recipe.add(stack);
}
ArrayList<Object> recipe = new ArrayList<>();
recipe.addAll(inputItems);
recipe.add(getAugmentedPotionFlask(baseEffect));
this.input = recipe;
@ -55,7 +53,7 @@ public class AlchemyTablePotionAugmentRecipe extends AlchemyTablePotionRecipe {
if (inputStack.isEmpty()) {
ItemStack outputStack = new ItemStack(RegistrarBloodMagicItems.POTION_FLASK);
List<PotionEffect> effectList = new ArrayList<PotionEffect>();
List<PotionEffect> effectList = new ArrayList<>();
int potionLength = wantedPotion.isInstant() ? 1 : BMPotionUtils.getAugmentedLength(baseEffect.getDuration(), lengthAugment, powerAugment - baseEffect.getAmplifier());
effectList.add(new PotionEffect(wantedPotion, potionLength, powerAugment - baseEffect.getAmplifier()));
@ -67,7 +65,7 @@ public class AlchemyTablePotionAugmentRecipe extends AlchemyTablePotionRecipe {
ItemStack outputStack = inputStack.copy();
List<PotionEffect> effectList = PotionUtils.getEffectsFromStack(outputStack);
List<PotionEffect> newEffectList = new ArrayList<PotionEffect>();
List<PotionEffect> newEffectList = new ArrayList<>();
for (PotionEffect effect : effectList) {
if (effect.getPotion() == wantedPotion) {
@ -89,7 +87,7 @@ public class AlchemyTablePotionAugmentRecipe extends AlchemyTablePotionRecipe {
public static ItemStack getAugmentedPotionFlask(PotionEffect baseEffect) {
ItemStack outputStack = new ItemStack(RegistrarBloodMagicItems.POTION_FLASK);
List<PotionEffect> effectList = new ArrayList<PotionEffect>();
List<PotionEffect> effectList = new ArrayList<>();
effectList.add(baseEffect);
BMPotionUtils.setEffects(outputStack, effectList);

View file

@ -22,10 +22,8 @@ public class AlchemyTablePotionRecipe extends AlchemyTableRecipe {
public AlchemyTablePotionRecipe(int lpDrained, int ticksRequired, int tierRequired, List<ItemStack> inputItems, PotionEffect baseEffect) {
super(basePotionFlaskStack, lpDrained, ticksRequired, tierRequired);
ArrayList<Object> recipe = new ArrayList<Object>();
for (ItemStack stack : inputItems) {
recipe.add(stack);
}
ArrayList<Object> recipe = new ArrayList<>();
recipe.addAll(inputItems);
recipe.add(basePotionFlaskStack);
this.input = recipe;
@ -60,7 +58,7 @@ public class AlchemyTablePotionRecipe extends AlchemyTableRecipe {
@Override
public boolean matches(List<ItemStack> checkedList, World world, BlockPos pos) {
ArrayList<Object> required = new ArrayList<Object>(input);
ArrayList<Object> required = new ArrayList<>(input);
for (ItemStack slot : checkedList) {
if (slot != null) {
@ -121,7 +119,7 @@ public class AlchemyTablePotionRecipe extends AlchemyTableRecipe {
if (inputStack.isEmpty()) {
ItemStack outputStack = new ItemStack(RegistrarBloodMagicItems.POTION_FLASK);
List<PotionEffect> effectList = new ArrayList<PotionEffect>();
List<PotionEffect> effectList = new ArrayList<>();
effectList.add(baseEffect);
PotionUtils.appendEffects(outputStack, effectList);

View file

@ -15,7 +15,7 @@ import java.util.List;
public class AlchemyTableRecipe {
protected ItemStack output = ItemStack.EMPTY;
protected ArrayList<Object> input = new ArrayList<Object>();
protected ArrayList<Object> input = new ArrayList<>();
protected int lpDrained;
protected int ticksRequired;
protected int tierRequired;
@ -43,12 +43,12 @@ public class AlchemyTableRecipe {
} else if (in instanceof String) {
input.add(OreDictionary.getOres((String) in));
} else {
String ret = "Invalid alchemy recipe: ";
StringBuilder ret = new StringBuilder("Invalid alchemy recipe: ");
for (Object tmp : recipe) {
ret += tmp + ", ";
ret.append(tmp).append(", ");
}
ret += output;
throw new RuntimeException(ret);
ret.append(output);
throw new RuntimeException(ret.toString());
}
}
}
@ -78,7 +78,7 @@ public class AlchemyTableRecipe {
*/
@SuppressWarnings("unchecked")
public boolean matches(List<ItemStack> checkedList, World world, BlockPos pos) {
ArrayList<Object> required = new ArrayList<Object>(input);
ArrayList<Object> required = new ArrayList<>(input);
for (ItemStack slot : checkedList) {
if (!slot.isEmpty()) {