mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-11 15:57:52 +00:00
Fixed slag furnace, put in some extra checks for crucible, vat and smeltery
This commit is contained in:
1 parent
ca726b2b9a
commit
380559fdb8
4 files changed
+384
-363
No files matched your search
@@ -15,59 +15,60 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.factorization.SlagFurnace")
|
||||
public class SlagFurnace {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack output1, double chance1, IItemStack output2, double chance2) {
|
||||
Object recipe = FactorizationHelper.getSlagFurnaceRecipe(toStack(input), (float) chance1, toStack(output1), (float) chance2, toStack(output2));
|
||||
MineTweakerAPI.apply(new Add(toStack(input), recipe));
|
||||
}
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack output2, double chance2, IItemStack output1, double chance1) {
|
||||
Object recipe = FactorizationHelper.getSlagFurnaceRecipe(toStack(input), (float) chance1, toStack(output1), (float) chance2, toStack(output2));
|
||||
MineTweakerAPI.apply(new Add(toStack(input), recipe));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition {
|
||||
private final ItemStack input;
|
||||
private static class Add extends BaseListAddition {
|
||||
private final ItemStack input;
|
||||
|
||||
public Add(ItemStack input, Object recipe) {
|
||||
super("Slag Furnace", FactorizationHelper.slag, recipe);
|
||||
this.input = input;
|
||||
}
|
||||
public Add(ItemStack input, Object recipe) {
|
||||
super("Slag Furnace", FactorizationHelper.slag, recipe);
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return input.getDisplayName();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return input.getDisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack input) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(input), Position.ALL));
|
||||
}
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack input) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(input), Position.ALL));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeFirst(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(output), Position.FIRST));
|
||||
}
|
||||
@ZenMethod
|
||||
public static void removeFirst(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(output), Position.FIRST));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeLast(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(output), Position.LAST));
|
||||
}
|
||||
@ZenMethod
|
||||
public static void removeLast(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(output), Position.LAST));
|
||||
}
|
||||
|
||||
private static class Remove extends BaseMultipleListRemoval {
|
||||
public Remove(ItemStack stack, Position pos) {
|
||||
super("Slag Furnace", FactorizationHelper.slag, stack, pos);
|
||||
}
|
||||
private static class Remove extends BaseMultipleListRemoval {
|
||||
public Remove(ItemStack stack, Position pos) {
|
||||
super("Slag Furnace", FactorizationHelper.slag, stack, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEqual(Object recipe, Object search) {
|
||||
ItemStack input = (ItemStack) ReflectionHelper.getObject(recipe, "input");
|
||||
if (input != null && areEqual(input, (ItemStack) search)) {
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
@Override
|
||||
protected boolean isEqual(Object recipe, Object search) {
|
||||
ItemStack input = (ItemStack) ReflectionHelper.getObject(recipe, "input");
|
||||
if (input != null && areEqual(input, (ItemStack) search)) {
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return ((ItemStack) search).getDisplayName();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return ((ItemStack) search).getDisplayName();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,113 +22,118 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
||||
@ZenClass("mods.mariculture.Crucible")
|
||||
public class Crucible {
|
||||
|
||||
/********************************************** Mariculture Crucible Recipes **********************************************/
|
||||
/********************************************** Mariculture Crucible Recipes **********************************************/
|
||||
|
||||
//Adding a Mariculture Crucible recipe
|
||||
@ZenMethod
|
||||
public static void addRecipe(int temp, IItemStack input, ILiquidStack fluid, @Optional IItemStack output, @Optional int chance) {
|
||||
ItemStack out = output != null ? toStack(output) : null;
|
||||
MineTweakerAPI.apply(new AddRecipe(new RecipeSmelter(toStack(input), null, temp, toFluid(fluid), out, chance)));
|
||||
}
|
||||
// Adding a Mariculture Crucible recipe
|
||||
@ZenMethod
|
||||
public static void addRecipe(int temp, IItemStack input, ILiquidStack fluid, @Optional IItemStack output, @Optional int chance) {
|
||||
ItemStack out = output != null ? toStack(output) : null;
|
||||
MineTweakerAPI.apply(new AddRecipe(new RecipeSmelter(toStack(input), null, temp, toFluid(fluid), out, chance)));
|
||||
}
|
||||
|
||||
//Passes the list to the base list implementation, and adds the recipe
|
||||
private static class AddRecipe extends BaseListAddition {
|
||||
public AddRecipe(RecipeSmelter recipe) {
|
||||
super("Mariculture Crucible", MaricultureHandlers.crucible.getRecipes(), recipe);
|
||||
}
|
||||
// Passes the list to the base list implementation, and adds the recipe
|
||||
private static class AddRecipe extends BaseListAddition {
|
||||
public AddRecipe(RecipeSmelter recipe) {
|
||||
super("Mariculture Crucible", MaricultureHandlers.crucible.getRecipes(), recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return ((RecipeSmelter) recipe).input.getDisplayName();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return ((RecipeSmelter) recipe).input.getDisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Removing a Mariculture Crucible recipe
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack input) {
|
||||
MineTweakerAPI.apply(new RemoveRecipe(toStack(input)));
|
||||
}
|
||||
// Removing a Mariculture Crucible recipe
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack input) {
|
||||
MineTweakerAPI.apply(new RemoveRecipe(toStack(input)));
|
||||
}
|
||||
|
||||
//Removes a recipe, apply is never the same for anything, so will always need to override it
|
||||
private static class RemoveRecipe extends BaseListRemoval {
|
||||
public RemoveRecipe(ItemStack stack) {
|
||||
super("Mariculture Crucible", MaricultureHandlers.crucible.getRecipes(), stack);
|
||||
}
|
||||
// Removes a recipe, apply is never the same for anything, so will always
|
||||
// need to override it
|
||||
private static class RemoveRecipe extends BaseListRemoval {
|
||||
public RemoveRecipe(ItemStack stack) {
|
||||
super("Mariculture Crucible", MaricultureHandlers.crucible.getRecipes(), stack);
|
||||
}
|
||||
|
||||
//Loops through the registry, to find the item that matches, saves that recipe then removes it
|
||||
@Override
|
||||
public void apply() {
|
||||
for (RecipeSmelter r : MaricultureHandlers.crucible.getRecipes()) {
|
||||
if (r.input != null && areEqual(r.input, stack)) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Loops through the registry, to find the item that matches, saves that
|
||||
// recipe then removes it
|
||||
@Override
|
||||
public void apply() {
|
||||
|
||||
MaricultureHandlers.crucible.getRecipes().remove(recipe);
|
||||
}
|
||||
for (RecipeSmelter r : MaricultureHandlers.crucible.getRecipes()) {
|
||||
if (r != null) {
|
||||
if (r.input != null && stack != null && areEqual(r.input, stack)) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (recipe != null)
|
||||
MaricultureHandlers.crucible.getRecipes().remove(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return stack.getDisplayName();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return stack.getDisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************** Crucible Fuels **********************************************/
|
||||
@ZenMethod
|
||||
public static void addFuel(IItemStack input, int max, int per, int time) {
|
||||
MineTweakerAPI.apply(new AddFuel(toStack(input), new FuelInfo(max, per, time)));
|
||||
}
|
||||
/********************************************** Crucible Fuels **********************************************/
|
||||
@ZenMethod
|
||||
public static void addFuel(IItemStack input, int max, int per, int time) {
|
||||
MineTweakerAPI.apply(new AddFuel(toStack(input), new FuelInfo(max, per, time)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addFuel(ILiquidStack input, int max, int per, int time) {
|
||||
MineTweakerAPI.apply(new AddFuel(toFluid(input), new FuelInfo(max, per, time)));
|
||||
}
|
||||
@ZenMethod
|
||||
public static void addFuel(ILiquidStack input, int max, int per, int time) {
|
||||
MineTweakerAPI.apply(new AddFuel(toFluid(input), new FuelInfo(max, per, time)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addFuel(String input, int max, int per, int time) {
|
||||
MineTweakerAPI.apply(new AddFuel(input, new FuelInfo(max, per, time)));
|
||||
}
|
||||
@ZenMethod
|
||||
public static void addFuel(String input, int max, int per, int time) {
|
||||
MineTweakerAPI.apply(new AddFuel(input, new FuelInfo(max, per, time)));
|
||||
}
|
||||
|
||||
//Passes the list to the base map implementation, and adds the recipe
|
||||
private static class AddFuel extends BaseMapAddition {
|
||||
public AddFuel(Object o, FuelInfo info) {
|
||||
super("Mariculture Crucible Fuel", MaricultureHelper.fuels, MaricultureHelper.getKey(o), info);
|
||||
}
|
||||
// Passes the list to the base map implementation, and adds the recipe
|
||||
private static class AddFuel extends BaseMapAddition {
|
||||
public AddFuel(Object o, FuelInfo info) {
|
||||
super("Mariculture Crucible Fuel", MaricultureHelper.fuels, MaricultureHelper.getKey(o), info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return (String) key;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return (String) key;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ZenMethod
|
||||
public static void removeFuel(IItemStack fuel) {
|
||||
MineTweakerAPI.apply(new RemoveFuel(fuel));
|
||||
}
|
||||
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ZenMethod
|
||||
public static void removeFuel(IItemStack fuel) {
|
||||
MineTweakerAPI.apply(new RemoveFuel(fuel));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeFuel(ILiquidStack fuel) {
|
||||
MineTweakerAPI.apply(new RemoveFuel(fuel));
|
||||
}
|
||||
@ZenMethod
|
||||
public static void removeFuel(ILiquidStack fuel) {
|
||||
MineTweakerAPI.apply(new RemoveFuel(fuel));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeFuel(String fuel) {
|
||||
MineTweakerAPI.apply(new RemoveFuel(fuel));
|
||||
}
|
||||
@ZenMethod
|
||||
public static void removeFuel(String fuel) {
|
||||
MineTweakerAPI.apply(new RemoveFuel(fuel));
|
||||
}
|
||||
|
||||
//Removes a recipe, will always remove the key, so all should be good
|
||||
private static class RemoveFuel extends BaseMapRemoval {
|
||||
public RemoveFuel(Object o) {
|
||||
super("Mariculture Crucible Fuel", MaricultureHelper.fuels, MaricultureHelper.getKey(o), null);
|
||||
}
|
||||
// Removes a recipe, will always remove the key, so all should be good
|
||||
private static class RemoveFuel extends BaseMapRemoval {
|
||||
public RemoveFuel(Object o) {
|
||||
super("Mariculture Crucible Fuel", MaricultureHelper.fuels, MaricultureHelper.getKey(o), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return (String) key;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return (String) key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,115 +17,120 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.mariculture.Vat")
|
||||
public class Vat {
|
||||
//Adding a Mariculture Vat recipe
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, ILiquidStack outputFluid, int time) {
|
||||
addRecipe(fluid1, fluid2, null, outputFluid, null, time);
|
||||
}
|
||||
// Adding a Mariculture Vat recipe
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, ILiquidStack outputFluid, int time) {
|
||||
addRecipe(fluid1, fluid2, null, outputFluid, null, time);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, IItemStack outputItem, int time) {
|
||||
addRecipe(fluid1, fluid2, null, null, outputItem, time);
|
||||
}
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, IItemStack outputItem, int time) {
|
||||
addRecipe(fluid1, fluid2, null, null, outputItem, time);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, ILiquidStack outputFluid, IItemStack outputItem, int time) {
|
||||
addRecipe(fluid1, fluid2, null, outputFluid, outputItem, time);
|
||||
}
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, ILiquidStack outputFluid, IItemStack outputItem, int time) {
|
||||
addRecipe(fluid1, fluid2, null, outputFluid, outputItem, time);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, IItemStack input, ILiquidStack outputFluid, int time) {
|
||||
addRecipe(fluid1, null, input, outputFluid, null, time);
|
||||
}
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, IItemStack input, ILiquidStack outputFluid, int time) {
|
||||
addRecipe(fluid1, null, input, outputFluid, null, time);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, IItemStack input, IItemStack outputItem, int time) {
|
||||
addRecipe(fluid1, null, input, null, outputItem, time);
|
||||
}
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, IItemStack input, IItemStack outputItem, int time) {
|
||||
addRecipe(fluid1, null, input, null, outputItem, time);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, IItemStack input, ILiquidStack outputFluid, IItemStack outputItem, int time) {
|
||||
addRecipe(fluid1, null, input, outputFluid, outputItem, time);
|
||||
}
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, IItemStack input, ILiquidStack outputFluid, IItemStack outputItem, int time) {
|
||||
addRecipe(fluid1, null, input, outputFluid, outputItem, time);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, IItemStack input, ILiquidStack outputFluid, int time) {
|
||||
addRecipe(fluid1, fluid2, input, outputFluid, null, time);
|
||||
}
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, IItemStack input, ILiquidStack outputFluid, int time) {
|
||||
addRecipe(fluid1, fluid2, input, outputFluid, null, time);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, IItemStack input, IItemStack outputItem, int time) {
|
||||
addRecipe(fluid1, fluid2, input, null, outputItem, time);
|
||||
}
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, IItemStack input, IItemStack outputItem, int time) {
|
||||
addRecipe(fluid1, fluid2, input, null, outputItem, time);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, IItemStack input, ILiquidStack outputFluid, IItemStack outputItem, int time) {
|
||||
MineTweakerAPI.apply(new Add(new RecipeVat(toStack(input), toFluid(fluid1), toFluid(fluid2), toFluid(outputFluid), toStack(outputItem), time)));
|
||||
}
|
||||
@ZenMethod
|
||||
public static void addRecipe(ILiquidStack fluid1, ILiquidStack fluid2, IItemStack input, ILiquidStack outputFluid, IItemStack outputItem, int time) {
|
||||
MineTweakerAPI.apply(new Add(new RecipeVat(toStack(input), toFluid(fluid1), toFluid(fluid2), toFluid(outputFluid), toStack(outputItem), time)));
|
||||
}
|
||||
|
||||
//Passes the list to the base list implementation, and adds the recipe
|
||||
private static class Add extends BaseListAddition {
|
||||
public Add(RecipeVat recipe) {
|
||||
super("Mariculture Vat", MaricultureHandlers.vat.getRecipes(), recipe);
|
||||
}
|
||||
// Passes the list to the base list implementation, and adds the recipe
|
||||
private static class Add extends BaseListAddition {
|
||||
public Add(RecipeVat recipe) {
|
||||
super("Mariculture Vat", MaricultureHandlers.vat.getRecipes(), recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
if (((RecipeVat) recipe).outputItem != null) return ((RecipeVat) recipe).outputItem.getDisplayName();
|
||||
else return ((RecipeVat) recipe).outputFluid.getFluid().getLocalizedName();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
if (((RecipeVat) recipe).outputItem != null)
|
||||
return ((RecipeVat) recipe).outputItem.getDisplayName();
|
||||
else
|
||||
return ((RecipeVat) recipe).outputFluid.getFluid().getLocalizedName();
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Removing a Mariculture Vat recipe
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack outputItem) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(outputItem), null));
|
||||
}
|
||||
// Removing a Mariculture Vat recipe
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack outputItem) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(outputItem), null));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(ILiquidStack outputFluid) {
|
||||
MineTweakerAPI.apply(new Remove(null, toFluid(outputFluid)));
|
||||
}
|
||||
@ZenMethod
|
||||
public static void removeRecipe(ILiquidStack outputFluid) {
|
||||
MineTweakerAPI.apply(new Remove(null, toFluid(outputFluid)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack outputItem, ILiquidStack outputFluid) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(outputItem), toFluid(outputFluid)));
|
||||
}
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack outputItem, ILiquidStack outputFluid) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(outputItem), toFluid(outputFluid)));
|
||||
}
|
||||
|
||||
//Removes a recipe, apply is never the same for anything, so will always need to override it
|
||||
private static class Remove extends BaseListRemoval {
|
||||
private final FluidStack fluid;
|
||||
// Removes a recipe, apply is never the same for anything, so will always
|
||||
// need to override it
|
||||
private static class Remove extends BaseListRemoval {
|
||||
private final FluidStack fluid;
|
||||
|
||||
public Remove(ItemStack stack, FluidStack fluid) {
|
||||
super("Mariculture Vat", MaricultureHandlers.vat.getRecipes(), stack);
|
||||
this.fluid = fluid;
|
||||
}
|
||||
public Remove(ItemStack stack, FluidStack fluid) {
|
||||
super("Mariculture Vat", MaricultureHandlers.vat.getRecipes(), stack);
|
||||
this.fluid = fluid;
|
||||
}
|
||||
|
||||
//Loops through the registry, to find the item that matches, saves that recipe then removes it
|
||||
@Override
|
||||
public void apply() {
|
||||
for (RecipeVat r : MaricultureHandlers.vat.getRecipes()) {
|
||||
if (r.outputItem != null && stack != null && areEqual(r.outputItem, stack)) {
|
||||
if (r.outputFluid == null || (fluid != null && r.outputFluid.isFluidStackIdentical(fluid))) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Loops through the registry, to find the item that matches, saves that
|
||||
// recipe then removes it
|
||||
@Override
|
||||
public void apply() {
|
||||
for (RecipeVat r : MaricultureHandlers.vat.getRecipes()) {
|
||||
if (r != null)
|
||||
if (r.outputItem != null && stack != null && areEqual(r.outputItem, stack)) {
|
||||
if (r.outputFluid == null || (fluid != null && r.outputFluid.isFluidStackIdentical(fluid))) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((r.outputFluid != null && fluid != null && r.outputFluid.isFluidStackIdentical(fluid))) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((r.outputFluid != null && fluid != null && r.outputFluid.isFluidStackIdentical(fluid))) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (recipe != null)
|
||||
MaricultureHandlers.vat.getRecipes().remove(recipe);
|
||||
}
|
||||
|
||||
MaricultureHandlers.vat.getRecipes().remove(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return stack != null ? stack.getDisplayName() : fluid.getFluid().getLocalizedName();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return stack != null ? stack.getDisplayName() : fluid.getFluid().getLocalizedName();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,165 +31,175 @@ import tconstruct.library.crafting.AlloyMix;
|
||||
@ZenClass("mods.tconstruct.Smeltery")
|
||||
public class Smeltery {
|
||||
|
||||
/********************************************** TConstruct Alloy Recipes **********************************************/
|
||||
/********************************************** TConstruct Alloy Recipes **********************************************/
|
||||
|
||||
//Adding a TConstruct Alloy recipe
|
||||
@ZenMethod
|
||||
public static void addAlloy(ILiquidStack output, ILiquidStack[] input) {
|
||||
MineTweakerAPI.apply(new AddAlloy(new AlloyMix(toFluid(output), new ArrayList<FluidStack>(Arrays.asList(toFluids(input))))));
|
||||
}
|
||||
// Adding a TConstruct Alloy recipe
|
||||
@ZenMethod
|
||||
public static void addAlloy(ILiquidStack output, ILiquidStack[] input) {
|
||||
MineTweakerAPI.apply(new AddAlloy(new AlloyMix(toFluid(output), new ArrayList<FluidStack>(Arrays.asList(toFluids(input))))));
|
||||
}
|
||||
|
||||
//Passes the list to the base list implementation, and adds the recipe
|
||||
private static class AddAlloy extends BaseListAddition {
|
||||
public AddAlloy(AlloyMix recipe) {
|
||||
super("Smeltery - Alloy", TConstructHelper.alloys, recipe);
|
||||
}
|
||||
// Passes the list to the base list implementation, and adds the recipe
|
||||
private static class AddAlloy extends BaseListAddition {
|
||||
public AddAlloy(AlloyMix recipe) {
|
||||
super("Smeltery - Alloy", TConstructHelper.alloys, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return ((AlloyMix) recipe).result.getFluid().getName();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return ((AlloyMix) recipe).result.getFluid().getName();
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Removing a TConstruct Alloy recipe
|
||||
@ZenMethod
|
||||
public static void removeAlloy(ILiquidStack output) {
|
||||
MineTweakerAPI.apply(new RemoveAlloy((toFluid(output))));
|
||||
}
|
||||
// Removing a TConstruct Alloy recipe
|
||||
@ZenMethod
|
||||
public static void removeAlloy(ILiquidStack output) {
|
||||
MineTweakerAPI.apply(new RemoveAlloy((toFluid(output))));
|
||||
}
|
||||
|
||||
//Removes a recipe, apply is never the same for anything, so will always need to override it
|
||||
private static class RemoveAlloy extends BaseListRemoval {
|
||||
public RemoveAlloy(FluidStack output) {
|
||||
super("Smeltery - Alloy", TConstructHelper.alloys, output);
|
||||
}
|
||||
// Removes a recipe, apply is never the same for anything, so will always
|
||||
// need to override it
|
||||
private static class RemoveAlloy extends BaseListRemoval {
|
||||
public RemoveAlloy(FluidStack output) {
|
||||
super("Smeltery - Alloy", TConstructHelper.alloys, output);
|
||||
}
|
||||
|
||||
//Loops through the registry, to find the item that matches, saves that recipe then removes it
|
||||
@Override
|
||||
public void apply() {
|
||||
for (AlloyMix r : TConstructHelper.alloys) {
|
||||
if (r.result != null && r.result.isFluidStackIdentical(fluid)) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Loops through the registry, to find the item that matches, saves that
|
||||
// recipe then removes it
|
||||
@Override
|
||||
public void apply() {
|
||||
for (AlloyMix r : TConstructHelper.alloys) {
|
||||
if (r != null) {
|
||||
if (r.result != null && fluid != null && r.result.isFluidStackIdentical(fluid)) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (recipe != null)
|
||||
TConstructHelper.alloys.remove(recipe);
|
||||
|
||||
TConstructHelper.alloys.remove(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return fluid.getFluid().getName();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return fluid.getFluid().getName();
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************** TConstruct Melting Recipes **********************************************/
|
||||
/********************************************** TConstruct Melting Recipes **********************************************/
|
||||
|
||||
//Adding a TConstruct Melting recipe
|
||||
@ZenMethod
|
||||
public static void addMelting(IItemStack input, ILiquidStack output, int temp, @Optional IItemStack block) {
|
||||
if (block == null) block = input;
|
||||
if (isABlock(block)) {
|
||||
Block theBlock = Block.getBlockFromItem(toStack(block).getItem());
|
||||
int theMeta = toStack(block).getItemDamage();
|
||||
MineTweakerAPI.apply(new AddMelting(toStack(input), theBlock, theMeta, temp, toFluid(output)));
|
||||
}
|
||||
}
|
||||
// Adding a TConstruct Melting recipe
|
||||
@ZenMethod
|
||||
public static void addMelting(IItemStack input, ILiquidStack output, int temp, @Optional IItemStack block) {
|
||||
if (block == null)
|
||||
block = input;
|
||||
if (isABlock(block)) {
|
||||
Block theBlock = Block.getBlockFromItem(toStack(block).getItem());
|
||||
int theMeta = toStack(block).getItemDamage();
|
||||
MineTweakerAPI.apply(new AddMelting(toStack(input), theBlock, theMeta, temp, toFluid(output)));
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addMelting(IOreDictEntry input, ILiquidStack output, int temp, @Optional IItemStack block) {
|
||||
for (ItemStack stack : OreDictionary.getOres(input.getName())) {
|
||||
addMelting(MineTweakerMC.getIItemStack(stack), output, temp, block);
|
||||
}
|
||||
}
|
||||
@ZenMethod
|
||||
public static void addMelting(IOreDictEntry input, ILiquidStack output, int temp, @Optional IItemStack block) {
|
||||
for (ItemStack stack : OreDictionary.getOres(input.getName())) {
|
||||
addMelting(MineTweakerMC.getIItemStack(stack), output, temp, block);
|
||||
}
|
||||
}
|
||||
|
||||
//Takes all the variables and saves them in place
|
||||
private static class AddMelting extends BaseDescriptionAddition {
|
||||
private final ItemStack input;
|
||||
private final Block block;
|
||||
private final int meta;
|
||||
private final int temp;
|
||||
private final FluidStack output;
|
||||
// Takes all the variables and saves them in place
|
||||
private static class AddMelting extends BaseDescriptionAddition {
|
||||
private final ItemStack input;
|
||||
private final Block block;
|
||||
private final int meta;
|
||||
private final int temp;
|
||||
private final FluidStack output;
|
||||
|
||||
public AddMelting(ItemStack input, Block block, int meta, int temp, FluidStack output) {
|
||||
super("Smeltery - Melting");
|
||||
this.input = input;
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
this.temp = temp;
|
||||
this.output = output;
|
||||
}
|
||||
public AddMelting(ItemStack input, Block block, int meta, int temp, FluidStack output) {
|
||||
super("Smeltery - Melting");
|
||||
this.input = input;
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
this.temp = temp;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
//Adds the Melting recipe
|
||||
@Override
|
||||
public void apply() {
|
||||
tconstruct.library.crafting.Smeltery.instance.addMelting(input, block, meta, temp, output);
|
||||
}
|
||||
// Adds the Melting recipe
|
||||
@Override
|
||||
public void apply() {
|
||||
tconstruct.library.crafting.Smeltery.instance.addMelting(input, block, meta, temp, output);
|
||||
}
|
||||
|
||||
//Removes the Melting recipe from the hashmaps
|
||||
@Override
|
||||
public void undo() {
|
||||
ItemMetaWrapper in = new ItemMetaWrapper(input);
|
||||
TConstructHelper.smeltingList.remove(in);
|
||||
TConstructHelper.temperatureList.remove(in);
|
||||
TConstructHelper.renderIndex.remove(in);
|
||||
}
|
||||
// Removes the Melting recipe from the hashmaps
|
||||
@Override
|
||||
public void undo() {
|
||||
ItemMetaWrapper in = new ItemMetaWrapper(input);
|
||||
TConstructHelper.smeltingList.remove(in);
|
||||
TConstructHelper.temperatureList.remove(in);
|
||||
TConstructHelper.renderIndex.remove(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return input.getDisplayName();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return input.getDisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Removing a TConstruct Melting recipe
|
||||
@ZenMethod
|
||||
public static void removeMelting(IItemStack input) {
|
||||
MineTweakerAPI.apply(new RemoveMelting((toStack(input))));
|
||||
}
|
||||
// Removing a TConstruct Melting recipe
|
||||
@ZenMethod
|
||||
public static void removeMelting(IItemStack input) {
|
||||
MineTweakerAPI.apply(new RemoveMelting((toStack(input))));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeMelting(IOreDictEntry input) {
|
||||
for (ItemStack stack : OreDictionary.getOres(input.getName())) {
|
||||
removeMelting(MineTweakerMC.getIItemStack(stack));
|
||||
}
|
||||
}
|
||||
@ZenMethod
|
||||
public static void removeMelting(IOreDictEntry input) {
|
||||
for (ItemStack stack : OreDictionary.getOres(input.getName())) {
|
||||
removeMelting(MineTweakerMC.getIItemStack(stack));
|
||||
}
|
||||
}
|
||||
|
||||
//Removes a recipe, apply is never the same for anything, so will always need to override it
|
||||
private static class RemoveMelting extends BaseDescriptionRemoval {
|
||||
private final ItemStack input;
|
||||
private FluidStack fluid;
|
||||
private Integer temp;
|
||||
private ItemStack renderer;
|
||||
// Removes a recipe, apply is never the same for anything, so will always
|
||||
// need to override it
|
||||
private static class RemoveMelting extends BaseDescriptionRemoval {
|
||||
private final ItemStack input;
|
||||
private FluidStack fluid;
|
||||
private Integer temp;
|
||||
private ItemStack renderer;
|
||||
|
||||
public RemoveMelting(ItemStack input) {
|
||||
super("Smeltery - Melting");
|
||||
this.input = input;
|
||||
}
|
||||
public RemoveMelting(ItemStack input) {
|
||||
super("Smeltery - Melting");
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
//Gets the current values, and saves, them removes them from the hashmaps
|
||||
@Override
|
||||
public void apply() {
|
||||
ItemMetaWrapper in = new ItemMetaWrapper(input);
|
||||
fluid = TConstructHelper.smeltingList.get(in);
|
||||
temp = TConstructHelper.temperatureList.get(in);
|
||||
renderer = TConstructHelper.renderIndex.get(in);
|
||||
TConstructHelper.smeltingList.remove(in);
|
||||
TConstructHelper.temperatureList.remove(in);
|
||||
TConstructHelper.renderIndex.remove(in);
|
||||
}
|
||||
// Gets the current values, and saves, them removes them from the
|
||||
// hashmaps
|
||||
@Override
|
||||
public void apply() {
|
||||
ItemMetaWrapper in = new ItemMetaWrapper(input);
|
||||
fluid = TConstructHelper.smeltingList.get(in);
|
||||
temp = TConstructHelper.temperatureList.get(in);
|
||||
renderer = TConstructHelper.renderIndex.get(in);
|
||||
TConstructHelper.smeltingList.remove(in);
|
||||
TConstructHelper.temperatureList.remove(in);
|
||||
TConstructHelper.renderIndex.remove(in);
|
||||
}
|
||||
|
||||
//Reads the Melting recipe
|
||||
@Override
|
||||
public void undo() {
|
||||
// tconstruct.library.crafting.Smeltery.instance.addMelting(input, Block.getBlockFromItem(renderer.getItem()), renderer.getItemDamage(), temp, fluid);
|
||||
}
|
||||
// Reads the Melting recipe
|
||||
@Override
|
||||
public void undo() {
|
||||
// tconstruct.library.crafting.Smeltery.instance.addMelting(input,
|
||||
// Block.getBlockFromItem(renderer.getItem()),
|
||||
// renderer.getItemDamage(), temp, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return input.getDisplayName();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return input.getDisplayName();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user