Auto remove un needed things in the code

This commit is contained in:
modmuss50 2016-04-03 14:34:39 +01:00
parent 7e7fcf2ad9
commit 510f969c94
105 changed files with 141 additions and 348 deletions

View file

@ -18,7 +18,7 @@ import java.util.List;
public class RollingMachineRecipe {
public static final RollingMachineRecipe instance = new RollingMachineRecipe();
private final List<IRecipe> recipes = new ArrayList<IRecipe>();
private final List<IRecipe> recipes = new ArrayList<>();
public void addShapedOreRecipe(ItemStack outputItemStack, Object... objectInputs) {
recipes.add(new ShapedOreRecipe(outputItemStack, objectInputs));
@ -66,8 +66,8 @@ public class RollingMachineRecipe {
ItemStack recipeArray[] = new ItemStack[j * k];
for (int i1 = 0; i1 < j * k; i1++) {
char c = s.charAt(i1);
if (hashmap.containsKey(Character.valueOf(c))) {
recipeArray[i1] = ((ItemStack) hashmap.get(Character.valueOf(c))).copy();
if (hashmap.containsKey(c)) {
recipeArray[i1] = ((ItemStack) hashmap.get(c)).copy();
} else {
recipeArray[i1] = null;
}
@ -77,7 +77,7 @@ public class RollingMachineRecipe {
}
public void addShapelessRecipe(ItemStack output, Object... components) {
List<ItemStack> ingredients = new ArrayList<ItemStack>();
List<ItemStack> ingredients = new ArrayList<>();
for (int j = 0; j < components.length; j++) {
Object obj = components[j];
if (obj instanceof ItemStack) {
@ -100,7 +100,7 @@ public class RollingMachineRecipe {
public ItemStack findMatchingRecipe(InventoryCrafting inv, World world) {
for (int k = 0; k < recipes.size(); k++) {
IRecipe irecipe = (IRecipe) recipes.get(k);
IRecipe irecipe = recipes.get(k);
if (irecipe.matches(inv, world)) {
return irecipe.getCraftingResult(inv);
}

View file

@ -13,9 +13,6 @@ public class SlotUpgrade extends Slot {
@Override
public boolean isItemValid(ItemStack stack) {
if (stack.getItem() instanceof IMachineUpgrade) {
return true;
} else
return false;
return stack.getItem() instanceof IMachineUpgrade;
}
}

View file

@ -7,7 +7,7 @@ public class FusionReactorRecipeHelper {
/**
* This is the list of all the recipes
*/
public static ArrayList<FusionReactorRecipe> reactorRecipes = new ArrayList<FusionReactorRecipe>();
public static ArrayList<FusionReactorRecipe> reactorRecipes = new ArrayList<>();
/**
* Register your reactor recipe here

View file

@ -14,13 +14,13 @@ public class RecipeHandler {
/**
* This is the array list of all of the recipes for all of the machines
*/
public static final ArrayList<IBaseRecipeType> recipeList = new ArrayList<IBaseRecipeType>();
public static final ArrayList<IBaseRecipeType> recipeList = new ArrayList<>();
public static HashMap<IBaseRecipeType, String> stackMap = new HashMap<IBaseRecipeType, String>();
public static HashMap<IBaseRecipeType, String> stackMap = new HashMap<>();
/**
* This is a list of all the registered machine names.
*/
public static ArrayList<String> machineNames = new ArrayList<String>();
public static ArrayList<String> machineNames = new ArrayList<>();
/**
* Use this to get all of the recipes form a recipe name
@ -29,7 +29,7 @@ public class RecipeHandler {
* @return A list of all the recipes of a given name.
*/
public static List<IBaseRecipeType> getRecipeClassFromName(String name) {
List<IBaseRecipeType> baseRecipeList = new ArrayList<IBaseRecipeType>();
List<IBaseRecipeType> baseRecipeList = new ArrayList<>();
for (IBaseRecipeType baseRecipe : recipeList) {
if (baseRecipe.getRecipeName().equals(name)) {
baseRecipeList.add(baseRecipe);
@ -66,7 +66,7 @@ public class RecipeHandler {
machineNames.add(recipe.getRecipeName());
}
recipeList.add(recipe);
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
for (StackTraceElement ste : Thread.currentThread().getStackTrace()) {
buffer.append(ste);
}
@ -82,10 +82,9 @@ public class RecipeHandler {
for (int i = 0; i < baseRecipeType.getInputs().size(); i++) {
if (ItemUtils.isItemEqual(baseRecipeType.getInputs().get(i), recipe.getInputs().get(i), true,
false, false)) {
StringBuffer itemInfo = new StringBuffer();
StringBuilder itemInfo = new StringBuilder();
for (ItemStack inputs : baseRecipeType.getInputs()) {
itemInfo.append(":" + inputs.getItem().getUnlocalizedName() + ","
+ inputs.getDisplayName() + "," + inputs.stackSize);
itemInfo.append(":").append(inputs.getItem().getUnlocalizedName()).append(",").append(inputs.getDisplayName()).append(",").append(inputs.stackSize);
}
Core.logHelper.all(stackMap.get(baseRecipeType));
// throw new Exception("Found a duplicate recipe for

View file

@ -1,7 +1,6 @@
package techreborn.api.recipe.machines;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import techreborn.api.Reference;
import techreborn.api.recipe.BaseRecipe;

View file

@ -1,7 +1,6 @@
package techreborn.api.recipe.machines;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidStack;
import techreborn.api.Reference;
import techreborn.api.recipe.BaseRecipe;

View file

@ -1,7 +1,6 @@
package techreborn.api.recipe.machines;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.FluidStack;
import techreborn.api.Reference;
import techreborn.api.recipe.BaseRecipe;

View file

@ -1,7 +1,6 @@
package techreborn.api.recipe.machines;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import techreborn.api.Reference;
import techreborn.api.recipe.BaseRecipe;

View file

@ -46,14 +46,14 @@ public class RecipeConfig {
public void addInputs(ConfigItem item) {
if (inputs == null) {
inputs = new ArrayList<ConfigItem>();
inputs = new ArrayList<>();
}
inputs.add(item);
}
public void addOutputs(ConfigItem item) {
if (outputs == null) {
outputs = new ArrayList<ConfigItem>();
outputs = new ArrayList<>();
}
outputs.add(item);
}

View file

@ -12,7 +12,7 @@ import java.util.ArrayList;
public class RecipeConfigManager {
public static ArrayList<RecipeConfig> configs = new ArrayList<RecipeConfig>();
public static ArrayList<RecipeConfig> configs = new ArrayList<>();
static File configFile = null;