Some work on the new api
This commit is contained in:
parent
3d819967be
commit
df61729d6f
69 changed files with 1380 additions and 1413 deletions
61
src/main/java/techreborn/api/ISubItemRetriever.java
Normal file
61
src/main/java/techreborn/api/ISubItemRetriever.java
Normal file
|
@ -0,0 +1,61 @@
|
|||
package techreborn.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ISubItemRetriever {
|
||||
|
||||
ItemStack getCellByName(String name);
|
||||
|
||||
ItemStack getCellByName(String name, int count);
|
||||
|
||||
ItemStack getCellByName(String name, int count, boolean lookForIC2);
|
||||
|
||||
ItemStack getCrushedOreByName(String name);
|
||||
|
||||
ItemStack getCrushedOreByName(String name, int count);
|
||||
|
||||
ItemStack getDustByName(String name);
|
||||
|
||||
ItemStack getDustByName(String name, int count);
|
||||
|
||||
ItemStack getSmallDustByName(String name);
|
||||
|
||||
ItemStack getSmallDustByName(String name, int count);
|
||||
|
||||
ItemStack getGemByName(String name);
|
||||
|
||||
ItemStack getGemByName(String name, int count);
|
||||
|
||||
ItemStack getIngotByName(String name);
|
||||
|
||||
ItemStack getIngotByName(String name, int count);
|
||||
|
||||
ItemStack getNuggetByName(String name);
|
||||
|
||||
ItemStack getNuggetByName(String name, int count);
|
||||
|
||||
ItemStack getPartByName(String name);
|
||||
|
||||
ItemStack getPartByName(String name, int count);
|
||||
|
||||
ItemStack getPlateByName(String name);
|
||||
|
||||
ItemStack getPlateByName(String name, int count);
|
||||
|
||||
ItemStack getPurifiedCrushedOreByName(String name);
|
||||
|
||||
ItemStack getPurifiedCrushedOreByName(String name, int count);
|
||||
|
||||
ItemStack getUpgradeByName(String name);
|
||||
|
||||
ItemStack getUpgradeByName(String name, int count);
|
||||
|
||||
ItemStack getOreByName(String name);
|
||||
|
||||
ItemStack getOreByName(String name, int count);
|
||||
|
||||
ItemStack getStorageBlockByName(String name);
|
||||
|
||||
ItemStack getStorageBlockByName(String name, int count);
|
||||
|
||||
}
|
47
src/main/java/techreborn/api/Reference.java
Normal file
47
src/main/java/techreborn/api/Reference.java
Normal file
|
@ -0,0 +1,47 @@
|
|||
package techreborn.api;
|
||||
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
/**
|
||||
* This contains some static stuff used in recipes and other things
|
||||
*/
|
||||
public class Reference {
|
||||
public static ToolMaterial BRONZE = EnumHelper.addToolMaterial("BRONZE", 2, 375, 6.0F, 2.25F, 8);
|
||||
public static ArmorMaterial BRONZE_ARMOUR = EnumHelper.addArmorMaterial("BRONZE", ModInfo.MOD_ID + ":bronze", 17,
|
||||
new int[]{3, 6, 5, 2}, 8, null/* TODO: SoundEvent */);
|
||||
|
||||
public static ToolMaterial RUBY = EnumHelper.addToolMaterial("RUBY", 2, 320, 6.2F, 2.7F, 10);
|
||||
public static ArmorMaterial RUBY_ARMOUR = EnumHelper.addArmorMaterial("RUBY", ModInfo.MOD_ID + ":ruby", 16,
|
||||
new int[]{2, 7, 5, 2}, 10, null/* TODO: SoundEvent */);
|
||||
|
||||
public static ToolMaterial SAPPHIRE = EnumHelper.addToolMaterial("SAPPHIRE", 2, 620, 5.0F, 2F, 8);
|
||||
public static ArmorMaterial SAPPHIRE_ARMOUR = EnumHelper.addArmorMaterial("SAPPHIRE", ModInfo.MOD_ID + ":sapphire",
|
||||
19, new int[]{4, 4, 4, 4}, 8, null/* TODO: SoundEvent */);
|
||||
|
||||
public static ToolMaterial PERIDOT = EnumHelper.addToolMaterial("PERIDOT", 2, 400, 7.0F, 2.4F, 16);
|
||||
public static ArmorMaterial PERIDOT_ARMOUR = EnumHelper.addArmorMaterial("PERIDOT", ModInfo.MOD_ID + ":peridot", 17,
|
||||
new int[]{3, 8, 3, 2}, 16, null/* TODO: SoundEvent */);
|
||||
|
||||
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");
|
||||
}
|
|
@ -1,9 +1,5 @@
|
|||
package techreborn.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -15,127 +11,106 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
public class RollingMachineRecipe
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public static final RollingMachineRecipe instance = new RollingMachineRecipe();
|
||||
private final List<IRecipe> recipes = new ArrayList<IRecipe>();
|
||||
public class RollingMachineRecipe {
|
||||
|
||||
public void addShapedOreRecipe(ItemStack outputItemStack, Object... objectInputs)
|
||||
{
|
||||
recipes.add(new ShapedOreRecipe(outputItemStack, objectInputs));
|
||||
}
|
||||
public static final RollingMachineRecipe instance = new RollingMachineRecipe();
|
||||
private final List<IRecipe> recipes = new ArrayList<IRecipe>();
|
||||
|
||||
public void addShapelessOreRecipe(ItemStack outputItemStack, Object... objectInputs)
|
||||
{
|
||||
recipes.add(new ShapelessOreRecipe(outputItemStack, objectInputs));
|
||||
}
|
||||
public void addShapedOreRecipe(ItemStack outputItemStack, Object... objectInputs) {
|
||||
recipes.add(new ShapedOreRecipe(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 addShapelessOreRecipe(ItemStack outputItemStack, Object... objectInputs) {
|
||||
recipes.add(new ShapelessOreRecipe(outputItemStack, objectInputs));
|
||||
}
|
||||
|
||||
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();
|
||||
} else
|
||||
{
|
||||
recipeArray[i1] = null;
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
recipes.add(new ShapedRecipes(j, k, recipeArray, output));
|
||||
}
|
||||
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();
|
||||
} else {
|
||||
recipeArray[i1] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addShapelessRecipe(ItemStack output, Object... components)
|
||||
{
|
||||
List<ItemStack> ingredients = new ArrayList<ItemStack>();
|
||||
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 ShapedRecipes(j, k, recipeArray, output));
|
||||
}
|
||||
|
||||
recipes.add(new ShapelessRecipes(output, ingredients));
|
||||
}
|
||||
public void addShapelessRecipe(ItemStack output, Object... components) {
|
||||
List<ItemStack> ingredients = new ArrayList<ItemStack>();
|
||||
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 ItemStack findMatchingRecipe(InventoryCrafting inv, World world)
|
||||
{
|
||||
for (int k = 0; k < recipes.size(); k++)
|
||||
{
|
||||
IRecipe irecipe = (IRecipe) recipes.get(k);
|
||||
if (irecipe.matches(inv, world))
|
||||
{
|
||||
return irecipe.getCraftingResult(inv);
|
||||
}
|
||||
}
|
||||
recipes.add(new ShapelessRecipes(output, ingredients));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public ItemStack findMatchingRecipe(InventoryCrafting inv, World world) {
|
||||
for (int k = 0; k < recipes.size(); k++) {
|
||||
IRecipe irecipe = (IRecipe) recipes.get(k);
|
||||
if (irecipe.matches(inv, world)) {
|
||||
return irecipe.getCraftingResult(inv);
|
||||
}
|
||||
}
|
||||
|
||||
public List<IRecipe> getRecipeList()
|
||||
{
|
||||
return recipes;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<IRecipe> getRecipeList() {
|
||||
return recipes;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,31 +1,42 @@
|
|||
package techreborn.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.Core;
|
||||
/**
|
||||
* Use this to add items to the scrap box and to check if an item is present
|
||||
* there
|
||||
*/
|
||||
public class ScrapboxList {
|
||||
|
||||
public class ScrapboxList
|
||||
{
|
||||
/**
|
||||
* This full list of items that is registered with this api
|
||||
*/
|
||||
public static List<ItemStack> stacks = new ArrayList<>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addItemStackToList(ItemStack stack)
|
||||
{
|
||||
if (!hasItems(stack))
|
||||
{
|
||||
stacks.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean hasItems(ItemStack stack)
|
||||
{
|
||||
for (ItemStack s : stacks)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
package techreborn.api;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.upgrade.IMachineUpgrade;
|
||||
|
||||
public class SlotUpgrade extends Slot
|
||||
{
|
||||
|
||||
public SlotUpgrade(IInventory inventoryIn, int index, int xPosition, int yPosition)
|
||||
{
|
||||
super(inventoryIn, index, xPosition, yPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack)
|
||||
{
|
||||
if (stack.getItem() instanceof IMachineUpgrade)
|
||||
{
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,39 +1,81 @@
|
|||
package techreborn.api;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.recipe.IRecipeCompact;
|
||||
|
||||
public final class TechRebornAPI
|
||||
{
|
||||
public final class TechRebornAPI {
|
||||
|
||||
public static IRecipeCompact recipeCompact;
|
||||
/**
|
||||
* Use this to get the instance of IRecipeCompat
|
||||
*/
|
||||
public static IRecipeCompact recipeCompact;
|
||||
|
||||
public static void addRollingOreMachinceRecipe(ItemStack output, Object... components)
|
||||
{
|
||||
RollingMachineRecipe.instance.addShapedOreRecipe(output, components);
|
||||
}
|
||||
public static ISubItemRetriever subItemRetriever;
|
||||
|
||||
public static void addShapelessOreRollingMachinceRecipe(ItemStack output, Object... components)
|
||||
{
|
||||
RollingMachineRecipe.instance.addShapelessOreRecipe(output, components);
|
||||
}
|
||||
public static void addRollingOreMachinceRecipe(ItemStack output, Object... components) {
|
||||
RollingMachineRecipe.instance.addShapedOreRecipe(output, components);
|
||||
}
|
||||
|
||||
public static void addRollingMachinceRecipe(ItemStack output, Object... components)
|
||||
{
|
||||
RollingMachineRecipe.instance.addRecipe(output, components);
|
||||
}
|
||||
public static void addShapelessOreRollingMachinceRecipe(ItemStack output, Object... components) {
|
||||
RollingMachineRecipe.instance.addShapelessOreRecipe(output, components);
|
||||
}
|
||||
|
||||
public static void addShapelessRollingMachinceRecipe(ItemStack output, Object... components)
|
||||
{
|
||||
RollingMachineRecipe.instance.addShapelessRecipe(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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class RegisteredItemRecipe extends Exception
|
||||
{
|
||||
public RegisteredItemRecipe(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
package techreborn.api;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class TechRebornBlocks
|
||||
{
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Full list of blocks.
|
||||
*
|
||||
* thermalGenerator quantumTank quantumChest digitalChest centrifuge
|
||||
* RollingMachine MachineCasing BlastFurnace AlloySmelter Grinder
|
||||
* ImplosionCompressor MatterFabricator ChunkLoader HighAdvancedMachineBlock
|
||||
* Dragoneggenergysiphoner Magicenergeyconverter AssemblyMachine
|
||||
* DieselGenerator IndustrialElectrolyzer MagicalAbsorber Semifluidgenerator
|
||||
* Gasturbine AlloyFurnace ChemicalReactor lathe platecuttingmachine Idsu
|
||||
* Aesu Lesu Supercondensator Woodenshelf Metalshelf LesuStorage
|
||||
* Distillationtower ElectricCraftingTable VacuumFreezer PlasmaGenerator
|
||||
* FusionControlComputer ComputerCube FusionCoil LightningRod heatGenerator
|
||||
* industrialSawmill chargeBench farm
|
||||
*
|
||||
* ore storage storage2 machineframe
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package techreborn.api;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class TechRebornItems
|
||||
{
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Items
|
||||
*
|
||||
* gems ingots nuggets dusts smallDusts tinyDusts parts cells rockCutter
|
||||
* lithiumBatpack lapotronpack omniTool advancedDrill lapotronicOrb manuel
|
||||
* uuMatter plate rods crushedOre purifiedCrushedOre cloakingDevice
|
||||
*
|
||||
* bucketBerylium bucketcalcium bucketcalciumcarbonate bucketChlorite
|
||||
* bucketDeuterium bucketGlyceryl bucketHelium bucketHelium3
|
||||
* bucketHeliumplasma bucketHydrogen bucketLithium bucketMercury
|
||||
* bucketMethane bucketNitrocoalfuel bucketNitrofuel bucketNitrogen
|
||||
* bucketNitrogendioxide bucketPotassium bucketSilicon bucketSodium
|
||||
* bucketSodiumpersulfate bucketTritium bucketWolframium
|
||||
*
|
||||
* hammerIron hammerDiamond upgrades farmPatten
|
||||
*
|
||||
*/
|
||||
|
||||
}
|
21
src/main/java/techreborn/api/gui/SlotUpgrade.java
Normal file
21
src/main/java/techreborn/api/gui/SlotUpgrade.java
Normal file
|
@ -0,0 +1,21 @@
|
|||
package techreborn.api.gui;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.upgrade.IMachineUpgrade;
|
||||
|
||||
public class SlotUpgrade extends Slot {
|
||||
|
||||
public SlotUpgrade(IInventory inventoryIn, int index, int xPosition, int yPosition) {
|
||||
super(inventoryIn, index, xPosition, yPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
if (stack.getItem() instanceof IMachineUpgrade) {
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
}
|
4
src/main/java/techreborn/api/gui/package-info.java
Normal file
4
src/main/java/techreborn/api/gui/package-info.java
Normal file
|
@ -0,0 +1,4 @@
|
|||
@API(apiVersion = "@MODVERSION@", owner = "techreborn", provides = "techrebornAPI")
|
||||
package techreborn.api.gui;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
|
@ -2,99 +2,84 @@ package techreborn.api.reactor;
|
|||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FusionReactorRecipe
|
||||
{
|
||||
public class FusionReactorRecipe {
|
||||
|
||||
/**
|
||||
* This is the item stack that is required in the top slot
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,22 +2,19 @@ package techreborn.api.reactor;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class FusionReactorRecipeHelper
|
||||
{
|
||||
public class FusionReactorRecipeHelper {
|
||||
|
||||
/**
|
||||
* This is the list of all the recipes
|
||||
*/
|
||||
public static ArrayList<FusionReactorRecipe> reactorRecipes = new ArrayList<FusionReactorRecipe>();
|
||||
/**
|
||||
* This is the list of all the recipes
|
||||
*/
|
||||
public static ArrayList<FusionReactorRecipe> reactorRecipes = new ArrayList<FusionReactorRecipe>();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,101 +1,87 @@
|
|||
package techreborn.api.recipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Extend this to add a recipe
|
||||
*/
|
||||
public abstract class BaseRecipe implements IBaseRecipeType, Cloneable
|
||||
{
|
||||
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<ItemStack>();
|
||||
outputs = new ArrayList<ItemStack>();
|
||||
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)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCraft(TileEntity tile)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onCraft(TileEntity tile) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,87 +1,83 @@
|
|||
package techreborn.api.recipe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This is the base recipe class implement this to make a recipe handler
|
||||
*/
|
||||
public interface IBaseRecipeType
|
||||
{
|
||||
public interface IBaseRecipeType {
|
||||
|
||||
/**
|
||||
* Use this to get all of the inputs
|
||||
*
|
||||
* @return the List of inputs
|
||||
*/
|
||||
public List<ItemStack> getInputs();
|
||||
/**
|
||||
* Use this to get all of the inputs
|
||||
*
|
||||
* @return the List of inputs
|
||||
*/
|
||||
public List<ItemStack> getInputs();
|
||||
|
||||
/**
|
||||
* This gets the output form the array list
|
||||
*
|
||||
* @param i
|
||||
* get output form position in arraylist
|
||||
* @return the output
|
||||
*/
|
||||
public ItemStack getOutput(int i);
|
||||
/**
|
||||
* This gets the output form the array list
|
||||
*
|
||||
* @param i get output form position in arraylist
|
||||
* @return the output
|
||||
*/
|
||||
public ItemStack getOutput(int i);
|
||||
|
||||
/**
|
||||
* @return The ammount of outputs
|
||||
*/
|
||||
public int getOutputsSize();
|
||||
/**
|
||||
* @return The ammount of outputs
|
||||
*/
|
||||
public int getOutputsSize();
|
||||
|
||||
/**
|
||||
* @return get outputs
|
||||
*/
|
||||
public List<ItemStack> getOutputs();
|
||||
/**
|
||||
* @return get outputs
|
||||
*/
|
||||
public List<ItemStack> getOutputs();
|
||||
|
||||
/**
|
||||
* This is the name to check that the recipe is the one that should be used
|
||||
* in the tile entity that is set up to process this recipe.
|
||||
*
|
||||
* @return The recipeName
|
||||
*/
|
||||
public String getRecipeName();
|
||||
/**
|
||||
* This is the name to check that the recipe is the one that should be used
|
||||
* in the tile entity that is set up to process this recipe.
|
||||
*
|
||||
* @return The recipeName
|
||||
*/
|
||||
public String getRecipeName();
|
||||
|
||||
/**
|
||||
* This should be a user friendly name
|
||||
*
|
||||
* @return The user friendly name of the recipe.
|
||||
*/
|
||||
public String getUserFreindlyName();
|
||||
/**
|
||||
* This should be a user friendly name
|
||||
*
|
||||
* @return The user friendly name of the recipe.
|
||||
*/
|
||||
public String getUserFreindlyName();
|
||||
|
||||
/**
|
||||
* This is how long the recipe needs to tick for the crafting operation to
|
||||
* complete
|
||||
*
|
||||
* @return tick length
|
||||
*/
|
||||
public int tickTime();
|
||||
/**
|
||||
* This is how long the recipe needs to tick for the crafting operation to
|
||||
* complete
|
||||
*
|
||||
* @return tick length
|
||||
*/
|
||||
public int tickTime();
|
||||
|
||||
/**
|
||||
* This is how much eu Per tick the machine should use
|
||||
*
|
||||
* @return the amount of eu to be used per tick.
|
||||
*/
|
||||
public int euPerTick();
|
||||
/**
|
||||
* This is how much eu Per tick the machine should use
|
||||
*
|
||||
* @return the amount of eu to be used per tick.
|
||||
*/
|
||||
public int euPerTick();
|
||||
|
||||
/**
|
||||
* @param tile
|
||||
* the tile that is doing the crafting
|
||||
* @return if true the recipe will craft, if false it will not
|
||||
*/
|
||||
public boolean canCraft(TileEntity tile);
|
||||
/**
|
||||
* @param tile the tile that is doing the crafting
|
||||
* @return if true the recipe will craft, if false it will not
|
||||
*/
|
||||
public boolean canCraft(TileEntity tile);
|
||||
|
||||
/**
|
||||
* @param tile
|
||||
* the tile that is doing the crafting
|
||||
* @return return true if fluid was taken and should craft
|
||||
*/
|
||||
public boolean onCraft(TileEntity tile);
|
||||
/**
|
||||
* @param tile the tile that is doing the crafting
|
||||
* @return return true if fluid was taken and should craft
|
||||
*/
|
||||
public boolean onCraft(TileEntity tile);
|
||||
|
||||
public Object clone() throws CloneNotSupportedException;
|
||||
public Object clone() throws CloneNotSupportedException;
|
||||
|
||||
public boolean useOreDic();
|
||||
public boolean useOreDic();
|
||||
}
|
||||
|
|
|
@ -2,8 +2,7 @@ package techreborn.api.recipe;
|
|||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IRecipeCompact
|
||||
{
|
||||
public interface IRecipeCompact {
|
||||
|
||||
ItemStack getItem(String name);
|
||||
ItemStack getItem(String name);
|
||||
}
|
||||
|
|
|
@ -1,426 +0,0 @@
|
|||
package techreborn.api.recipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import reborncore.api.power.IEnergyInterfaceTile;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.tile.TileMachineBase;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
|
||||
/**
|
||||
* Use this in your tile entity to craft things
|
||||
*/
|
||||
public class RecipeCrafter
|
||||
{
|
||||
|
||||
/**
|
||||
* This is the recipe type to use
|
||||
*/
|
||||
public String recipeName;
|
||||
|
||||
/**
|
||||
* This is the parent tile
|
||||
*/
|
||||
public TileMachineBase parentTile;
|
||||
|
||||
/**
|
||||
* This is the place to use the power from
|
||||
*/
|
||||
public IEnergyInterfaceTile energy;
|
||||
|
||||
/**
|
||||
* This is the amount of inputs that the setRecipe has
|
||||
*/
|
||||
public int inputs;
|
||||
|
||||
/**
|
||||
* This is the amount of outputs that the recipe has
|
||||
*/
|
||||
public int outputs;
|
||||
|
||||
/**
|
||||
* This is the inventory to use for the crafting
|
||||
*/
|
||||
public Inventory inventory;
|
||||
|
||||
/**
|
||||
* This is the list of the slots that the crafting logic should look for the
|
||||
* input item stacks.
|
||||
*/
|
||||
public int[] inputSlots;
|
||||
|
||||
/**
|
||||
* This is the list for the slots that the crafting logic should look fot
|
||||
* the output item stacks.
|
||||
*/
|
||||
public int[] outputSlots;
|
||||
public IBaseRecipeType currentRecipe;
|
||||
public int currentTickTime = 0;
|
||||
public int currentNeededTicks = 1;// Set to 1 to stop rare crashes
|
||||
double lastEnergy;
|
||||
/**
|
||||
* This is used to change the speed of the crafting operation.
|
||||
* <p/>
|
||||
* 0 = none; 0.2 = 20% speed increase 0.75 = 75% increase
|
||||
*/
|
||||
double speedMultiplier = 0;
|
||||
/**
|
||||
* This is used to change the power of the crafting operation.
|
||||
* <p/>
|
||||
* 1 = none; 1.2 = 20% speed increase 1.75 = 75% increase 5 = uses 5 times
|
||||
* more power
|
||||
*/
|
||||
double powerMultiplier = 1;
|
||||
int ticksSinceLastChange;
|
||||
|
||||
/**
|
||||
* This is the constructor, not a lot to say here :P
|
||||
*
|
||||
* @param recipeName
|
||||
* The recipe name that should be crafted
|
||||
* @param parentTile
|
||||
* The tile that wil be using this recipe crafter
|
||||
* @param inputs
|
||||
* The amount of input slots
|
||||
* @param outputs
|
||||
* The amount of output slots
|
||||
* @param inventory
|
||||
* The inventory of the machine
|
||||
* @param inputSlots
|
||||
* A list of the input slot ids
|
||||
* @param outputSlots
|
||||
* A list of output slot ids
|
||||
*/
|
||||
public RecipeCrafter(String recipeName, TileMachineBase parentTile, int inputs, int outputs, Inventory inventory,
|
||||
int[] inputSlots, int[] outputSlots)
|
||||
{
|
||||
this.recipeName = recipeName;
|
||||
this.parentTile = parentTile;
|
||||
if (parentTile instanceof IEnergyInterfaceTile)
|
||||
{
|
||||
energy = (IEnergyInterfaceTile) parentTile;
|
||||
}
|
||||
this.inputs = inputs;
|
||||
this.outputs = outputs;
|
||||
this.inventory = inventory;
|
||||
this.inputSlots = inputSlots;
|
||||
this.outputSlots = outputSlots;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this on the tile tick
|
||||
*/
|
||||
public void updateEntity()
|
||||
{
|
||||
if (parentTile.getWorld().isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ticksSinceLastChange++;
|
||||
if (ticksSinceLastChange == 20)
|
||||
{// Force a has chanced every second
|
||||
inventory.hasChanged = true;
|
||||
ticksSinceLastChange = 0;
|
||||
}
|
||||
if (currentRecipe == null && inventory.hasChanged)
|
||||
{// It will now look for new recipes.
|
||||
currentTickTime = 0;
|
||||
for (IBaseRecipeType recipe : RecipeHandler.getRecipeClassFromName(recipeName))
|
||||
{
|
||||
if (recipe.canCraft(parentTile) && hasAllInputs(recipe))
|
||||
{// This checks to see if it has all of the inputs
|
||||
boolean canGiveInvAll = true;
|
||||
for (int i = 0; i < recipe.getOutputsSize(); i++)
|
||||
{// This checks to see if it can fit all of the outputs
|
||||
if (!canFitStack(recipe.getOutput(i), outputSlots[i], recipe.useOreDic()))
|
||||
{
|
||||
canGiveInvAll = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (canGiveInvAll)
|
||||
{
|
||||
setCurrentRecipe(recipe);// Sets the current recipe then
|
||||
// syncs
|
||||
this.currentNeededTicks = (int) (currentRecipe.tickTime() * (1.0 - speedMultiplier));
|
||||
this.currentTickTime = -1;
|
||||
setIsActive();
|
||||
} else
|
||||
{
|
||||
this.currentTickTime = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (inventory.hasChanged && !hasAllInputs())
|
||||
{// If it doesn't have all the inputs reset
|
||||
currentRecipe = null;
|
||||
currentTickTime = -1;
|
||||
setIsActive();
|
||||
}
|
||||
if (currentRecipe != null && currentTickTime >= currentNeededTicks)
|
||||
{// If it has reached the recipe tick time
|
||||
boolean canGiveInvAll = true;
|
||||
for (int i = 0; i < currentRecipe.getOutputsSize(); i++)
|
||||
{// Checks to see if it can fit the output
|
||||
if (!canFitStack(currentRecipe.getOutput(i), outputSlots[i], currentRecipe.useOreDic()))
|
||||
{
|
||||
canGiveInvAll = false;
|
||||
}
|
||||
}
|
||||
ArrayList<Integer> filledSlots = new ArrayList<Integer>();// The
|
||||
// slots
|
||||
// that
|
||||
// have
|
||||
// been
|
||||
// filled
|
||||
if (canGiveInvAll && currentRecipe.onCraft(parentTile))
|
||||
{
|
||||
for (int i = 0; i < currentRecipe.getOutputsSize(); i++)
|
||||
{
|
||||
if (!filledSlots.contains(outputSlots[i]))
|
||||
{// checks it has not been filled
|
||||
fitStack(currentRecipe.getOutput(i).copy(), outputSlots[i]);// fills
|
||||
// the
|
||||
// slot
|
||||
// with
|
||||
// the
|
||||
// output
|
||||
// stack
|
||||
filledSlots.add(outputSlots[i]);
|
||||
}
|
||||
}
|
||||
useAllInputs();// this uses all the inputs
|
||||
currentRecipe = null;// resets
|
||||
currentTickTime = -1;
|
||||
setIsActive();
|
||||
}
|
||||
} else if (currentRecipe != null && currentTickTime < currentNeededTicks)
|
||||
{
|
||||
if (energy.canUseEnergy(getEuPerTick()))
|
||||
{// This uses the power
|
||||
energy.useEnergy(getEuPerTick());
|
||||
currentTickTime++;// increase the ticktime
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inventory.hasChanged)
|
||||
{
|
||||
inventory.hasChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasAllInputs()
|
||||
{
|
||||
if (currentRecipe == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (ItemStack input : currentRecipe.getInputs())
|
||||
{
|
||||
Boolean hasItem = false;
|
||||
for (int inputSlot : inputSlots)
|
||||
{// Checks to see if it can find the input
|
||||
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputSlot), true, true,
|
||||
currentRecipe.useOreDic()) && inventory.getStackInSlot(inputSlot).stackSize >= input.stackSize)
|
||||
{
|
||||
hasItem = true;
|
||||
}
|
||||
}
|
||||
if (!hasItem)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasAllInputs(IBaseRecipeType recipeType)
|
||||
{
|
||||
if (recipeType == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (ItemStack input : recipeType.getInputs())
|
||||
{
|
||||
Boolean hasItem = false;
|
||||
for (int inputslot : inputSlots)
|
||||
{
|
||||
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputslot), true, true,
|
||||
recipeType.useOreDic()) && inventory.getStackInSlot(inputslot).stackSize >= input.stackSize)
|
||||
{
|
||||
hasItem = true;
|
||||
}
|
||||
}
|
||||
if (!hasItem)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void useAllInputs()
|
||||
{
|
||||
if (currentRecipe == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (ItemStack input : currentRecipe.getInputs())
|
||||
{
|
||||
for (int inputSlot : inputSlots)
|
||||
{// Uses all of the inputs
|
||||
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputSlot), true, true,
|
||||
currentRecipe.useOreDic()))
|
||||
{
|
||||
inventory.decrStackSize(inputSlot, input.stackSize);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canFitStack(ItemStack stack, int slot, boolean oreDic)
|
||||
{// Checks to see if it can fit the stack
|
||||
if (stack == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (inventory.getStackInSlot(slot) == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (ItemUtils.isItemEqual(inventory.getStackInSlot(slot), stack, true, true, oreDic))
|
||||
{
|
||||
if (stack.stackSize + inventory.getStackInSlot(slot).stackSize <= stack.getMaxStackSize())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void fitStack(ItemStack stack, int slot)
|
||||
{// This fits a stack into a slot
|
||||
if (stack == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (inventory.getStackInSlot(slot) == null)
|
||||
{// If the slot is empty set the contents
|
||||
inventory.setInventorySlotContents(slot, stack);
|
||||
return;
|
||||
}
|
||||
if (ItemUtils.isItemEqual(inventory.getStackInSlot(slot), stack, true, true, currentRecipe.useOreDic()))
|
||||
{// If the slot has stuff in
|
||||
if (stack.stackSize + inventory.getStackInSlot(slot).stackSize <= stack.getMaxStackSize())
|
||||
{// Check to see if it fits
|
||||
ItemStack newStack = stack.copy();
|
||||
newStack.stackSize = inventory.getStackInSlot(slot).stackSize + stack.stackSize;// Sets
|
||||
// the
|
||||
// new
|
||||
// stack
|
||||
// size
|
||||
inventory.setInventorySlotContents(slot, newStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
NBTTagCompound data = tag.getCompoundTag("Crater");
|
||||
|
||||
if (data.hasKey("currentTickTime"))
|
||||
currentTickTime = data.getInteger("currentTickTime");
|
||||
|
||||
if (parentTile != null && parentTile.getWorld() != null && parentTile.getWorld().isRemote)
|
||||
{
|
||||
parentTile.getWorld().notifyBlockUpdate(parentTile.getPos(),
|
||||
parentTile.getWorld().getBlockState(parentTile.getPos()),
|
||||
parentTile.getWorld().getBlockState(parentTile.getPos()), 3);
|
||||
parentTile.getWorld().markBlockRangeForRenderUpdate(parentTile.getPos().getX(), parentTile.getPos().getY(),
|
||||
parentTile.getPos().getZ(), parentTile.getPos().getX(), parentTile.getPos().getY(),
|
||||
parentTile.getPos().getZ());
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
data.setDouble("currentTickTime", currentTickTime);
|
||||
|
||||
tag.setTag("Crater", data);
|
||||
}
|
||||
|
||||
private boolean isActive()
|
||||
{
|
||||
return currentRecipe != null && energy.getEnergy() >= currentRecipe.euPerTick();
|
||||
}
|
||||
|
||||
public void addSpeedMulti(double amount)
|
||||
{
|
||||
if (speedMultiplier + amount <= 0.99)
|
||||
{
|
||||
speedMultiplier += amount;
|
||||
} else
|
||||
{
|
||||
speedMultiplier = 0.99;
|
||||
}
|
||||
}
|
||||
|
||||
public void resetSpeedMulti()
|
||||
{
|
||||
speedMultiplier = 0;
|
||||
}
|
||||
|
||||
public double getSpeedMultiplier()
|
||||
{
|
||||
return speedMultiplier;
|
||||
}
|
||||
|
||||
public void addPowerMulti(double amount)
|
||||
{
|
||||
powerMultiplier += amount;
|
||||
}
|
||||
|
||||
public void resetPowerMulti()
|
||||
{
|
||||
powerMultiplier = 1;
|
||||
}
|
||||
|
||||
public double getPowerMultiplier()
|
||||
{
|
||||
return powerMultiplier;
|
||||
}
|
||||
|
||||
public double getEuPerTick()
|
||||
{
|
||||
return currentRecipe.euPerTick() * powerMultiplier;
|
||||
}
|
||||
|
||||
public void setIsActive()
|
||||
{
|
||||
if (parentTile.getWorld().getBlockState(parentTile.getPos()).getBlock() instanceof BlockMachineBase)
|
||||
{
|
||||
BlockMachineBase blockMachineBase = (BlockMachineBase) parentTile.getWorld()
|
||||
.getBlockState(parentTile.getPos()).getBlock();
|
||||
blockMachineBase.setActive(isActive(), parentTile.getWorld(), parentTile.getPos());
|
||||
}
|
||||
parentTile.getWorld().notifyBlockUpdate(parentTile.getPos(),
|
||||
parentTile.getWorld().getBlockState(parentTile.getPos()),
|
||||
parentTile.getWorld().getBlockState(parentTile.getPos()), 3);
|
||||
}
|
||||
|
||||
public void setCurrentRecipe(IBaseRecipeType recipe)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.currentRecipe = (IBaseRecipeType) recipe.clone();
|
||||
} catch (CloneNotSupportedException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,127 +1,104 @@
|
|||
package techreborn.api.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.apache.commons.lang3.time.StopWatch;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.Core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
public class RecipeHandler {
|
||||
|
||||
import org.apache.commons.lang3.time.StopWatch;
|
||||
/**
|
||||
* This is the array list of all of the recipes for all of the machines
|
||||
*/
|
||||
public static final ArrayList<IBaseRecipeType> recipeList = new ArrayList<IBaseRecipeType>();
|
||||
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.Core;
|
||||
public static HashMap<IBaseRecipeType, String> stackMap = new HashMap<IBaseRecipeType, String>();
|
||||
/**
|
||||
* This is a list of all the registered machine names.
|
||||
*/
|
||||
public static ArrayList<String> machineNames = new ArrayList<String>();
|
||||
|
||||
public class RecipeHandler
|
||||
{
|
||||
/**
|
||||
* Use this to get all of the recipes form a recipe name
|
||||
*
|
||||
* @param name the name that the recipe was resisted as.
|
||||
* @return A list of all the recipes of a given name.
|
||||
*/
|
||||
public static List<IBaseRecipeType> getRecipeClassFromName(String name) {
|
||||
List<IBaseRecipeType> baseRecipeList = new ArrayList<IBaseRecipeType>();
|
||||
for (IBaseRecipeType baseRecipe : recipeList) {
|
||||
if (baseRecipe.getRecipeName().equals(name)) {
|
||||
baseRecipeList.add(baseRecipe);
|
||||
}
|
||||
}
|
||||
return baseRecipeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 String getUserFreindlyName(String name) {
|
||||
for (IBaseRecipeType baseRecipe : recipeList) {
|
||||
if (baseRecipe.getRecipeName().equals(name)) {
|
||||
return baseRecipe.getUserFreindlyName();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static HashMap<IBaseRecipeType, String> stackMap = new HashMap<IBaseRecipeType, String>();
|
||||
/**
|
||||
* This is a list of all the registered machine names.
|
||||
*/
|
||||
public static ArrayList<String> machineNames = new ArrayList<String>();
|
||||
/**
|
||||
* Add a recipe to the system
|
||||
*
|
||||
* @param recipe The recipe to add to the system.
|
||||
*/
|
||||
public static void addRecipe(IBaseRecipeType recipe) {
|
||||
if (recipe == null) {
|
||||
return;
|
||||
}
|
||||
if (recipeList.contains(recipe)) {
|
||||
return;
|
||||
}
|
||||
// if (!RecipeConfigManager.canLoadRecipe(recipe)) {
|
||||
// return;
|
||||
// }
|
||||
if (!machineNames.contains(recipe.getRecipeName())) {
|
||||
machineNames.add(recipe.getRecipeName());
|
||||
}
|
||||
recipeList.add(recipe);
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
for (StackTraceElement ste : Thread.currentThread().getStackTrace()) {
|
||||
buffer.append(ste);
|
||||
}
|
||||
stackMap.put(recipe, buffer.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this to get all of the recipes form a recipe name
|
||||
*
|
||||
* @param name
|
||||
* the name that the recipe was resisted as.
|
||||
* @return A list of all the recipes of a given name.
|
||||
*/
|
||||
public static List<IBaseRecipeType> getRecipeClassFromName(String name)
|
||||
{
|
||||
List<IBaseRecipeType> baseRecipeList = new ArrayList<IBaseRecipeType>();
|
||||
for (IBaseRecipeType baseRecipe : recipeList)
|
||||
{
|
||||
if (baseRecipe.getRecipeName().equals(name))
|
||||
{
|
||||
baseRecipeList.add(baseRecipe);
|
||||
}
|
||||
}
|
||||
return baseRecipeList;
|
||||
}
|
||||
public static void scanForDupeRecipes() throws Exception {
|
||||
StopWatch watch = new StopWatch();
|
||||
watch.start();
|
||||
for (IBaseRecipeType baseRecipeType : recipeList) {
|
||||
for (IBaseRecipeType recipe : recipeList) {
|
||||
if (baseRecipeType != recipe && baseRecipeType.getRecipeName().equals(recipe.getRecipeName())) {
|
||||
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();
|
||||
for (ItemStack inputs : baseRecipeType.getInputs()) {
|
||||
itemInfo.append(":" + inputs.getItem().getUnlocalizedName() + ","
|
||||
+ inputs.getDisplayName() + "," + inputs.stackSize);
|
||||
}
|
||||
Core.logHelper.all(stackMap.get(baseRecipeType));
|
||||
// throw new Exception("Found a duplicate recipe for
|
||||
// " + baseRecipeType.getRecipeName() + " with
|
||||
// inputs " + itemInfo.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Core.logHelper.all(watch + " : Scanning dupe recipes");
|
||||
watch.stop();
|
||||
|
||||
public static String getUserFreindlyName(String name)
|
||||
{
|
||||
for (IBaseRecipeType baseRecipe : recipeList)
|
||||
{
|
||||
if (baseRecipe.getRecipeName().equals(name))
|
||||
{
|
||||
return baseRecipe.getUserFreindlyName();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a recipe to the system
|
||||
*
|
||||
* @param recipe
|
||||
* The recipe to add to the system.
|
||||
*/
|
||||
public static void addRecipe(IBaseRecipeType recipe)
|
||||
{
|
||||
if (recipe == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (recipeList.contains(recipe))
|
||||
{
|
||||
return;
|
||||
}
|
||||
// if (!RecipeConfigManager.canLoadRecipe(recipe)) {
|
||||
// return;
|
||||
// }
|
||||
if (!machineNames.contains(recipe.getRecipeName()))
|
||||
{
|
||||
machineNames.add(recipe.getRecipeName());
|
||||
}
|
||||
recipeList.add(recipe);
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
for (StackTraceElement ste : Thread.currentThread().getStackTrace())
|
||||
{
|
||||
buffer.append(ste);
|
||||
}
|
||||
stackMap.put(recipe, buffer.toString());
|
||||
}
|
||||
|
||||
public static void scanForDupeRecipes() throws Exception
|
||||
{
|
||||
StopWatch watch = new StopWatch();
|
||||
watch.start();
|
||||
for (IBaseRecipeType baseRecipeType : recipeList)
|
||||
{
|
||||
for (IBaseRecipeType recipe : recipeList)
|
||||
{
|
||||
if (baseRecipeType != recipe && baseRecipeType.getRecipeName().equals(recipe.getRecipeName()))
|
||||
{
|
||||
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();
|
||||
for (ItemStack inputs : baseRecipeType.getInputs())
|
||||
{
|
||||
itemInfo.append(":" + inputs.getItem().getUnlocalizedName() + ","
|
||||
+ inputs.getDisplayName() + "," + inputs.stackSize);
|
||||
}
|
||||
Core.logHelper.all(stackMap.get(baseRecipeType));
|
||||
// throw new Exception("Found a duplicate recipe for
|
||||
// " + baseRecipeType.getRecipeName() + " with
|
||||
// inputs " + itemInfo.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Core.logHelper.all(watch + " : Scanning dupe recipes");
|
||||
watch.stop();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,23 +1,20 @@
|
|||
package techreborn.api.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.items.ItemParts;
|
||||
import techreborn.lib.Reference;
|
||||
|
||||
//THIS is only here to trick JEI into showing recipes for the recycler
|
||||
public class RecyclerRecipe extends BaseRecipe
|
||||
{
|
||||
public class RecyclerRecipe extends BaseRecipe {
|
||||
|
||||
public RecyclerRecipe(ItemStack input)
|
||||
{
|
||||
super(Reference.recyclerRecipe, 0, 0);
|
||||
inputs.add(input);
|
||||
addOutput(ItemParts.getPartByName("scrap"));
|
||||
}
|
||||
public RecyclerRecipe(ItemStack input) {
|
||||
super(Reference.recyclerRecipe, 0, 0);
|
||||
inputs.add(input);
|
||||
addOutput(ItemParts.getPartByName("scrap"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName()
|
||||
{
|
||||
return "Recycler";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Recycler";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
package techreborn.api.recipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.lib.Reference;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.TechRebornAPI;
|
||||
|
||||
public class ScrapboxRecipe extends BaseRecipe
|
||||
{
|
||||
public class ScrapboxRecipe extends BaseRecipe {
|
||||
|
||||
public ScrapboxRecipe(ItemStack output)
|
||||
{
|
||||
super(Reference.scrapboxRecipe, 0, 0);
|
||||
inputs.add(new ItemStack(ModItems.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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,23 @@
|
|||
package techreborn.api.recipe.machines;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
import techreborn.lib.Reference;
|
||||
|
||||
public class AlloySmelterRecipe extends 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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,23 @@
|
|||
package techreborn.api.recipe.machines;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
import techreborn.lib.Reference;
|
||||
|
||||
public class AssemblingMachineRecipe extends 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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,51 +2,45 @@ package techreborn.api.recipe.machines;
|
|||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
import techreborn.lib.Reference;
|
||||
import techreborn.tiles.TileBlastFurnace;
|
||||
|
||||
public class BlastFurnaceRecipe extends 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";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile)
|
||||
{
|
||||
if (tile instanceof TileBlastFurnace)
|
||||
{
|
||||
TileBlastFurnace blastFurnace = (TileBlastFurnace) tile;
|
||||
return blastFurnace.getHeat() >= neededHeat;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile) {
|
||||
if (tile instanceof TileBlastFurnace) {
|
||||
TileBlastFurnace blastFurnace = (TileBlastFurnace) tile;
|
||||
return blastFurnace.getHeat() >= neededHeat;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCraft(TileEntity tile)
|
||||
{
|
||||
return super.onCraft(tile);
|
||||
}
|
||||
@Override
|
||||
public boolean onCraft(TileEntity tile) {
|
||||
return super.onCraft(tile);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,47 +1,43 @@
|
|||
package techreborn.api.recipe.machines;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
import techreborn.lib.Reference;
|
||||
|
||||
public class CentrifugeRecipe extends 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, boolean useOreDic)
|
||||
{
|
||||
this(input1, input2, output1, output2, output3, output4, tickTime, euPerTick);
|
||||
this.useOreDic = useOreDic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName()
|
||||
{
|
||||
return "Centrifuge";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return useOreDic;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Centrifuge";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return useOreDic;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,23 @@
|
|||
package techreborn.api.recipe.machines;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
import techreborn.lib.Reference;
|
||||
|
||||
public class ChemicalReactorRecipe extends 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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
package techreborn.api.recipe.machines;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
import techreborn.lib.Reference;
|
||||
|
||||
public class CompressorRecipe extends 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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
package techreborn.api.recipe.machines;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
import techreborn.lib.Reference;
|
||||
|
||||
public class ExtractorRecipe extends BaseRecipe
|
||||
{
|
||||
public class ExtractorRecipe extends BaseRecipe {
|
||||
|
||||
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) {
|
||||
super(Reference.extractorRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName()
|
||||
{
|
||||
return "Extractor";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Extractor";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
package techreborn.api.recipe.machines;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
import techreborn.lib.Reference;
|
||||
|
||||
public class GrinderRecipe extends 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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +1,26 @@
|
|||
package techreborn.api.recipe.machines;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
import techreborn.lib.Reference;
|
||||
|
||||
public class ImplosionCompressorRecipe extends 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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,41 +1,37 @@
|
|||
package techreborn.api.recipe.machines;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
import techreborn.lib.Reference;
|
||||
|
||||
public class IndustrialElectrolyzerRecipe extends 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,95 +3,78 @@ 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;
|
||||
import techreborn.lib.Reference;
|
||||
import techreborn.tiles.TileIndustrialGrinder;
|
||||
|
||||
public class IndustrialGrinderRecipe extends BaseRecipe
|
||||
{
|
||||
public class IndustrialGrinderRecipe extends BaseRecipe {
|
||||
|
||||
public FluidStack fluidStack;
|
||||
public FluidStack fluidStack;
|
||||
|
||||
public IndustrialGrinderRecipe(ItemStack input1, ItemStack input2, 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 (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);
|
||||
this.fluidStack = fluidStack;
|
||||
}
|
||||
public IndustrialGrinderRecipe(ItemStack input1, ItemStack input2, 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 (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);
|
||||
this.fluidStack = fluidStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName()
|
||||
{
|
||||
return "IndustrialGrinder";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "IndustrialGrinder";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile)
|
||||
{
|
||||
if (fluidStack == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (tile instanceof TileIndustrialGrinder)
|
||||
{
|
||||
TileIndustrialGrinder grinder = (TileIndustrialGrinder) tile;
|
||||
if (grinder.tank.getFluid() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (grinder.tank.getFluid() == fluidStack)
|
||||
{
|
||||
if (grinder.tank.getFluidAmount() >= fluidStack.amount)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile) {
|
||||
if (fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
if (tile instanceof TileIndustrialGrinder) {
|
||||
TileIndustrialGrinder grinder = (TileIndustrialGrinder) tile;
|
||||
if (grinder.tank.getFluid() == null) {
|
||||
return false;
|
||||
}
|
||||
if (grinder.tank.getFluid() == fluidStack) {
|
||||
if (grinder.tank.getFluidAmount() >= fluidStack.amount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCraft(TileEntity tile)
|
||||
{
|
||||
if (fluidStack == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (tile instanceof TileIndustrialGrinder)
|
||||
{
|
||||
TileIndustrialGrinder grinder = (TileIndustrialGrinder) tile;
|
||||
if (grinder.tank.getFluid() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (grinder.tank.getFluid() == fluidStack)
|
||||
{
|
||||
if (grinder.tank.getFluidAmount() >= fluidStack.amount)
|
||||
{
|
||||
if (grinder.tank.getFluidAmount() > 0)
|
||||
{
|
||||
grinder.tank.setFluid(new FluidStack(fluidStack.getFluid(),
|
||||
grinder.tank.getFluidAmount() - fluidStack.amount));
|
||||
} else
|
||||
{
|
||||
grinder.tank.setFluid(null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean onCraft(TileEntity tile) {
|
||||
if (fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
if (tile instanceof TileIndustrialGrinder) {
|
||||
TileIndustrialGrinder grinder = (TileIndustrialGrinder) tile;
|
||||
if (grinder.tank.getFluid() == null) {
|
||||
return false;
|
||||
}
|
||||
if (grinder.tank.getFluid() == fluidStack) {
|
||||
if (grinder.tank.getFluidAmount() >= fluidStack.amount) {
|
||||
if (grinder.tank.getFluidAmount() > 0) {
|
||||
grinder.tank.setFluid(new FluidStack(fluidStack.getFluid(),
|
||||
grinder.tank.getFluidAmount() - fluidStack.amount));
|
||||
} else {
|
||||
grinder.tank.setFluid(null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,119 +3,100 @@ 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;
|
||||
import techreborn.lib.Reference;
|
||||
import techreborn.tiles.TileIndustrialSawmill;
|
||||
|
||||
public class IndustrialSawmillRecipe extends 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 canCraft(TileEntity tile)
|
||||
{
|
||||
if (fluidStack == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (tile instanceof TileIndustrialSawmill)
|
||||
{
|
||||
TileIndustrialSawmill sawmill = (TileIndustrialSawmill) tile;
|
||||
if (sawmill.tank.getFluid() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (sawmill.tank.getFluid() == fluidStack)
|
||||
{
|
||||
if (sawmill.tank.getFluidAmount() >= fluidStack.amount)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile) {
|
||||
if (fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
if (tile instanceof TileIndustrialSawmill) {
|
||||
TileIndustrialSawmill sawmill = (TileIndustrialSawmill) tile;
|
||||
if (sawmill.tank.getFluid() == null) {
|
||||
return false;
|
||||
}
|
||||
if (sawmill.tank.getFluid() == fluidStack) {
|
||||
if (sawmill.tank.getFluidAmount() >= fluidStack.amount) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCraft(TileEntity tile)
|
||||
{
|
||||
if (fluidStack == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (tile instanceof TileIndustrialSawmill)
|
||||
{
|
||||
TileIndustrialSawmill sawmill = (TileIndustrialSawmill) tile;
|
||||
if (sawmill.tank.getFluid() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (sawmill.tank.getFluid() == fluidStack)
|
||||
{
|
||||
if (sawmill.tank.getFluidAmount() >= fluidStack.amount)
|
||||
{
|
||||
if (sawmill.tank.getFluidAmount() > 0)
|
||||
{
|
||||
sawmill.tank.setFluid(new FluidStack(fluidStack.getFluid(),
|
||||
sawmill.tank.getFluidAmount() - fluidStack.amount));
|
||||
} else
|
||||
{
|
||||
sawmill.tank.setFluid(null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean onCraft(TileEntity tile) {
|
||||
if (fluidStack == null) {
|
||||
return true;
|
||||
}
|
||||
if (tile instanceof TileIndustrialSawmill) {
|
||||
TileIndustrialSawmill sawmill = (TileIndustrialSawmill) tile;
|
||||
if (sawmill.tank.getFluid() == null) {
|
||||
return false;
|
||||
}
|
||||
if (sawmill.tank.getFluid() == fluidStack) {
|
||||
if (sawmill.tank.getFluidAmount() >= fluidStack.amount) {
|
||||
if (sawmill.tank.getFluidAmount() > 0) {
|
||||
sawmill.tank.setFluid(new FluidStack(fluidStack.getFluid(),
|
||||
sawmill.tank.getFluidAmount() - fluidStack.amount));
|
||||
} else {
|
||||
sawmill.tank.setFluid(null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useOreDic()
|
||||
{
|
||||
return canUseOreDict;
|
||||
}
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return canUseOreDict;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
package techreborn.api.recipe.machines;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
import techreborn.lib.Reference;
|
||||
|
||||
public class PlateCuttingMachineRecipe extends 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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,38 +2,32 @@ package techreborn.api.recipe.machines;
|
|||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
import techreborn.lib.Reference;
|
||||
import techreborn.tiles.TileVacuumFreezer;
|
||||
|
||||
public class VacuumFreezerRecipe extends 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";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile)
|
||||
{
|
||||
if (tile instanceof TileVacuumFreezer)
|
||||
{
|
||||
if (((TileVacuumFreezer) tile).multiBlockStatus == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile) {
|
||||
if (tile instanceof TileVacuumFreezer) {
|
||||
if (((TileVacuumFreezer) tile).multiBlockStatus == 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,53 +1,44 @@
|
|||
package techreborn.api.recipe.recipeConfig;
|
||||
|
||||
public class ConfigItem
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,72 +2,59 @@ package techreborn.api.recipe.recipeConfig;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class RecipeConfig
|
||||
{
|
||||
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<ConfigItem>();
|
||||
}
|
||||
inputs.add(item);
|
||||
}
|
||||
public void addInputs(ConfigItem item) {
|
||||
if (inputs == null) {
|
||||
inputs = new ArrayList<ConfigItem>();
|
||||
}
|
||||
inputs.add(item);
|
||||
}
|
||||
|
||||
public void addOutputs(ConfigItem item)
|
||||
{
|
||||
if (outputs == null)
|
||||
{
|
||||
outputs = new ArrayList<ConfigItem>();
|
||||
}
|
||||
outputs.add(item);
|
||||
}
|
||||
public void addOutputs(ConfigItem item) {
|
||||
if (outputs == null) {
|
||||
outputs = new ArrayList<ConfigItem>();
|
||||
}
|
||||
outputs.add(item);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,75 +1,63 @@
|
|||
package techreborn.api.recipe.recipeConfig;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.recipe.IBaseRecipeType;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.recipe.IBaseRecipeType;
|
||||
public class RecipeConfigManager {
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
public static ArrayList<RecipeConfig> configs = new ArrayList<RecipeConfig>();
|
||||
|
||||
public class RecipeConfigManager
|
||||
{
|
||||
static File configFile = null;
|
||||
|
||||
public static ArrayList<RecipeConfig> configs = new ArrayList<RecipeConfig>();
|
||||
public static void load(File configDir) {
|
||||
if (configFile == null) {
|
||||
configFile = new File(configDir, "techRebornRecipes.json");
|
||||
}
|
||||
}
|
||||
|
||||
static File configFile = null;
|
||||
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 load(File configDir)
|
||||
{
|
||||
if (configFile == null)
|
||||
{
|
||||
configFile = new File(configDir, "techRebornRecipes.json");
|
||||
}
|
||||
}
|
||||
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 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 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package techreborn.api.upgrade;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.api.recipe.RecipeCrafter;
|
||||
import techreborn.utils.RecipeCrafter;
|
||||
|
||||
public interface IMachineUpgrade
|
||||
{
|
||||
public interface IMachineUpgrade {
|
||||
|
||||
public void processUpgrade(RecipeCrafter crafter, ItemStack stack);
|
||||
public void processUpgrade(RecipeCrafter crafter, ItemStack stack);
|
||||
}
|
||||
|
|
|
@ -1,46 +1,40 @@
|
|||
package techreborn.api.upgrade;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.api.recipe.RecipeCrafter;
|
||||
import techreborn.utils.RecipeCrafter;
|
||||
|
||||
public class UpgradeHandler
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
|
||||
RecipeCrafter crafter;
|
||||
public class UpgradeHandler {
|
||||
|
||||
Inventory inventory;
|
||||
RecipeCrafter crafter;
|
||||
|
||||
ArrayList<Integer> slots = new ArrayList<Integer>();
|
||||
Inventory inventory;
|
||||
|
||||
public UpgradeHandler(RecipeCrafter crafter, Inventory inventory, int... slots)
|
||||
{
|
||||
this.crafter = crafter;
|
||||
this.inventory = inventory;
|
||||
for (int slot : slots)
|
||||
{
|
||||
this.slots.add(slot);
|
||||
}
|
||||
}
|
||||
ArrayList<Integer> slots = new ArrayList<Integer>();
|
||||
|
||||
public void tick()
|
||||
{
|
||||
if (crafter.parentTile.getWorld().isRemote)
|
||||
return;
|
||||
crafter.resetPowerMulti();
|
||||
crafter.resetSpeedMulti();
|
||||
for (int slot : this.slots)
|
||||
{
|
||||
ItemStack stack = inventory.getStackInSlot(slot);
|
||||
if (stack != null && stack.getItem() instanceof IMachineUpgrade)
|
||||
{
|
||||
((IMachineUpgrade) stack.getItem()).processUpgrade(crafter, stack);
|
||||
}
|
||||
}
|
||||
if (crafter.currentRecipe != null)
|
||||
crafter.currentNeededTicks = (int) (crafter.currentRecipe.tickTime()
|
||||
* (1.0 - crafter.getSpeedMultiplier()));
|
||||
}
|
||||
public UpgradeHandler(RecipeCrafter crafter, Inventory inventory, int... slots) {
|
||||
this.crafter = crafter;
|
||||
this.inventory = inventory;
|
||||
for (int slot : slots) {
|
||||
this.slots.add(slot);
|
||||
}
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
if (crafter.parentTile.getWorld().isRemote)
|
||||
return;
|
||||
crafter.resetPowerMulti();
|
||||
crafter.resetSpeedMulti();
|
||||
for (int slot : this.slots) {
|
||||
ItemStack stack = inventory.getStackInSlot(slot);
|
||||
if (stack != null && stack.getItem() instanceof IMachineUpgrade) {
|
||||
((IMachineUpgrade) stack.getItem()).processUpgrade(crafter, stack);
|
||||
}
|
||||
}
|
||||
if (crafter.currentRecipe != null)
|
||||
crafter.currentNeededTicks = (int) (crafter.currentRecipe.tickTime()
|
||||
* (1.0 - crafter.getSpeedMultiplier()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue