Reformatted all the code using the default intelji formatting options.
This commit is contained in:
parent
2f63a24070
commit
e0ab0af822
363 changed files with 20524 additions and 23016 deletions
|
@ -9,7 +9,7 @@ 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;
|
||||
|
||||
|
@ -35,17 +35,17 @@ public abstract class BaseRecipe implements IBaseRecipeType , Cloneable {
|
|||
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
|
||||
@Override
|
||||
public List<ItemStack> getInputs() {
|
||||
return inputs;
|
||||
}
|
||||
|
@ -76,17 +76,17 @@ public abstract class BaseRecipe implements IBaseRecipeType , Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object clone()throws CloneNotSupportedException{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,17 +24,15 @@ public interface IBaseRecipeType {
|
|||
*/
|
||||
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
|
||||
|
@ -44,12 +42,12 @@ public interface IBaseRecipeType {
|
|||
*/
|
||||
public String getRecipeName();
|
||||
|
||||
/**
|
||||
* This should be a user friendly name
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getUserFreindlyName();
|
||||
/**
|
||||
* This should be a user friendly name
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getUserFreindlyName();
|
||||
|
||||
/**
|
||||
* This is how long the recipe needs to tick for the crafting operation to complete
|
||||
|
@ -77,7 +75,7 @@ public interface IBaseRecipeType {
|
|||
*/
|
||||
public boolean onCraft(TileEntity tile);
|
||||
|
||||
public Object clone()throws CloneNotSupportedException;
|
||||
public Object clone() throws CloneNotSupportedException;
|
||||
|
||||
public boolean useOreDic();
|
||||
public boolean useOreDic();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package techreborn.api.recipe;
|
||||
|
||||
import ic2.api.energy.prefab.BasicSink;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.Packet;
|
||||
|
@ -72,7 +71,7 @@ public class RecipeCrafter {
|
|||
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){
|
||||
if (parentTile instanceof IEnergyInterfaceTile) {
|
||||
energy = (IEnergyInterfaceTile) parentTile;
|
||||
}
|
||||
this.inputs = inputs;
|
||||
|
@ -91,7 +90,7 @@ public class RecipeCrafter {
|
|||
|
||||
/**
|
||||
* This is used to change the speed of the crafting operation.
|
||||
*
|
||||
* <p/>
|
||||
* 0 = none;
|
||||
* 0.2 = 20% speed increase
|
||||
* 0.75 = 75% increase
|
||||
|
@ -100,7 +99,7 @@ public class RecipeCrafter {
|
|||
|
||||
/**
|
||||
* This is used to change the power of the crafting operation.
|
||||
*
|
||||
* <p/>
|
||||
* 1 = none;
|
||||
* 1.2 = 20% speed increase
|
||||
* 1.75 = 75% increase
|
||||
|
@ -108,20 +107,20 @@ public class RecipeCrafter {
|
|||
*/
|
||||
double powerMultiplier = 1;
|
||||
|
||||
int ticksSinceLastChange;
|
||||
int ticksSinceLastChange;
|
||||
|
||||
/**
|
||||
* Call this on the tile tick
|
||||
*/
|
||||
public void updateEntity() {
|
||||
if(parentTile.getWorldObj().isRemote){
|
||||
if (parentTile.getWorldObj().isRemote) {
|
||||
return;
|
||||
}
|
||||
ticksSinceLastChange ++;
|
||||
if(ticksSinceLastChange == 20){//Force a has chanced every second
|
||||
inventory.hasChanged = true;
|
||||
ticksSinceLastChange = 0;
|
||||
}
|
||||
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)) {
|
||||
|
@ -135,9 +134,9 @@ public class RecipeCrafter {
|
|||
}
|
||||
if (canGiveInvAll) {
|
||||
setCurrentRecipe(recipe);//Sets the current recipe then syncs
|
||||
this.currentNeededTicks = (int)(currentRecipe.tickTime() * (1.0 - speedMultiplier));
|
||||
this.currentNeededTicks = (int) (currentRecipe.tickTime() * (1.0 - speedMultiplier));
|
||||
this.currentTickTime = -1;
|
||||
syncIsActive();
|
||||
syncIsActive();
|
||||
} else {
|
||||
this.currentTickTime = -0;
|
||||
}
|
||||
|
@ -147,7 +146,7 @@ public class RecipeCrafter {
|
|||
if (inventory.hasChanged && !hasAllInputs()) {//If it doesn't have all the inputs reset
|
||||
currentRecipe = null;
|
||||
currentTickTime = 0;
|
||||
syncIsActive();
|
||||
syncIsActive();
|
||||
}
|
||||
if (currentRecipe != null && currentTickTime >= currentNeededTicks) {//If it has reached the recipe tick time
|
||||
boolean canGiveInvAll = true;
|
||||
|
@ -167,7 +166,7 @@ public class RecipeCrafter {
|
|||
useAllInputs();//this uses all the inputs
|
||||
currentRecipe = null;//resets
|
||||
currentTickTime = 0;
|
||||
syncIsActive();
|
||||
syncIsActive();
|
||||
}
|
||||
} else if (currentRecipe != null && currentTickTime < currentNeededTicks) {
|
||||
if (energy.canUseEnergy(getEuPerTick())) {//This uses the power
|
||||
|
@ -176,9 +175,9 @@ public class RecipeCrafter {
|
|||
}
|
||||
}
|
||||
}
|
||||
if(inventory.hasChanged){
|
||||
inventory.hasChanged = false;
|
||||
}
|
||||
if (inventory.hasChanged) {
|
||||
inventory.hasChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasAllInputs() {
|
||||
|
@ -264,14 +263,14 @@ public class RecipeCrafter {
|
|||
public void readFromNBT(NBTTagCompound tag) {
|
||||
NBTTagCompound data = tag.getCompoundTag("Crater");
|
||||
|
||||
if(data.hasKey("currentTickTime"))
|
||||
currentTickTime = data.getInteger("currentTickTime");
|
||||
if (data.hasKey("currentTickTime"))
|
||||
currentTickTime = data.getInteger("currentTickTime");
|
||||
|
||||
isactive = data.getBoolean("isActive");
|
||||
if(parentTile != null && parentTile.getWorldObj() != null && parentTile.getWorldObj().isRemote){
|
||||
parentTile.getWorldObj().markBlockForUpdate(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord);
|
||||
parentTile.getWorldObj().markBlockRangeForRenderUpdate(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, parentTile.xCoord, parentTile.yCoord, parentTile.zCoord);
|
||||
}
|
||||
if (parentTile != null && parentTile.getWorldObj() != null && parentTile.getWorldObj().isRemote) {
|
||||
parentTile.getWorldObj().markBlockForUpdate(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord);
|
||||
parentTile.getWorldObj().markBlockRangeForRenderUpdate(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, parentTile.xCoord, parentTile.yCoord, parentTile.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
|
@ -293,54 +292,54 @@ public class RecipeCrafter {
|
|||
return isactive;
|
||||
}
|
||||
|
||||
public void addSpeedMulti(double amount){
|
||||
if(speedMultiplier + amount <= 0.99){
|
||||
speedMultiplier += amount;
|
||||
} else {
|
||||
speedMultiplier = 0.99;
|
||||
}
|
||||
public void addSpeedMulti(double amount) {
|
||||
if (speedMultiplier + amount <= 0.99) {
|
||||
speedMultiplier += amount;
|
||||
} else {
|
||||
speedMultiplier = 0.99;
|
||||
}
|
||||
}
|
||||
|
||||
public void resetSpeedMulti(){
|
||||
public void resetSpeedMulti() {
|
||||
speedMultiplier = 0;
|
||||
}
|
||||
|
||||
public double getSpeedMultiplier(){
|
||||
public double getSpeedMultiplier() {
|
||||
return speedMultiplier;
|
||||
}
|
||||
|
||||
public void addPowerMulti(double amount){
|
||||
public void addPowerMulti(double amount) {
|
||||
powerMultiplier += amount;
|
||||
}
|
||||
|
||||
public void resetPowerMulti(){
|
||||
public void resetPowerMulti() {
|
||||
powerMultiplier = 1;
|
||||
}
|
||||
|
||||
public double getPowerMultiplier(){
|
||||
public double getPowerMultiplier() {
|
||||
return powerMultiplier;
|
||||
}
|
||||
|
||||
public double getEuPerTick(){
|
||||
public double getEuPerTick() {
|
||||
return currentRecipe.euPerTick() * powerMultiplier;
|
||||
}
|
||||
|
||||
|
||||
public void syncIsActive() {
|
||||
if (!parentTile.getWorldObj().isRemote) {
|
||||
PacketHandler.sendPacketToAllPlayers(getSyncPacket(),
|
||||
parentTile.getWorldObj());
|
||||
}
|
||||
}
|
||||
public void syncIsActive() {
|
||||
if (!parentTile.getWorldObj().isRemote) {
|
||||
PacketHandler.sendPacketToAllPlayers(getSyncPacket(),
|
||||
parentTile.getWorldObj());
|
||||
}
|
||||
}
|
||||
|
||||
public Packet getSyncPacket() {
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
writeToNBT(nbtTag);
|
||||
return new S35PacketUpdateTileEntity(this.parentTile.xCoord, this.parentTile.yCoord,
|
||||
this.parentTile.zCoord, 1, nbtTag);
|
||||
}
|
||||
public Packet getSyncPacket() {
|
||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
writeToNBT(nbtTag);
|
||||
return new S35PacketUpdateTileEntity(this.parentTile.xCoord, this.parentTile.yCoord,
|
||||
this.parentTile.zCoord, 1, nbtTag);
|
||||
}
|
||||
|
||||
public void setCurrentRecipe(IBaseRecipeType recipe){
|
||||
public void setCurrentRecipe(IBaseRecipeType recipe) {
|
||||
try {
|
||||
this.currentRecipe = (IBaseRecipeType) recipe.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
|
|
|
@ -62,7 +62,7 @@ public class RecipeHandler {
|
|||
if (recipeList.contains(recipe)) {
|
||||
return;
|
||||
}
|
||||
if(!RecipeConfigManager.canLoadRecipe(recipe)){
|
||||
if (!RecipeConfigManager.canLoadRecipe(recipe)) {
|
||||
return;
|
||||
}
|
||||
if (!machineNames.contains(recipe.getRecipeName())) {
|
||||
|
@ -86,11 +86,11 @@ public class RecipeHandler {
|
|||
for (int i = 0; i < baseRecipeType.getInputs().size(); i++) {
|
||||
if (ItemUtils.isItemEqual(baseRecipeType.getInputs().get(i), recipe.getInputs().get(i), true, false, false)) {
|
||||
StringBuffer itemInfo = new StringBuffer();
|
||||
for(ItemStack inputs : baseRecipeType.getInputs()){
|
||||
for (ItemStack inputs : baseRecipeType.getInputs()) {
|
||||
itemInfo.append(":" + inputs.getItem().getUnlocalizedName() + "," + inputs.getDisplayName() + "," + inputs.stackSize);
|
||||
}
|
||||
LogHelper.all(stackMap.get(baseRecipeType));
|
||||
// throw new Exception("Found a duplicate recipe for " + baseRecipeType.getRecipeName() + " with inputs " + itemInfo.toString());
|
||||
// throw new Exception("Found a duplicate recipe for " + baseRecipeType.getRecipeName() + " with inputs " + itemInfo.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ public class AlloySmelterRecipe extends BaseRecipe {
|
|||
addOutput(output1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Alloy Smelter";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Alloy Smelter";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ public class AssemblingMachineRecipe extends BaseRecipe {
|
|||
addOutput(output1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Assembling Machine";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Assembling Machine";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ import techreborn.tiles.TileBlastFurnace;
|
|||
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) {
|
||||
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);
|
||||
|
@ -22,25 +22,25 @@ public class BlastFurnaceRecipe extends BaseRecipe {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ public class CentrifugeRecipe extends BaseRecipe {
|
|||
addOutput(output4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Centrifuge";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Centrifuge";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ public class ChemicalReactorRecipe extends BaseRecipe {
|
|||
addOutput(output1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Chemical Reactor";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Chemical Reactor";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ public class GrinderRecipe extends BaseRecipe {
|
|||
super(Reference.grinderRecipe, tickTime, euPerTick);
|
||||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if( input2 != null)
|
||||
if (input2 != null)
|
||||
inputs.add(input2);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
|
@ -29,12 +29,12 @@ public class GrinderRecipe extends BaseRecipe {
|
|||
this.fluidStack = fluidStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Grinder";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Grinder";
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile) {
|
||||
if (fluidStack == null) {
|
||||
return true;
|
||||
|
|
|
@ -18,8 +18,8 @@ public class ImplosionCompressorRecipe extends BaseRecipe {
|
|||
addOutput(output2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Implosion Compressor";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Implosion Compressor";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,41 +1,36 @@
|
|||
package techreborn.api.recipe.machines;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
import techreborn.lib.Reference;
|
||||
import techreborn.tiles.TileIndustrialElectrolyzer;
|
||||
|
||||
public class IndustrialElectrolyzerRecipe extends BaseRecipe {
|
||||
|
||||
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";
|
||||
}
|
||||
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 boolean useOreDic()
|
||||
{
|
||||
return useOreDictionary;
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Industrial Electrolyzer";
|
||||
}
|
||||
|
||||
private boolean useOreDictionary = true;
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return useOreDictionary;
|
||||
}
|
||||
|
||||
private boolean useOreDictionary = true;
|
||||
}
|
||||
|
|
|
@ -44,12 +44,12 @@ public class IndustrialSawmillRecipe extends BaseRecipe {
|
|||
this.canUseOreDict = canUseOreDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Industrial Sawmill";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Industrial Sawmill";
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean canCraft(TileEntity tile) {
|
||||
if (fluidStack == null) {
|
||||
return true;
|
||||
|
@ -92,8 +92,8 @@ public class IndustrialSawmillRecipe extends BaseRecipe {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return canUseOreDict;
|
||||
}
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return canUseOreDict;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ public class LatheRecipe extends BaseRecipe {
|
|||
addOutput(output1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Lathe";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Lathe";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,11 +11,11 @@ public class PlateCuttingMachineRecipe extends BaseRecipe {
|
|||
if (input1 != null)
|
||||
inputs.add(input1);
|
||||
if (output1 != null)
|
||||
addOutput(output1);
|
||||
addOutput(output1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Plate Cutting Machine";
|
||||
}
|
||||
@Override
|
||||
public String getUserFreindlyName() {
|
||||
return "Plate Cutting Machine";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,15 +44,15 @@ public class RecipeConfig {
|
|||
this.machine = machine;
|
||||
}
|
||||
|
||||
public void addInputs(ConfigItem item){
|
||||
if(inputs == null){
|
||||
public void addInputs(ConfigItem item) {
|
||||
if (inputs == null) {
|
||||
inputs = new ArrayList<ConfigItem>();
|
||||
}
|
||||
inputs.add(item);
|
||||
}
|
||||
|
||||
public void addOutputs(ConfigItem item){
|
||||
if(outputs == null){
|
||||
public void addOutputs(ConfigItem item) {
|
||||
if (outputs == null) {
|
||||
outputs = new ArrayList<ConfigItem>();
|
||||
}
|
||||
outputs.add(item);
|
||||
|
|
|
@ -16,14 +16,14 @@ public class RecipeConfigManager {
|
|||
|
||||
static File configFile = null;
|
||||
|
||||
public static void load(File configDir){
|
||||
if(configFile == null){
|
||||
public static void load(File configDir) {
|
||||
if (configFile == null) {
|
||||
configFile = new File(configDir, "techRebornRecipes.json");
|
||||
}
|
||||
}
|
||||
|
||||
public static void save(){
|
||||
if(configFile.exists()){
|
||||
public static void save() {
|
||||
if (configFile.exists()) {
|
||||
configFile.delete();
|
||||
}
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
|
@ -38,12 +38,12 @@ public class RecipeConfigManager {
|
|||
}
|
||||
|
||||
|
||||
public static boolean canLoadRecipe(IBaseRecipeType recipeType){
|
||||
public static boolean canLoadRecipe(IBaseRecipeType recipeType) {
|
||||
RecipeConfig config = new RecipeConfig();
|
||||
for(ItemStack stack : recipeType.getInputs()){
|
||||
for (ItemStack stack : recipeType.getInputs()) {
|
||||
config.addInputs(itemToConfig(stack));
|
||||
}
|
||||
for(ItemStack stack : recipeType.getOutputs()){
|
||||
for (ItemStack stack : recipeType.getOutputs()) {
|
||||
config.addOutputs(itemToConfig(stack));
|
||||
}
|
||||
config.enabled = true;
|
||||
|
@ -53,7 +53,7 @@ public class RecipeConfigManager {
|
|||
}
|
||||
|
||||
|
||||
public static ConfigItem itemToConfig(ItemStack stack){
|
||||
public static ConfigItem itemToConfig(ItemStack stack) {
|
||||
ConfigItem newItem = new ConfigItem();
|
||||
newItem.setItemName(stack.getItem().getUnlocalizedName());
|
||||
newItem.setMeta(stack.getItemDamage());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue