Remove SoldererRecipe - it's now a factory method in ISoldererRegistry
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package refinedstorage.api.solderer;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -30,4 +31,15 @@ public interface ISoldererRegistry {
|
||||
* @return a list with all the solderer recipes
|
||||
*/
|
||||
List<ISoldererRecipe> getRecipes();
|
||||
|
||||
/**
|
||||
* Creates a simple solderer recipe.
|
||||
*
|
||||
* @param result the result
|
||||
* @param duration the duration in ticks
|
||||
* @param rows the rows of this recipe, has to be 3 rows (null for an empty row)
|
||||
* @return a solderer recipe
|
||||
*/
|
||||
@Nonnull
|
||||
ISoldererRecipe createSimpleRecipe(@Nonnull ItemStack result, int duration, ItemStack... rows);
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
package refinedstorage.api.solderer;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A basic solderer recipe.
|
||||
* Implement {@link ISoldererRecipe} for custom behavior.
|
||||
*/
|
||||
public class SoldererRecipe implements ISoldererRecipe {
|
||||
private int duration;
|
||||
private ItemStack result;
|
||||
private ItemStack[] rows;
|
||||
|
||||
/**
|
||||
* @param result the result
|
||||
* @param duration the duration in ticks
|
||||
* @param rows the rows of this recipe, has to be 3 rows (null for an empty row)
|
||||
*/
|
||||
public SoldererRecipe(@Nonnull ItemStack result, int duration, ItemStack... rows) {
|
||||
if (rows.length != 3) {
|
||||
throw new IllegalArgumentException("Solderer recipe expects 3 rows, got " + rows.length + " rows");
|
||||
}
|
||||
|
||||
this.duration = duration;
|
||||
this.result = result;
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param row the row in the solderer that we want the stack for (between 0 - 2)
|
||||
* @return a stack for that row, null if there is no stack
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public ItemStack getRow(int row) {
|
||||
return rows[row];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the result stack
|
||||
*/
|
||||
@Override
|
||||
@Nonnull
|
||||
public ItemStack getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the time it takes to complete this recipe
|
||||
*/
|
||||
@Override
|
||||
public int getDuration() {
|
||||
return duration;
|
||||
}
|
||||
}
|
||||
@@ -51,4 +51,31 @@ public class SoldererRegistry implements ISoldererRegistry {
|
||||
public List<ISoldererRecipe> getRecipes() {
|
||||
return recipes;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ISoldererRecipe createSimpleRecipe(@Nonnull ItemStack result, int duration, ItemStack... rows) {
|
||||
if (rows.length != 3) {
|
||||
throw new IllegalArgumentException("Solderer recipe expects 3 rows, got " + rows.length + " rows");
|
||||
}
|
||||
|
||||
return new ISoldererRecipe() {
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getRow(int row) {
|
||||
return rows[row];
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDuration() {
|
||||
return duration;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.util.IComparer;
|
||||
|
||||
// @TODO: Move to RSUtils
|
||||
public final class FluidUtils {
|
||||
public static final ItemStack EMPTY_BUCKET = new ItemStack(Items.BUCKET);
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import refinedstorage.RS;
|
||||
import refinedstorage.RSBlocks;
|
||||
import refinedstorage.RSItems;
|
||||
import refinedstorage.api.RSAPI;
|
||||
import refinedstorage.api.solderer.SoldererRecipe;
|
||||
import refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementRoot;
|
||||
import refinedstorage.apiimpl.autocrafting.craftingmonitor.CraftingMonitorElementToTake;
|
||||
import refinedstorage.apiimpl.autocrafting.registry.CraftingTaskFactoryNormal;
|
||||
@@ -216,7 +215,7 @@ public class CommonProxy {
|
||||
);
|
||||
|
||||
// Disk Drive
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(RSAPI.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.DISK_DRIVE),
|
||||
500,
|
||||
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
@@ -258,7 +257,7 @@ public class CommonProxy {
|
||||
);
|
||||
|
||||
// Crafting Grid
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(RSAPI.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.GRID, 1, EnumGridType.CRAFTING.getId()),
|
||||
500,
|
||||
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
@@ -267,7 +266,7 @@ public class CommonProxy {
|
||||
));
|
||||
|
||||
// Pattern Grid
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(RSAPI.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.GRID, 1, EnumGridType.PATTERN.getId()),
|
||||
500,
|
||||
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
@@ -276,7 +275,7 @@ public class CommonProxy {
|
||||
));
|
||||
|
||||
// Fluid Grid
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(RSAPI.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.GRID, 1, EnumGridType.FLUID.getId()),
|
||||
500,
|
||||
new ItemStack(RSItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
@@ -570,7 +569,7 @@ public class CommonProxy {
|
||||
));
|
||||
|
||||
// Interface
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(RSAPI.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.INTERFACE),
|
||||
200,
|
||||
new ItemStack(RSBlocks.IMPORTER),
|
||||
@@ -579,7 +578,7 @@ public class CommonProxy {
|
||||
));
|
||||
|
||||
// Fluid Interface
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
|
||||
RSAPI.instance().getSoldererRegistry().addRecipe(RSAPI.instance().getSoldererRegistry().createSimpleRecipe(
|
||||
new ItemStack(RSBlocks.FLUID_INTERFACE),
|
||||
200,
|
||||
new ItemStack(Items.BUCKET),
|
||||
|
||||
Reference in New Issue
Block a user