Auto Format code

This commit is contained in:
modmuss50 2016-10-08 20:46:16 +01:00
parent 112b1657cf
commit 796df6c055
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
503 changed files with 12260 additions and 16291 deletions

View file

@ -4,50 +4,50 @@ import net.minecraft.item.ItemStack;
public interface ISubItemRetriever {
ItemStack getCellByName(String name);
ItemStack getCellByName(String name);
ItemStack getCellByName(String name, int count);
ItemStack getCellByName(String name, int count);
ItemStack getCellByName(String name, int count, boolean lookForIC2);
ItemStack getCellByName(String name, int count, boolean lookForIC2);
ItemStack getDustByName(String name);
ItemStack getDustByName(String name);
ItemStack getDustByName(String name, int count);
ItemStack getDustByName(String name, int count);
ItemStack getSmallDustByName(String name);
ItemStack getSmallDustByName(String name);
ItemStack getSmallDustByName(String name, int count);
ItemStack getSmallDustByName(String name, int count);
ItemStack getGemByName(String name);
ItemStack getGemByName(String name);
ItemStack getGemByName(String name, int count);
ItemStack getGemByName(String name, int count);
ItemStack getIngotByName(String name);
ItemStack getIngotByName(String name);
ItemStack getIngotByName(String name, int count);
ItemStack getIngotByName(String name, int count);
ItemStack getNuggetByName(String name);
ItemStack getNuggetByName(String name);
ItemStack getNuggetByName(String name, int count);
ItemStack getNuggetByName(String name, int count);
ItemStack getPartByName(String name);
ItemStack getPartByName(String name);
ItemStack getPartByName(String name, int count);
ItemStack getPartByName(String name, int count);
ItemStack getPlateByName(String name);
ItemStack getPlateByName(String name);
ItemStack getPlateByName(String name, int count);
ItemStack getPlateByName(String name, int count);
ItemStack getUpgradeByName(String name);
ItemStack getUpgradeByName(String name);
ItemStack getUpgradeByName(String name, int count);
ItemStack getUpgradeByName(String name, int count);
ItemStack getOreByName(String name);
ItemStack getOreByName(String name);
ItemStack getOreByName(String name, int count);
ItemStack getOreByName(String name, int count);
ItemStack getStorageBlockByName(String name);
ItemStack getStorageBlockByName(String name);
ItemStack getStorageBlockByName(String name, int count);
ItemStack getStorageBlockByName(String name, int count);
}

View file

@ -6,56 +6,59 @@ import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.common.util.EnumHelper;
/**
* This contains some static stuff used in recipes and other things
*/
//TODO move this out of the api, and make it nicer
public class Reference {
private static final Class<?>[] ARMOR_PARAMETERS = { String.class, int.class, int[].class, int.class, SoundEvent.class, float.class };
public static ArmorMaterial BRONZE_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "BRONZE", ARMOR_PARAMETERS, "techreborn:bronze", 17, new int[] { 3, 6, 5,
2 }, 8, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
public static ArmorMaterial RUBY_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "RUBY", ARMOR_PARAMETERS, "techreborn:ruby", 16, new int[] { 2, 7, 5,
2 }, 10, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
public static ArmorMaterial SAPPHIRE_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "SAPPHIRE", ARMOR_PARAMETERS, "techreborn:sapphire", 19, new int[] { 4, 4, 4,
4 }, 8, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
public static ArmorMaterial PERIDOT_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "PERIDOT", ARMOR_PARAMETERS, "techreborn:peridot", 17, new int[] { 3, 8, 3,
2 }, 16, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
private static final Class<?>[] ARMOR_PARAMETERS = {String.class, int.class, int[].class, int.class, SoundEvent.class, float.class};
public static ArmorMaterial BRONZE_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "BRONZE", ARMOR_PARAMETERS, "techreborn:bronze", 17, new int[]{3, 6, 5, 2}, 8, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
public static ArmorMaterial RUBY_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "RUBY", ARMOR_PARAMETERS, "techreborn:ruby", 16, new int[]{2, 7, 5, 2}, 10, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
public static ArmorMaterial SAPPHIRE_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "SAPPHIRE", ARMOR_PARAMETERS, "techreborn:sapphire", 19, new int[]{4, 4, 4, 4}, 8, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
public static ArmorMaterial PERIDOT_ARMOUR = EnumHelper.addEnum(ArmorMaterial.class, "PERIDOT", ARMOR_PARAMETERS, "techreborn:peridot", 17, new int[]{3, 8, 3, 2}, 16, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0F);
public static ToolMaterial BRONZE = EnumHelper.addToolMaterial("BRONZE", 2, 375, 6.0F, 2.25F, 8);
// public static ArmorMaterial BRONZE_ARMOUR = addArmorMaterial("BRONZE", "techreborn:bronze", 17,
// new int[]{3, 6, 5, 2}, 8, null/* TODO: SoundEvent */, 0.0F);
public static ToolMaterial RUBY = EnumHelper.addToolMaterial("RUBY", 2, 320, 6.2F, 2.7F, 10);
// public static ArmorMaterial RUBY_ARMOUR = addArmorMaterial("RUBY", "techreborn:ruby", 16,
// new int[]{2, 7, 5, 2}, 10, null/* TODO: SoundEvent */, 0.0F);
public static ToolMaterial BRONZE = EnumHelper.addToolMaterial("BRONZE", 2, 375, 6.0F, 2.25F, 8);
// public static ArmorMaterial BRONZE_ARMOUR = addArmorMaterial("BRONZE", "techreborn:bronze", 17,
// new int[]{3, 6, 5, 2}, 8, null/* TODO: SoundEvent */, 0.0F);
public static ToolMaterial SAPPHIRE = EnumHelper.addToolMaterial("SAPPHIRE", 2, 620, 5.0F, 2F, 8);
// public static ArmorMaterial SAPPHIRE_ARMOUR = addArmorMaterial("SAPPHIRE", "techreborn:sapphire",
// 19, new int[]{4, 4, 4, 4}, 8, null/* TODO: SoundEvent */, 0.0F);
public static ToolMaterial RUBY = EnumHelper.addToolMaterial("RUBY", 2, 320, 6.2F, 2.7F, 10);
// public static ArmorMaterial RUBY_ARMOUR = addArmorMaterial("RUBY", "techreborn:ruby", 16,
// new int[]{2, 7, 5, 2}, 10, null/* TODO: SoundEvent */, 0.0F);
public static ToolMaterial PERIDOT = EnumHelper.addToolMaterial("PERIDOT", 2, 400, 7.0F, 2.4F, 16);
// public static ArmorMaterial PERIDOT_ARMOUR = addArmorMaterial("PERIDOT", "techreborn:peridot", 17,
// new int[]{3, 8, 3, 2}, 16, null/* TODO: SoundEvent */, 0.0F);
public static ToolMaterial SAPPHIRE = EnumHelper.addToolMaterial("SAPPHIRE", 2, 620, 5.0F, 2F, 8);
// public static ArmorMaterial SAPPHIRE_ARMOUR = addArmorMaterial("SAPPHIRE", "techreborn:sapphire",
// 19, new int[]{4, 4, 4, 4}, 8, null/* TODO: SoundEvent */, 0.0F);
public static ArmorMaterial addArmorMaterial(String name, String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip, float toughness) {
return ArmorMaterial.LEATHER;
}
public static ToolMaterial PERIDOT = EnumHelper.addToolMaterial("PERIDOT", 2, 400, 7.0F, 2.4F, 16);
// public static ArmorMaterial PERIDOT_ARMOUR = addArmorMaterial("PERIDOT", "techreborn:peridot", 17,
// new int[]{3, 8, 3, 2}, 16, null/* TODO: SoundEvent */, 0.0F);
public static ArmorMaterial addArmorMaterial(String name, String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip, float toughness) {
return ArmorMaterial.LEATHER;
}
public static String alloySmelteRecipe = I18n.translateToLocal("techreborn.recipe.alloysmelter");
public static String assemblingMachineRecipe = I18n.translateToLocal("techreborn.recipe.assemblingmachine");
public static String blastFurnaceRecipe = I18n.translateToLocal("techreborn.recipe.blastfurnace");
public static String centrifugeRecipe = I18n.translateToLocal("techreborn.recipe.centrifuge");
public static String chemicalReactorRecipe = I18n.translateToLocal("techreborn.recipe.chemicalReactor");
public static String industrialGrinderRecipe = I18n.translateToLocal("techreborn.recipe.grinder");
public static String implosionCompressorRecipe = I18n.translateToLocal("techreborn.recipe.implosioncompressor");
public static String industrialElectrolyzerRecipe = I18n
.translateToLocal("techreborn.recipe.industrialelectrolyzer");
public static String industrialSawmillRecipe = I18n.translateToLocal("techreborn.recipe.industrialsawmill");
public static String latheRecipe = I18n.translateToLocal("techreborn.recipe.lathe");
public static String plateCuttingMachineRecipe = I18n.translateToLocal("techreborn.recipe.platecuttingmachine");
public static String vacuumFreezerRecipe = I18n.translateToLocal("tile.techreborn.vacuumfreezer.name");
public static String grinderRecipe = I18n.translateToLocal("tile.techreborn.grinder.name");
public static String extractorRecipe = I18n.translateToLocal("tile.techreborn.extractor.name");
public static String compressorRecipe = I18n.translateToLocal("tile.techreborn.compressor.name");
public static String recyclerRecipe = I18n.translateToLocal("tile.techreborn.recycler.name");
public static String scrapboxRecipe = I18n.translateToLocal("techreborn.recipe.scrapbox");
public static String alloySmelteRecipe = I18n.translateToLocal("techreborn.recipe.alloysmelter");
public static String assemblingMachineRecipe = I18n.translateToLocal("techreborn.recipe.assemblingmachine");
public static String blastFurnaceRecipe = I18n.translateToLocal("techreborn.recipe.blastfurnace");
public static String centrifugeRecipe = I18n.translateToLocal("techreborn.recipe.centrifuge");
public static String chemicalReactorRecipe = I18n.translateToLocal("techreborn.recipe.chemicalReactor");
public static String industrialGrinderRecipe = I18n.translateToLocal("techreborn.recipe.grinder");
public static String implosionCompressorRecipe = I18n.translateToLocal("techreborn.recipe.implosioncompressor");
public static String industrialElectrolyzerRecipe = I18n
.translateToLocal("techreborn.recipe.industrialelectrolyzer");
public static String industrialSawmillRecipe = I18n.translateToLocal("techreborn.recipe.industrialsawmill");
public static String latheRecipe = I18n.translateToLocal("techreborn.recipe.lathe");
public static String plateCuttingMachineRecipe = I18n.translateToLocal("techreborn.recipe.platecuttingmachine");
public static String vacuumFreezerRecipe = I18n.translateToLocal("tile.techreborn.vacuumfreezer.name");
public static String grinderRecipe = I18n.translateToLocal("tile.techreborn.grinder.name");
public static String extractorRecipe = I18n.translateToLocal("tile.techreborn.extractor.name");
public static String compressorRecipe = I18n.translateToLocal("tile.techreborn.compressor.name");
public static String recyclerRecipe = I18n.translateToLocal("tile.techreborn.recycler.name");
public static String scrapboxRecipe = I18n.translateToLocal("techreborn.recipe.scrapbox");
}

View file

@ -18,110 +18,110 @@ import java.util.List;
public class RollingMachineRecipe {
public static final RollingMachineRecipe instance = new RollingMachineRecipe();
private final List<IRecipe> recipes = new ArrayList<>();
public static final RollingMachineRecipe instance = new RollingMachineRecipe();
private final List<IRecipe> recipes = new ArrayList<>();
public void addShapedOreRecipe(ItemStack outputItemStack, Object... objectInputs) {
Validate.notNull(outputItemStack);
Validate.notNull(outputItemStack.getItem());
if(objectInputs.length == 0){
Validate.notNull(null); //Quick way to crash
}
recipes.add(new ShapedOreRecipe(outputItemStack, objectInputs));
}
public void addShapedOreRecipe(ItemStack outputItemStack, Object... objectInputs) {
Validate.notNull(outputItemStack);
Validate.notNull(outputItemStack.getItem());
if (objectInputs.length == 0) {
Validate.notNull(null); //Quick way to crash
}
recipes.add(new ShapedOreRecipe(outputItemStack, objectInputs));
}
public void addShapelessOreRecipe(ItemStack outputItemStack, Object... objectInputs) {
Validate.notNull(outputItemStack);
Validate.notNull(outputItemStack.getItem());
if(objectInputs.length == 0){
Validate.notNull(null); //Quick way to crash
}
recipes.add(new ShapelessOreRecipe(outputItemStack, objectInputs));
}
public void addShapelessOreRecipe(ItemStack outputItemStack, Object... objectInputs) {
Validate.notNull(outputItemStack);
Validate.notNull(outputItemStack.getItem());
if (objectInputs.length == 0) {
Validate.notNull(null); //Quick way to crash
}
recipes.add(new ShapelessOreRecipe(outputItemStack, objectInputs));
}
public void addRecipe(ItemStack output, Object... components) {
String s = "";
int i = 0;
int j = 0;
int k = 0;
if (components[i] instanceof String[]) {
String as[] = (String[]) components[i++];
for (int l = 0; l < as.length; l++) {
String s2 = as[l];
k++;
j = s2.length();
s = (new StringBuilder()).append(s).append(s2).toString();
}
} else {
while (components[i] instanceof String) {
String s1 = (String) components[i++];
k++;
j = s1.length();
s = (new StringBuilder()).append(s).append(s1).toString();
}
}
HashMap hashmap = new HashMap();
for (; i < components.length; i += 2) {
Character character = (Character) components[i];
ItemStack itemstack1 = null;
if (components[i + 1] instanceof Item) {
itemstack1 = new ItemStack((Item) components[i + 1]);
} else if (components[i + 1] instanceof Block) {
itemstack1 = new ItemStack((Block) components[i + 1], 1, -1);
} else if (components[i + 1] instanceof ItemStack) {
itemstack1 = (ItemStack) components[i + 1];
}
hashmap.put(character, itemstack1);
}
public void addRecipe(ItemStack output, Object... components) {
String s = "";
int i = 0;
int j = 0;
int k = 0;
if (components[i] instanceof String[]) {
String as[] = (String[]) components[i++];
for (int l = 0; l < as.length; l++) {
String s2 = as[l];
k++;
j = s2.length();
s = (new StringBuilder()).append(s).append(s2).toString();
}
} else {
while (components[i] instanceof String) {
String s1 = (String) components[i++];
k++;
j = s1.length();
s = (new StringBuilder()).append(s).append(s1).toString();
}
}
HashMap hashmap = new HashMap();
for (; i < components.length; i += 2) {
Character character = (Character) components[i];
ItemStack itemstack1 = null;
if (components[i + 1] instanceof Item) {
itemstack1 = new ItemStack((Item) components[i + 1]);
} else if (components[i + 1] instanceof Block) {
itemstack1 = new ItemStack((Block) components[i + 1], 1, -1);
} else if (components[i + 1] instanceof ItemStack) {
itemstack1 = (ItemStack) components[i + 1];
}
hashmap.put(character, itemstack1);
}
ItemStack recipeArray[] = new ItemStack[j * k];
for (int i1 = 0; i1 < j * k; i1++) {
char c = s.charAt(i1);
if (hashmap.containsKey(c)) {
recipeArray[i1] = ((ItemStack) hashmap.get(c)).copy();
} else {
recipeArray[i1] = null;
}
}
ItemStack recipeArray[] = new ItemStack[j * k];
for (int i1 = 0; i1 < j * k; i1++) {
char c = s.charAt(i1);
if (hashmap.containsKey(c)) {
recipeArray[i1] = ((ItemStack) hashmap.get(c)).copy();
} else {
recipeArray[i1] = null;
}
}
recipes.add(new ShapedRecipes(j, k, recipeArray, output));
}
recipes.add(new ShapedRecipes(j, k, recipeArray, output));
}
public void addShapelessRecipe(ItemStack output, Object... components) {
List<ItemStack> ingredients = new ArrayList<>();
for (int j = 0; j < components.length; j++) {
Object obj = components[j];
if (obj instanceof ItemStack) {
ingredients.add(((ItemStack) obj).copy());
continue;
}
if (obj instanceof Item) {
ingredients.add(new ItemStack((Item) obj));
continue;
}
if (obj instanceof Block) {
ingredients.add(new ItemStack((Block) obj));
} else {
throw new RuntimeException("Invalid shapeless recipe!");
}
}
public void addShapelessRecipe(ItemStack output, Object... components) {
List<ItemStack> ingredients = new ArrayList<>();
for (int j = 0; j < components.length; j++) {
Object obj = components[j];
if (obj instanceof ItemStack) {
ingredients.add(((ItemStack) obj).copy());
continue;
}
if (obj instanceof Item) {
ingredients.add(new ItemStack((Item) obj));
continue;
}
if (obj instanceof Block) {
ingredients.add(new ItemStack((Block) obj));
} else {
throw new RuntimeException("Invalid shapeless recipe!");
}
}
recipes.add(new ShapelessRecipes(output, ingredients));
}
recipes.add(new ShapelessRecipes(output, ingredients));
}
public ItemStack findMatchingRecipe(InventoryCrafting inv, World world) {
for (int k = 0; k < recipes.size(); k++) {
IRecipe irecipe = recipes.get(k);
if (irecipe.matches(inv, world)) {
return irecipe.getCraftingResult(inv);
}
}
public ItemStack findMatchingRecipe(InventoryCrafting inv, World world) {
for (int k = 0; k < recipes.size(); k++) {
IRecipe irecipe = recipes.get(k);
if (irecipe.matches(inv, world)) {
return irecipe.getCraftingResult(inv);
}
}
return null;
}
return null;
}
public List<IRecipe> getRecipeList() {
return recipes;
}
public List<IRecipe> getRecipeList() {
return recipes;
}
}

View file

@ -11,32 +11,32 @@ import java.util.List;
*/
public class ScrapboxList {
/**
* This full list of items that is registered with this api
*/
public static List<ItemStack> stacks = new ArrayList<>();
/**
* This full list of items that is registered with this api
*/
public static List<ItemStack> stacks = new ArrayList<>();
/**
* Use this to add an item stack to the list
*
* @param stack the itemstack you want to add
*/
public static void addItemStackToList(ItemStack stack) {
if (!hasItems(stack)) {
stacks.add(stack);
}
}
/**
* Use this to add an item stack to the list
*
* @param stack the itemstack you want to add
*/
public static void addItemStackToList(ItemStack stack) {
if (!hasItems(stack)) {
stacks.add(stack);
}
}
/**
* @param stack the itemstack you want to test
* @return if the scrapbox can output this this item
*/
private static boolean hasItems(ItemStack stack) {
for (ItemStack s : stacks) {
// TODO why do this!!!!!!!!!
if (stack.getDisplayName().equals(s.getDisplayName()))
return true;
}
return false;
}
/**
* @param stack the itemstack you want to test
* @return if the scrapbox can output this this item
*/
private static boolean hasItems(ItemStack stack) {
for (ItemStack s : stacks) {
// TODO why do this!!!!!!!!!
if (stack.getDisplayName().equals(s.getDisplayName()))
return true;
}
return false;
}
}

View file

@ -7,75 +7,75 @@ import techreborn.api.recipe.IRecipeCompact;
public final class TechRebornAPI {
/**
* Use this to get the instance of IRecipeCompat
*/
public static IRecipeCompact recipeCompact;
/**
* Use this to get the instance of IRecipeCompat
*/
public static IRecipeCompact recipeCompact;
public static ISubItemRetriever subItemRetriever;
public static ISubItemRetriever subItemRetriever;
public static void addRollingOreMachinceRecipe(ItemStack output, Object... components) {
RollingMachineRecipe.instance.addShapedOreRecipe(output, components);
}
public static void addRollingOreMachinceRecipe(ItemStack output, Object... components) {
RollingMachineRecipe.instance.addShapedOreRecipe(output, components);
}
public static void addShapelessOreRollingMachinceRecipe(ItemStack output, Object... components) {
RollingMachineRecipe.instance.addShapelessOreRecipe(output, components);
}
public static void addShapelessOreRollingMachinceRecipe(ItemStack output, Object... components) {
RollingMachineRecipe.instance.addShapelessOreRecipe(output, components);
}
public static void addRollingMachinceRecipe(ItemStack output, Object... components) {
RollingMachineRecipe.instance.addRecipe(output, components);
}
public static void addRollingMachinceRecipe(ItemStack output, Object... components) {
RollingMachineRecipe.instance.addRecipe(output, components);
}
public static void addShapelessRollingMachinceRecipe(ItemStack output, Object... components) {
RollingMachineRecipe.instance.addShapelessRecipe(output, components);
}
public static void addShapelessRollingMachinceRecipe(ItemStack output, Object... components) {
RollingMachineRecipe.instance.addShapelessRecipe(output, components);
}
/**
* Use this to get an item from techrebonrn, @see <a href=
* "https://github.com/TechReborn/TechReborn/blob/1.9/src/main/java/techreborn/init/ModItems.java">
* ModItems.java</a> for the full list
*
* @param name
* @return
*/
public static Item getItem(String name) {
try {
Object e = Class.forName("techreborn.init.ModItems").getField(name).get(null);
return e instanceof Item ? (Item) e : null;
} catch (NoSuchFieldException e1) {
e1.printStackTrace();
return null;
} catch (IllegalAccessException e) {
e.printStackTrace();
return null;
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
}
}
/**
* Use this to get an item from techrebonrn, @see <a href=
* "https://github.com/TechReborn/TechReborn/blob/1.9/src/main/java/techreborn/init/ModItems.java">
* ModItems.java</a> for the full list
*
* @param name
* @return
*/
public static Item getItem(String name) {
try {
Object e = Class.forName("techreborn.init.ModItems").getField(name).get(null);
return e instanceof Item ? (Item) e : null;
} catch (NoSuchFieldException e1) {
e1.printStackTrace();
return null;
} catch (IllegalAccessException e) {
e.printStackTrace();
return null;
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
}
}
/**
* Use this to get an block from techrebonrn, @see <a href=
* "https://github.com/TechReborn/TechReborn/blob/1.9/src/main/java/techreborn/init/ModBlocks.java">
* ModBlocks.java</a> for the full list
*
* @param name
* @return
*/
public static Block getBlock(String name) {
try {
Object e = Class.forName("techreborn.init.ModBlocks").getField(name).get(null);
return e instanceof Block ? (Block) e : null;
} catch (NoSuchFieldException e1) {
e1.printStackTrace();
return null;
} catch (IllegalAccessException e) {
e.printStackTrace();
return null;
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
}
}
/**
* Use this to get an block from techrebonrn, @see <a href=
* "https://github.com/TechReborn/TechReborn/blob/1.9/src/main/java/techreborn/init/ModBlocks.java">
* ModBlocks.java</a> for the full list
*
* @param name
* @return
*/
public static Block getBlock(String name) {
try {
Object e = Class.forName("techreborn.init.ModBlocks").getField(name).get(null);
return e instanceof Block ? (Block) e : null;
} catch (NoSuchFieldException e1) {
e1.printStackTrace();
return null;
} catch (IllegalAccessException e) {
e.printStackTrace();
return null;
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
}
}
}

View file

@ -1,19 +1,18 @@
package techreborn.api.gui;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import reborncore.client.gui.BaseSlot;
import techreborn.utils.upgrade.IMachineUpgrade;
public class SlotUpgrade extends BaseSlot {
public SlotUpgrade(IInventory inventoryIn, int index, int xPosition, int yPosition) {
super(inventoryIn, index, xPosition, yPosition);
}
public SlotUpgrade(IInventory inventoryIn, int index, int xPosition, int yPosition) {
super(inventoryIn, index, xPosition, yPosition);
}
@Override
public boolean isItemValid(ItemStack stack) {
return stack.getItem() instanceof IMachineUpgrade;
}
@Override
public boolean isItemValid(ItemStack stack) {
return stack.getItem() instanceof IMachineUpgrade;
}
}

View file

@ -4,82 +4,82 @@ import net.minecraft.item.ItemStack;
public class FusionReactorRecipe {
/**
* This is the item stack that is required in the top slot
* <p>
* This cannot be null
*/
ItemStack topInput;
/**
* This is the item stack that is required in the top slot
* <p>
* This cannot be null
*/
ItemStack topInput;
/**
* This is the item stack that is required in the bottom slot
* <p>
* This can be null
*/
ItemStack bottomInput;
/**
* This is the item stack that is required in the bottom slot
* <p>
* This can be null
*/
ItemStack bottomInput;
/**
* This is the output stack
* <p>
* This cannot be null
*/
ItemStack output;
/**
* This is the output stack
* <p>
* This cannot be null
*/
ItemStack output;
/**
* This is the required eu that has to be in the rector for the reaction to
* start
*/
double startEU;
/**
* This is the eu that changes every tick, set as a minus number to use
* power and a positive number to gen power.
*/
double euTick;
/**
* This is the required eu that has to be in the rector for the reaction to
* start
*/
double startEU;
/**
* This is the eu that changes every tick, set as a minus number to use
* power and a positive number to gen power.
*/
double euTick;
/**
* This is the time in ticks that the reaction takes to complete
*/
int tickTime;
/**
* This is the time in ticks that the reaction takes to complete
*/
int tickTime;
/**
* @param topInput This is the top slot stack
* @param bottomInput This is the bottom slot stack
* @param output This is the output stack
* @param startEU This is the inital EU amount
* @param euTick This is the eu that is transfured every tick
* @param tickTime This is the time the recipe takes to process
*/
public FusionReactorRecipe(ItemStack topInput, ItemStack bottomInput, ItemStack output, double startEU,
double euTick, int tickTime) {
this.topInput = topInput;
this.bottomInput = bottomInput;
this.output = output;
this.startEU = startEU;
this.euTick = euTick;
this.tickTime = tickTime;
}
/**
* @param topInput This is the top slot stack
* @param bottomInput This is the bottom slot stack
* @param output This is the output stack
* @param startEU This is the inital EU amount
* @param euTick This is the eu that is transfured every tick
* @param tickTime This is the time the recipe takes to process
*/
public FusionReactorRecipe(ItemStack topInput, ItemStack bottomInput, ItemStack output, double startEU,
double euTick, int tickTime) {
this.topInput = topInput;
this.bottomInput = bottomInput;
this.output = output;
this.startEU = startEU;
this.euTick = euTick;
this.tickTime = tickTime;
}
public ItemStack getTopInput() {
return topInput;
}
public ItemStack getTopInput() {
return topInput;
}
public ItemStack getBottomInput() {
return bottomInput;
}
public ItemStack getBottomInput() {
return bottomInput;
}
public ItemStack getOutput() {
return output;
}
public ItemStack getOutput() {
return output;
}
public double getStartEU() {
return startEU;
}
public double getStartEU() {
return startEU;
}
public double getEuTick() {
return euTick;
}
public double getEuTick() {
return euTick;
}
public int getTickTime() {
return tickTime;
}
public int getTickTime() {
return tickTime;
}
}

View file

@ -4,17 +4,17 @@ import java.util.ArrayList;
public class FusionReactorRecipeHelper {
/**
* This is the list of all the recipes
*/
public static ArrayList<FusionReactorRecipe> reactorRecipes = new ArrayList<>();
/**
* This is the list of all the recipes
*/
public static ArrayList<FusionReactorRecipe> reactorRecipes = new ArrayList<>();
/**
* Register your reactor recipe here
*
* @param reactorRecipe the recipe you want to add
*/
public static void registerRecipe(FusionReactorRecipe reactorRecipe) {
reactorRecipes.add(reactorRecipe);
}
/**
* Register your reactor recipe here
*
* @param reactorRecipe the recipe you want to add
*/
public static void registerRecipe(FusionReactorRecipe reactorRecipe) {
reactorRecipes.add(reactorRecipe);
}
}

View file

@ -12,83 +12,83 @@ import java.util.List;
*/
public abstract class BaseRecipe implements IBaseRecipeType, Cloneable {
public ArrayList<ItemStack> inputs;
public String name;
public int tickTime;
public int euPerTick;
private ArrayList<ItemStack> outputs;
public ArrayList<ItemStack> inputs;
public String name;
public int tickTime;
public int euPerTick;
private ArrayList<ItemStack> outputs;
public BaseRecipe(String name, int tickTime, int euPerTick) {
inputs = new ArrayList<>();
outputs = new ArrayList<>();
this.name = name;
// This adds all new recipes
this.tickTime = tickTime;
this.euPerTick = euPerTick;
}
public BaseRecipe(String name, int tickTime, int euPerTick) {
inputs = new ArrayList<>();
outputs = new ArrayList<>();
this.name = name;
// This adds all new recipes
this.tickTime = tickTime;
this.euPerTick = euPerTick;
}
@Override
public ItemStack getOutput(int i) {
return outputs.get(i).copy();
}
@Override
public ItemStack getOutput(int i) {
return outputs.get(i).copy();
}
@Override
public int getOutputsSize() {
return outputs.size();
}
@Override
public int getOutputsSize() {
return outputs.size();
}
public void addOutput(ItemStack stack) {
outputs.add(stack);
}
public void addOutput(ItemStack stack) {
outputs.add(stack);
}
@Override
public List<ItemStack> getInputs() {
return inputs;
}
@Override
public List<ItemStack> getInputs() {
return inputs;
}
@Override
public String getRecipeName() {
return name;
}
@Override
public String getRecipeName() {
return name;
}
@Override
public int tickTime() {
return tickTime;
}
@Override
public int tickTime() {
return tickTime;
}
@Override
public int euPerTick() {
return euPerTick;
}
@Override
public int euPerTick() {
return euPerTick;
}
@Override
public boolean canCraft(TileEntity tile) {
if(tile instanceof ITileRecipeHandler){
return ((ITileRecipeHandler) tile).canCraft(tile, this);
}
return true;
}
@Override
public boolean canCraft(TileEntity tile) {
if (tile instanceof ITileRecipeHandler) {
return ((ITileRecipeHandler) tile).canCraft(tile, this);
}
return true;
}
@Override
public boolean onCraft(TileEntity tile) {
if(tile instanceof ITileRecipeHandler){
return ((ITileRecipeHandler) tile).onCraft(tile, this);
}
return true;
}
@Override
public boolean onCraft(TileEntity tile) {
if (tile instanceof ITileRecipeHandler) {
return ((ITileRecipeHandler) tile).onCraft(tile, this);
}
return true;
}
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
@Override
public boolean useOreDic() {
return true;
}
@Override
public boolean useOreDic() {
return true;
}
@Override
public List<ItemStack> getOutputs() {
return outputs;
}
@Override
public List<ItemStack> getOutputs() {
return outputs;
}
}

View file

@ -5,5 +5,5 @@ import net.minecraft.item.ItemStack;
public interface IRecipeCompact {
ImmutableList<ItemStack> getItems(String name);
ImmutableList<ItemStack> getItems(String name);
}

View file

@ -6,7 +6,7 @@ import net.minecraft.tileentity.TileEntity;
* Created by Mark on 03/04/2016.
*/
public interface ITileRecipeHandler<T extends BaseRecipe> {
boolean canCraft(TileEntity tile, T recipe);
boolean canCraft(TileEntity tile, T recipe);
boolean onCraft(TileEntity tile, T recipe);
boolean onCraft(TileEntity tile, T recipe);
}

View file

@ -7,14 +7,14 @@ import techreborn.api.TechRebornAPI;
//THIS is only here to trick JEI into showing recipes for the recycler
public class RecyclerRecipe extends BaseRecipe {
public RecyclerRecipe(ItemStack input) {
super(Reference.recyclerRecipe, 0, 0);
inputs.add(input);
addOutput(TechRebornAPI.subItemRetriever.getPartByName("scrap"));
}
public RecyclerRecipe(ItemStack input) {
super(Reference.recyclerRecipe, 0, 0);
inputs.add(input);
addOutput(TechRebornAPI.subItemRetriever.getPartByName("scrap"));
}
@Override
public String getUserFreindlyName() {
return "Recycler";
}
@Override
public String getUserFreindlyName() {
return "Recycler";
}
}

View file

@ -6,14 +6,14 @@ import techreborn.api.TechRebornAPI;
public class ScrapboxRecipe extends BaseRecipe {
public ScrapboxRecipe(ItemStack output) {
super(Reference.scrapboxRecipe, 0, 0);
inputs.add(new ItemStack(TechRebornAPI.getItem("scrapBox")));
addOutput(output);
}
public ScrapboxRecipe(ItemStack output) {
super(Reference.scrapboxRecipe, 0, 0);
inputs.add(new ItemStack(TechRebornAPI.getItem("scrapBox")));
addOutput(output);
}
@Override
public String getUserFreindlyName() {
return "Scrapbox";
}
@Override
public String getUserFreindlyName() {
return "Scrapbox";
}
}

View file

@ -6,18 +6,18 @@ import techreborn.api.recipe.BaseRecipe;
public class AlloySmelterRecipe extends BaseRecipe {
public AlloySmelterRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick) {
super(Reference.alloySmelteRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
}
public AlloySmelterRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick) {
super(Reference.alloySmelteRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
}
@Override
public String getUserFreindlyName() {
return "Alloy Smelter";
}
@Override
public String getUserFreindlyName() {
return "Alloy Smelter";
}
}

View file

@ -6,18 +6,18 @@ import techreborn.api.recipe.BaseRecipe;
public class AssemblingMachineRecipe extends BaseRecipe {
public AssemblingMachineRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick) {
super(Reference.assemblingMachineRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
}
public AssemblingMachineRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick) {
super(Reference.assemblingMachineRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
}
@Override
public String getUserFreindlyName() {
return "Assembling Machine";
}
@Override
public String getUserFreindlyName() {
return "Assembling Machine";
}
}

View file

@ -6,25 +6,25 @@ import techreborn.api.recipe.BaseRecipe;
public class BlastFurnaceRecipe extends BaseRecipe {
public int neededHeat;
public int neededHeat;
public BlastFurnaceRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, int tickTime,
int euPerTick, int neededHeat) {
super(Reference.blastFurnaceRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
if (output2 != null)
addOutput(output2);
public BlastFurnaceRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, int tickTime,
int euPerTick, int neededHeat) {
super(Reference.blastFurnaceRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
if (output2 != null)
addOutput(output2);
this.neededHeat = neededHeat;
}
this.neededHeat = neededHeat;
}
@Override
public String getUserFreindlyName() {
return "Blast Furnace";
}
@Override
public String getUserFreindlyName() {
return "Blast Furnace";
}
}

View file

@ -6,38 +6,38 @@ import techreborn.api.recipe.BaseRecipe;
public class CentrifugeRecipe extends BaseRecipe {
boolean useOreDic = false;
boolean useOreDic = false;
public CentrifugeRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, ItemStack output3,
ItemStack output4, int tickTime, int euPerTick) {
super(Reference.centrifugeRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
if (output2 != null)
addOutput(output2);
if (output3 != null)
addOutput(output3);
if (output4 != null)
addOutput(output4);
}
public CentrifugeRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, ItemStack output3,
ItemStack output4, int tickTime, int euPerTick) {
super(Reference.centrifugeRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
if (output2 != null)
addOutput(output2);
if (output3 != null)
addOutput(output3);
if (output4 != null)
addOutput(output4);
}
public CentrifugeRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, ItemStack output3,
ItemStack output4, int tickTime, int euPerTick, boolean useOreDic) {
this(input1, input2, output1, output2, output3, output4, tickTime, euPerTick);
this.useOreDic = useOreDic;
}
public CentrifugeRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, ItemStack output3,
ItemStack output4, int tickTime, int euPerTick, boolean useOreDic) {
this(input1, input2, output1, output2, output3, output4, tickTime, euPerTick);
this.useOreDic = useOreDic;
}
@Override
public String getUserFreindlyName() {
return "Centrifuge";
}
@Override
public String getUserFreindlyName() {
return "Centrifuge";
}
@Override
public boolean useOreDic() {
return useOreDic;
}
@Override
public boolean useOreDic() {
return useOreDic;
}
}

View file

@ -6,18 +6,18 @@ import techreborn.api.recipe.BaseRecipe;
public class ChemicalReactorRecipe extends BaseRecipe {
public ChemicalReactorRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick) {
super(Reference.chemicalReactorRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
}
public ChemicalReactorRecipe(ItemStack input1, ItemStack input2, ItemStack output1, int tickTime, int euPerTick) {
super(Reference.chemicalReactorRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
}
@Override
public String getUserFreindlyName() {
return "Chemical Reactor";
}
@Override
public String getUserFreindlyName() {
return "Chemical Reactor";
}
}

View file

@ -6,16 +6,16 @@ import techreborn.api.recipe.BaseRecipe;
public class CompressorRecipe extends BaseRecipe {
public CompressorRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
super(Reference.compressorRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (output1 != null)
addOutput(output1);
}
public CompressorRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
super(Reference.compressorRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (output1 != null)
addOutput(output1);
}
@Override
public String getUserFreindlyName() {
return "Compressor";
}
@Override
public String getUserFreindlyName() {
return "Compressor";
}
}

View file

@ -6,28 +6,28 @@ import techreborn.api.recipe.BaseRecipe;
public class ExtractorRecipe extends BaseRecipe {
boolean useOreDic = true;
boolean useOreDic = true;
public ExtractorRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
super(Reference.extractorRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (output1 != null)
addOutput(output1);
}
public ExtractorRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick, boolean useOreDic) {
this(input1, output1, tickTime, euPerTick);
this.useOreDic = useOreDic;
}
public ExtractorRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
super(Reference.extractorRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (output1 != null)
addOutput(output1);
}
public ExtractorRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick, boolean useOreDic) {
this(input1, output1, tickTime, euPerTick);
this.useOreDic = useOreDic;
}
@Override
public String getUserFreindlyName() {
return "Extractor";
}
@Override
public String getUserFreindlyName() {
return "Extractor";
}
@Override
public boolean useOreDic() {
return useOreDic;
}
@Override
public boolean useOreDic() {
return useOreDic;
}
}

View file

@ -6,16 +6,16 @@ import techreborn.api.recipe.BaseRecipe;
public class GrinderRecipe extends BaseRecipe {
public GrinderRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
super(Reference.grinderRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (output1 != null)
addOutput(output1);
}
public GrinderRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
super(Reference.grinderRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (output1 != null)
addOutput(output1);
}
@Override
public String getUserFreindlyName() {
return "Grinder";
}
@Override
public String getUserFreindlyName() {
return "Grinder";
}
}

View file

@ -6,21 +6,21 @@ import techreborn.api.recipe.BaseRecipe;
public class ImplosionCompressorRecipe extends BaseRecipe {
public ImplosionCompressorRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2,
int tickTime, int euPerTick) {
super(Reference.implosionCompressorRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
if (output2 != null)
addOutput(output2);
}
public ImplosionCompressorRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2,
int tickTime, int euPerTick) {
super(Reference.implosionCompressorRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
if (output2 != null)
addOutput(output2);
}
@Override
public String getUserFreindlyName() {
return "Implosion Compressor";
}
@Override
public String getUserFreindlyName() {
return "Implosion Compressor";
}
}

View file

@ -6,32 +6,32 @@ import techreborn.api.recipe.BaseRecipe;
public class IndustrialElectrolyzerRecipe extends BaseRecipe {
private boolean useOreDictionary = true;
private boolean useOreDictionary = true;
public IndustrialElectrolyzerRecipe(ItemStack inputCells, ItemStack input2, ItemStack output1, ItemStack output2,
ItemStack output3, ItemStack output4, int tickTime, int euPerTick) {
super(Reference.industrialElectrolyzerRecipe, tickTime, euPerTick);
if (inputCells != null)
inputs.add(inputCells);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
if (output2 != null)
addOutput(output2);
if (output3 != null)
addOutput(output3);
if (output4 != null)
addOutput(output4);
}
public IndustrialElectrolyzerRecipe(ItemStack inputCells, ItemStack input2, ItemStack output1, ItemStack output2,
ItemStack output3, ItemStack output4, int tickTime, int euPerTick) {
super(Reference.industrialElectrolyzerRecipe, tickTime, euPerTick);
if (inputCells != null)
inputs.add(inputCells);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
if (output2 != null)
addOutput(output2);
if (output3 != null)
addOutput(output3);
if (output4 != null)
addOutput(output4);
}
@Override
public String getUserFreindlyName() {
return "Industrial Electrolyzer";
}
@Override
public String getUserFreindlyName() {
return "Industrial Electrolyzer";
}
@Override
public boolean useOreDic() {
return useOreDictionary;
}
@Override
public boolean useOreDic() {
return useOreDictionary;
}
}

View file

@ -7,26 +7,26 @@ import techreborn.api.recipe.BaseRecipe;
public class IndustrialGrinderRecipe extends BaseRecipe {
public FluidStack fluidStack;
public FluidStack fluidStack;
public IndustrialGrinderRecipe(ItemStack input1, FluidStack fluidStack, ItemStack output1,
ItemStack output2, ItemStack output3, ItemStack output4, int tickTime, int euPerTick) {
super(Reference.industrialGrinderRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (output1 != null)
addOutput(output1);
if (output2 != null)
addOutput(output2);
if (output3 != null)
addOutput(output3);
if (output4 != null)
addOutput(output4);
this.fluidStack = fluidStack;
}
public IndustrialGrinderRecipe(ItemStack input1, FluidStack fluidStack, ItemStack output1,
ItemStack output2, ItemStack output3, ItemStack output4, int tickTime, int euPerTick) {
super(Reference.industrialGrinderRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (output1 != null)
addOutput(output1);
if (output2 != null)
addOutput(output2);
if (output3 != null)
addOutput(output3);
if (output4 != null)
addOutput(output4);
this.fluidStack = fluidStack;
}
@Override
public String getUserFreindlyName() {
return "IndustrialGrinder";
}
@Override
public String getUserFreindlyName() {
return "IndustrialGrinder";
}
}

View file

@ -7,50 +7,50 @@ import techreborn.api.recipe.BaseRecipe;
public class IndustrialSawmillRecipe extends BaseRecipe {
public FluidStack fluidStack;
public FluidStack fluidStack;
public boolean canUseOreDict = false;
public boolean canUseOreDict = false;
public IndustrialSawmillRecipe(ItemStack input1, ItemStack input2, FluidStack fluidStack, ItemStack output1,
ItemStack output2, ItemStack output3, int tickTime, int euPerTick) {
super(Reference.industrialSawmillRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
if (output2 != null)
addOutput(output2);
if (output3 != null)
addOutput(output3);
this.fluidStack = fluidStack;
}
public IndustrialSawmillRecipe(ItemStack input1, ItemStack input2, FluidStack fluidStack, ItemStack output1,
ItemStack output2, ItemStack output3, int tickTime, int euPerTick) {
super(Reference.industrialSawmillRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
if (output2 != null)
addOutput(output2);
if (output3 != null)
addOutput(output3);
this.fluidStack = fluidStack;
}
public IndustrialSawmillRecipe(ItemStack input1, ItemStack input2, FluidStack fluidStack, ItemStack output1,
ItemStack output2, ItemStack output3, int tickTime, int euPerTick, boolean canUseOreDict) {
super(Reference.industrialSawmillRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
if (output2 != null)
addOutput(output2);
if (output3 != null)
addOutput(output3);
this.fluidStack = fluidStack;
this.canUseOreDict = canUseOreDict;
}
public IndustrialSawmillRecipe(ItemStack input1, ItemStack input2, FluidStack fluidStack, ItemStack output1,
ItemStack output2, ItemStack output3, int tickTime, int euPerTick, boolean canUseOreDict) {
super(Reference.industrialSawmillRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (input2 != null)
inputs.add(input2);
if (output1 != null)
addOutput(output1);
if (output2 != null)
addOutput(output2);
if (output3 != null)
addOutput(output3);
this.fluidStack = fluidStack;
this.canUseOreDict = canUseOreDict;
}
@Override
public String getUserFreindlyName() {
return "Industrial Sawmill";
}
@Override
public String getUserFreindlyName() {
return "Industrial Sawmill";
}
@Override
public boolean useOreDic() {
return canUseOreDict;
}
@Override
public boolean useOreDic() {
return canUseOreDict;
}
}

View file

@ -6,16 +6,16 @@ import techreborn.api.recipe.BaseRecipe;
public class PlateCuttingMachineRecipe extends BaseRecipe {
public PlateCuttingMachineRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
super(Reference.plateCuttingMachineRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (output1 != null)
addOutput(output1);
}
public PlateCuttingMachineRecipe(ItemStack input1, ItemStack output1, int tickTime, int euPerTick) {
super(Reference.plateCuttingMachineRecipe, tickTime, euPerTick);
if (input1 != null)
inputs.add(input1);
if (output1 != null)
addOutput(output1);
}
@Override
public String getUserFreindlyName() {
return "Plate Cutting Machine";
}
@Override
public String getUserFreindlyName() {
return "Plate Cutting Machine";
}
}

View file

@ -6,16 +6,16 @@ import techreborn.api.recipe.BaseRecipe;
public class VacuumFreezerRecipe extends BaseRecipe {
public VacuumFreezerRecipe(ItemStack input, ItemStack output, int tickTime, int euPerTick) {
super(Reference.vacuumFreezerRecipe, tickTime, euPerTick);
if (input != null)
inputs.add(input);
if (output != null)
addOutput(output);
}
public VacuumFreezerRecipe(ItemStack input, ItemStack output, int tickTime, int euPerTick) {
super(Reference.vacuumFreezerRecipe, tickTime, euPerTick);
if (input != null)
inputs.add(input);
if (output != null)
addOutput(output);
}
@Override
public String getUserFreindlyName() {
return "Vacuum Freezer";
}
@Override
public String getUserFreindlyName() {
return "Vacuum Freezer";
}
}

View file

@ -2,43 +2,43 @@ package techreborn.api.recipe.recipeConfig;
public class ConfigItem {
String localName;
String localName;
String itemName;
String itemName;
int meta;
int meta;
int stackSize;
int stackSize;
public String getItemName() {
return itemName;
}
public String getItemName() {
return itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public int getMeta() {
return meta;
}
public int getMeta() {
return meta;
}
public void setMeta(int meta) {
this.meta = meta;
}
public void setMeta(int meta) {
this.meta = meta;
}
public int getStackSize() {
return stackSize;
}
public int getStackSize() {
return stackSize;
}
public void setStackSize(int stackSize) {
this.stackSize = stackSize;
}
public void setStackSize(int stackSize) {
this.stackSize = stackSize;
}
public String getLocalName() {
return localName;
}
public String getLocalName() {
return localName;
}
public void setLocalName(String localName) {
this.localName = localName;
}
public void setLocalName(String localName) {
this.localName = localName;
}
}

View file

@ -4,57 +4,57 @@ import java.util.ArrayList;
public class RecipeConfig {
ArrayList<ConfigItem> inputs;
ArrayList<ConfigItem> inputs;
ArrayList<ConfigItem> outputs;
ArrayList<ConfigItem> outputs;
Boolean enabled;
Boolean enabled;
String machine;
String machine;
public ArrayList<ConfigItem> getInputs() {
return inputs;
}
public ArrayList<ConfigItem> getInputs() {
return inputs;
}
public void setInputs(ArrayList<ConfigItem> inputs) {
this.inputs = inputs;
}
public void setInputs(ArrayList<ConfigItem> inputs) {
this.inputs = inputs;
}
public ArrayList<ConfigItem> getOutputs() {
return outputs;
}
public ArrayList<ConfigItem> getOutputs() {
return outputs;
}
public void setOutputs(ArrayList<ConfigItem> outputs) {
this.outputs = outputs;
}
public void setOutputs(ArrayList<ConfigItem> outputs) {
this.outputs = outputs;
}
public Boolean getEnabled() {
return enabled;
}
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public String getMachine() {
return machine;
}
public String getMachine() {
return machine;
}
public void setMachine(String machine) {
this.machine = machine;
}
public void setMachine(String machine) {
this.machine = machine;
}
public void addInputs(ConfigItem item) {
if (inputs == null) {
inputs = new ArrayList<>();
}
inputs.add(item);
}
public void addInputs(ConfigItem item) {
if (inputs == null) {
inputs = new ArrayList<>();
}
inputs.add(item);
}
public void addOutputs(ConfigItem item) {
if (outputs == null) {
outputs = new ArrayList<>();
}
outputs.add(item);
}
public void addOutputs(ConfigItem item) {
if (outputs == null) {
outputs = new ArrayList<>();
}
outputs.add(item);
}
}

View file

@ -12,52 +12,52 @@ import java.util.ArrayList;
public class RecipeConfigManager {
public static ArrayList<RecipeConfig> configs = new ArrayList<>();
public static ArrayList<RecipeConfig> configs = new ArrayList<>();
static File configFile = null;
static File configFile = null;
public static void load(File configDir) {
if (configFile == null) {
configFile = new File(configDir, "techRebornRecipes.json");
}
}
public static void load(File configDir) {
if (configFile == null) {
configFile = new File(configDir, "techRebornRecipes.json");
}
}
public static void save() {
if (configFile.exists()) {
configFile.delete();
}
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String json = gson.toJson(configs);
try {
FileWriter writer = new FileWriter(configFile);
writer.write(json);
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void save() {
if (configFile.exists()) {
configFile.delete();
}
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String json = gson.toJson(configs);
try {
FileWriter writer = new FileWriter(configFile);
writer.write(json);
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public static boolean canLoadRecipe(IBaseRecipeType recipeType) {
RecipeConfig config = new RecipeConfig();
for (ItemStack stack : recipeType.getInputs()) {
config.addInputs(itemToConfig(stack));
}
for (ItemStack stack : recipeType.getOutputs()) {
config.addOutputs(itemToConfig(stack));
}
config.enabled = true;
config.setMachine(recipeType.getRecipeName());
configs.add(config);
return config.enabled;
}
public static boolean canLoadRecipe(IBaseRecipeType recipeType) {
RecipeConfig config = new RecipeConfig();
for (ItemStack stack : recipeType.getInputs()) {
config.addInputs(itemToConfig(stack));
}
for (ItemStack stack : recipeType.getOutputs()) {
config.addOutputs(itemToConfig(stack));
}
config.enabled = true;
config.setMachine(recipeType.getRecipeName());
configs.add(config);
return config.enabled;
}
public static ConfigItem itemToConfig(ItemStack stack) {
ConfigItem newItem = new ConfigItem();
newItem.setItemName(stack.getItem().getUnlocalizedName());
newItem.setMeta(stack.getItemDamage());
newItem.setStackSize(stack.stackSize);
newItem.setLocalName(stack.getDisplayName());
return newItem;
}
public static ConfigItem itemToConfig(ItemStack stack) {
ConfigItem newItem = new ConfigItem();
newItem.setItemName(stack.getItem().getUnlocalizedName());
newItem.setMeta(stack.getItemDamage());
newItem.setStackSize(stack.stackSize);
newItem.setLocalName(stack.getDisplayName());
return newItem;
}
}