1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 11:45:51 +00:00

Minor codecleanup & fixed spelling mistake

* Specifying the type in the diamond operator is not necessary in from java 7
* Spelling mistake: convertable -> convertible
* Encapsulated the item & machine variables.
* Changed the constructor as Slimefunitem item is not used anywhere except in the constructor.
This commit is contained in:
Omer Oreg 2019-04-29 14:12:55 +03:00 committed by GitHub
parent bc27ac81b1
commit 364a7944a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,8 +36,8 @@ public class RecipeType {
public static final RecipeType FURNACE = new RecipeType(new CustomItem(Material.FURNACE, "&eFurnace Recipe", 0, new String[] {"", "&a&oJust smelt it in a regular Furnace"})); public static final RecipeType FURNACE = new RecipeType(new CustomItem(Material.FURNACE, "&eFurnace Recipe", 0, new String[] {"", "&a&oJust smelt it in a regular Furnace"}));
public static final RecipeType NULL = new RecipeType(null); public static final RecipeType NULL = new RecipeType(null);
ItemStack item; private ItemStack item;
String machine; private String machine;
public RecipeType(ItemStack item) { public RecipeType(ItemStack item) {
this.item = item; this.item = item;
@ -51,8 +51,7 @@ public class RecipeType {
public RecipeType(String machine, int seconds, ItemStack[] input, ItemStack[] output) { public RecipeType(String machine, int seconds, ItemStack[] input, ItemStack[] output) {
this.machine = machine; this.machine = machine;
SlimefunItem item = getMachine(); this.item = getMachine().getItem();
this.item = item.getItem();
SlimefunRecipes.registerMachineRecipe(machine, seconds, input, output); SlimefunRecipes.registerMachineRecipe(machine, seconds, input, output);
} }
@ -66,23 +65,23 @@ public class RecipeType {
} }
public static List<ItemStack> getRecipeInputs(SlimefunItem machine) { public static List<ItemStack> getRecipeInputs(SlimefunItem machine) {
if (machine == null) return new ArrayList<ItemStack>(); if (machine == null) return new ArrayList<>();
List<ItemStack[]> recipes = (machine instanceof SlimefunMachine ? ((SlimefunMachine) machine).getRecipes(): ((SlimefunGadget) machine).getRecipes()); List<ItemStack[]> recipes = (machine instanceof SlimefunMachine ? ((SlimefunMachine) machine).getRecipes(): ((SlimefunGadget) machine).getRecipes());
List<ItemStack> convertable = new ArrayList<ItemStack>(); List<ItemStack> convertible = new ArrayList<>();
for (int i = 0; i < recipes.size(); i++) { for (int i = 0; i < recipes.size(); i++) {
if (i % 2 == 0) convertable.add(recipes.get(i)[0]); if (i % 2 == 0) convertible.add(recipes.get(i)[0]);
} }
return convertable; return convertible;
} }
public static List<ItemStack[]> getRecipeInputList(SlimefunItem machine) { public static List<ItemStack[]> getRecipeInputList(SlimefunItem machine) {
if (machine == null) return new ArrayList<ItemStack[]>(); if (machine == null) return new ArrayList<>();
List<ItemStack[]> recipes = (machine instanceof SlimefunMachine ? ((SlimefunMachine) machine).getRecipes(): ((SlimefunGadget) machine).getRecipes()); List<ItemStack[]> recipes = (machine instanceof SlimefunMachine ? ((SlimefunMachine) machine).getRecipes(): ((SlimefunGadget) machine).getRecipes());
List<ItemStack[]> convertable = new ArrayList<ItemStack[]>(); List<ItemStack[]> convertible = new ArrayList<>();
for (int i = 0; i < recipes.size(); i++) { for (int i = 0; i < recipes.size(); i++) {
if (i % 2 == 0) convertable.add(recipes.get(i)); if (i % 2 == 0) convertible.add(recipes.get(i));
} }
return convertable; return convertible;
} }
public static ItemStack getRecipeOutput(SlimefunItem machine, ItemStack input) { public static ItemStack getRecipeOutput(SlimefunItem machine, ItemStack input) {