Fixed formatting

This commit is contained in:
Jared 2017-07-25 22:56:19 +02:00
parent d4a9c12add
commit 03f8eed67b
14 changed files with 111 additions and 104 deletions

View file

@ -25,73 +25,73 @@ import java.util.Iterator;
@ZenClass("mods.betterwithmods.Anvil") @ZenClass("mods.betterwithmods.Anvil")
@Handler("betterwithmods") @Handler("betterwithmods")
public class Anvil { public class Anvil {
@ZenMethod @ZenMethod
public static void addShaped(IItemStack output, IIngredient[][] inputs) { public static void addShaped(IItemStack output, IIngredient[][] inputs) {
CraftTweakerAPI.apply(new AddShaped(output, inputs)); CraftTweakerAPI.apply(new AddShaped(output, inputs));
} }
@ZenMethod @ZenMethod
public static void addShapeless(IItemStack output, IIngredient[] inputs) { public static void addShapeless(IItemStack output, IIngredient[] inputs) {
CraftTweakerAPI.apply(new AddShapeless(output, inputs)); CraftTweakerAPI.apply(new AddShapeless(output, inputs));
} }
@ZenMethod @ZenMethod
public static void removeShaped(IItemStack output, @Optional IIngredient[][] ingredients) { public static void removeShaped(IItemStack output, @Optional IIngredient[][] ingredients) {
CraftTweakerAPI.apply(new RemoveShaped(output, ingredients)); CraftTweakerAPI.apply(new RemoveShaped(output, ingredients));
} }
@ZenMethod @ZenMethod
public static void removeShapeless(IItemStack output, @Optional IIngredient[] ingredients) { public static void removeShapeless(IItemStack output, @Optional IIngredient[] ingredients) {
CraftTweakerAPI.apply(new RemoveShapeless(output, ingredients)); CraftTweakerAPI.apply(new RemoveShapeless(output, ingredients));
} }
public static class AddShaped extends BaseUndoable { public static class AddShaped extends BaseUndoable {
private final IItemStack output; private final IItemStack output;
private final IIngredient[][] ingredients; private final IIngredient[][] ingredients;
public AddShaped(IItemStack output, IIngredient[][] ingredients) { public AddShaped(IItemStack output, IIngredient[][] ingredients) {
super("Add Anvil Shaped Recipe"); super("Add Anvil Shaped Recipe");
this.output = output; this.output = output;
this.ingredients = ingredients; this.ingredients = ingredients;
} }
@Override @Override
public void apply() { public void apply() {
AnvilRecipes.addSteelShapedRecipe(new ResourceLocation("crafttweaker", this.name), InputHelper.toStack(output), toShapedAnvilObjects(ingredients)); AnvilRecipes.addSteelShapedRecipe(new ResourceLocation("crafttweaker", this.name), InputHelper.toStack(output), toShapedAnvilObjects(ingredients));
} }
@Override @Override
protected String getRecipeInfo() { protected String getRecipeInfo() {
return output.getDisplayName(); return output.getDisplayName();
} }
} }
public static class AddShapeless extends BaseUndoable { public static class AddShapeless extends BaseUndoable {
private final IItemStack output; private final IItemStack output;
private final IIngredient[] ingredients; private final IIngredient[] ingredients;
public AddShapeless(IItemStack output, IIngredient[] ingredients) { public AddShapeless(IItemStack output, IIngredient[] ingredients) {
super("Add Anvil Shapeless Recipe"); super("Add Anvil Shapeless Recipe");
this.output = output; this.output = output;
this.ingredients = ingredients; this.ingredients = ingredients;
} }
@Override @Override
public void apply() { public void apply() {
AnvilRecipes.addSteelShapelessRecipe(new ResourceLocation("crafttweaker", this.name), InputHelper.toStack(output), InputHelper.toObjects(ingredients)); AnvilRecipes.addSteelShapelessRecipe(new ResourceLocation("crafttweaker", this.name), InputHelper.toStack(output), InputHelper.toObjects(ingredients));
} }
@Override @Override
protected String getRecipeInfo() { protected String getRecipeInfo() {
return output.getDisplayName(); return output.getDisplayName();
} }
} }
public static Object[] toShapedAnvilObjects(IIngredient[][] ingredients) { public static Object[] toShapedAnvilObjects(IIngredient[][] ingredients) {
if (ingredients == null) if(ingredients == null)
return null; return null;
else { else {
ArrayList prep = new ArrayList(); ArrayList prep = new ArrayList();
@ -100,10 +100,10 @@ public class Anvil {
prep.add("ijkl"); prep.add("ijkl");
prep.add("mnop"); prep.add("mnop");
char[][] map = new char[][]{{'a', 'b', 'c', 'd'}, {'e', 'f', 'g', 'h'}, {'i', 'j', 'k', 'l'}, {'m', 'n', 'o', 'p'}}; char[][] map = new char[][]{{'a', 'b', 'c', 'd'}, {'e', 'f', 'g', 'h'}, {'i', 'j', 'k', 'l'}, {'m', 'n', 'o', 'p'}};
for (int x = 0; x < ingredients.length; x++) { for(int x = 0; x < ingredients.length; x++) {
if (ingredients[x] != null) { if(ingredients[x] != null) {
for (int y = 0; y < ingredients[x].length; y++) { for(int y = 0; y < ingredients[x].length; y++) {
if (ingredients[x][y] != null && x < map.length && y < map[x].length) { if(ingredients[x][y] != null && x < map.length && y < map[x].length) {
prep.add(map[x][y]); prep.add(map[x][y]);
prep.add(InputHelper.toObject(ingredients[x][y])); prep.add(InputHelper.toObject(ingredients[x][y]));
} }
@ -113,73 +113,75 @@ public class Anvil {
return prep.toArray(); return prep.toArray();
} }
} }
public static class RemoveShaped extends BaseUndoable { public static class RemoveShaped extends BaseUndoable {
private final IItemStack output; private final IItemStack output;
private final IIngredient[][] ingredients; private final IIngredient[][] ingredients;
protected RemoveShaped(IItemStack output, IIngredient[][] ingredients) { protected RemoveShaped(IItemStack output, IIngredient[][] ingredients) {
super("Remove Shaped Anvil"); super("Remove Shaped Anvil");
this.output = output; this.output = output;
this.ingredients = ingredients; this.ingredients = ingredients;
} }
@Override @Override
public void apply() { public void apply() {
if (ingredients != null) { if(ingredients != null) {
IRecipe removal = new ShapedAnvilRecipe(new ResourceLocation("crafttweaker", this.name), InputHelper.toStack(output), toShapedAnvilObjects(ingredients)); IRecipe removal = new ShapedAnvilRecipe(new ResourceLocation("crafttweaker", this.name), InputHelper.toStack(output), toShapedAnvilObjects(ingredients));
for (Iterator<IRecipe> iterator = AnvilCraftingManager.VANILLA_CRAFTING.iterator(); iterator.hasNext(); ) { for(Iterator<IRecipe> iterator = AnvilCraftingManager.VANILLA_CRAFTING.iterator(); iterator.hasNext(); ) {
IRecipe recipe = iterator.next(); IRecipe recipe = iterator.next();
if (recipe.getRecipeOutput().isItemEqual(removal.getRecipeOutput()) && removal.getIngredients().equals(recipe.getIngredients())) if(recipe.getRecipeOutput().isItemEqual(removal.getRecipeOutput()) && removal.getIngredients().equals(recipe.getIngredients()))
iterator.remove(); iterator.remove();
} }
} else { } else {
for (Iterator<IRecipe> iterator = AnvilCraftingManager.VANILLA_CRAFTING.iterator(); iterator.hasNext(); ) { for(Iterator<IRecipe> iterator = AnvilCraftingManager.VANILLA_CRAFTING.iterator(); iterator.hasNext(); ) {
IRecipe recipe = iterator.next(); IRecipe recipe = iterator.next();
if (recipe.getRecipeOutput().isItemEqual(InputHelper.toStack(output))) { if(recipe.getRecipeOutput().isItemEqual(InputHelper.toStack(output))) {
iterator.remove(); iterator.remove();
} }
} }
} }
} }
@Override @Override
protected String getRecipeInfo() { protected String getRecipeInfo() {
return output.getDisplayName(); return output.getDisplayName();
} }
} }
public static class RemoveShapeless extends BaseUndoable { public static class RemoveShapeless extends BaseUndoable {
private final IItemStack output; private final IItemStack output;
private final IIngredient[] ingredients; private final IIngredient[] ingredients;
protected RemoveShapeless(IItemStack output, IIngredient[] ingredients) { protected RemoveShapeless(IItemStack output, IIngredient[] ingredients) {
super("Remove Shapeless Anvil"); super("Remove Shapeless Anvil");
this.output = output; this.output = output;
this.ingredients = ingredients; this.ingredients = ingredients;
} }
@Override @Override
public void apply() { public void apply() {
if (ingredients != null) { if(ingredients != null) {
IRecipe removal = new ShapelessAnvilRecipe(new ResourceLocation("crafttweaker", this.name), InputHelper.toStack(output), InputHelper.toObjects(ingredients)); IRecipe removal = new ShapelessAnvilRecipe(new ResourceLocation("crafttweaker", this.name), InputHelper.toStack(output), InputHelper.toObjects(ingredients));
for (Iterator<IRecipe> iterator = AnvilCraftingManager.VANILLA_CRAFTING.iterator(); iterator.hasNext(); ) { for(Iterator<IRecipe> iterator = AnvilCraftingManager.VANILLA_CRAFTING.iterator(); iterator.hasNext(); ) {
IRecipe recipe = iterator.next(); IRecipe recipe = iterator.next();
if (recipe.getRecipeOutput().isItemEqual(removal.getRecipeOutput()) && removal.getIngredients().equals(recipe.getIngredients())) if(recipe.getRecipeOutput().isItemEqual(removal.getRecipeOutput()) && removal.getIngredients().equals(recipe.getIngredients()))
iterator.remove(); iterator.remove();
} }
} else { } else {
for (Iterator<IRecipe> iterator = AnvilCraftingManager.VANILLA_CRAFTING.iterator(); iterator.hasNext(); ) { for(Iterator<IRecipe> iterator = AnvilCraftingManager.VANILLA_CRAFTING.iterator(); iterator.hasNext(); ) {
IRecipe recipe = iterator.next(); IRecipe recipe = iterator.next();
if (recipe.getRecipeOutput().isItemEqual(InputHelper.toStack(output))) { if(recipe.getRecipeOutput().isItemEqual(InputHelper.toStack(output))) {
iterator.remove(); iterator.remove();
} }
} }
} }
} }
@Override @Override
protected String getRecipeInfo() { protected String getRecipeInfo() {
return output.getDisplayName(); return output.getDisplayName();

View file

@ -17,23 +17,24 @@ import java.util.Map;
@ZenClass("mods.betterwithmods.Buoyancy") @ZenClass("mods.betterwithmods.Buoyancy")
@Handler("betterwithmods") @Handler("betterwithmods")
public class Buoyancy { public class Buoyancy {
@ZenMethod @ZenMethod
public static void set(IItemStack stack, float value) { public static void set(IItemStack stack, float value) {
StackMap<Float> map = new StackMap(1.0); StackMap<Float> map = new StackMap(1.0);
map.put(new Stack(InputHelper.toStack(stack)),value); map.put(new Stack(InputHelper.toStack(stack)), value);
CraftTweakerAPI.apply(new Set(map)); CraftTweakerAPI.apply(new Set(map));
} }
public static class Set extends BaseMapAddition<Stack, Float> { public static class Set extends BaseMapAddition<Stack, Float> {
protected Set(StackMap<Float> map) { protected Set(StackMap<Float> map) {
super("Set Item Buoyancy", HCBuoy.buoyancy, map); super("Set Item Buoyancy", HCBuoy.buoyancy, map);
} }
@Override @Override
protected String getRecipeInfo(Map.Entry<Stack, Float> recipe) { protected String getRecipeInfo(Map.Entry<Stack, Float> recipe) {
return recipe.getKey().toString() + " -> " + recipe.getValue(); return recipe.getKey().toString() + " -> " + recipe.getValue();
} }
} }
} }

View file

@ -20,21 +20,21 @@ import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.betterwithmods.Cauldron") @ZenClass("mods.betterwithmods.Cauldron")
@Handler("betterwithmods") @Handler("betterwithmods")
public class Cauldron { public class Cauldron {
@ZenMethod @ZenMethod
public static void add(IItemStack output, @Optional IItemStack secondaryOutput, @NotNull IIngredient[] inputs) { public static void add(IItemStack output, @Optional IItemStack secondaryOutput, @NotNull IIngredient[] inputs) {
CauldronRecipe r = new CauldronRecipe(InputHelper.toStack(output), InputHelper.toStack(secondaryOutput), InputHelper.toObjects(inputs)); CauldronRecipe r = new CauldronRecipe(InputHelper.toStack(output), InputHelper.toStack(secondaryOutput), InputHelper.toObjects(inputs));
ModTweaker.LATE_ADDITIONS.add(new BulkAdd("Set Cauldron Recipe", CauldronManager.getInstance(), r)); ModTweaker.LATE_ADDITIONS.add(new BulkAdd("Set Cauldron Recipe", CauldronManager.getInstance(), r));
} }
@ZenMethod @ZenMethod
public static void remove(IItemStack output) { public static void remove(IItemStack output) {
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Set Cauldron Recipe", CauldronManager.getInstance(), InputHelper.toStack(output), ItemStack.EMPTY)); ModTweaker.LATE_REMOVALS.add(new BulkRemove("Set Cauldron Recipe", CauldronManager.getInstance(), InputHelper.toStack(output), ItemStack.EMPTY));
} }
@ZenMethod @ZenMethod
public static void remove(IItemStack output,@Optional IItemStack secondary, IIngredient[] inputs) { public static void remove(IItemStack output, @Optional IItemStack secondary, IIngredient[] inputs) {
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Cauldron Recipe", CauldronManager.getInstance(), InputHelper.toStack(output), secondary != null ? InputHelper.toStack(secondary) : ItemStack.EMPTY, InputHelper.toObjects(inputs))); ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Cauldron Recipe", CauldronManager.getInstance(), InputHelper.toStack(output), secondary != null ? InputHelper.toStack(secondary) : ItemStack.EMPTY, InputHelper.toObjects(inputs)));
} }
} }

View file

@ -20,18 +20,18 @@ import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.betterwithmods.Crucible") @ZenClass("mods.betterwithmods.Crucible")
@Handler("betterwithmods") @Handler("betterwithmods")
public class Crucible { public class Crucible {
@ZenMethod @ZenMethod
public static void add(IItemStack output, @Optional IItemStack secondaryOutput, @NotNull IIngredient[] inputs) { public static void add(IItemStack output, @Optional IItemStack secondaryOutput, @NotNull IIngredient[] inputs) {
CrucibleRecipe r = new CrucibleRecipe(InputHelper.toStack(output), InputHelper.toStack(secondaryOutput), InputHelper.toObjects(inputs)); CrucibleRecipe r = new CrucibleRecipe(InputHelper.toStack(output), InputHelper.toStack(secondaryOutput), InputHelper.toObjects(inputs));
ModTweaker.LATE_ADDITIONS.add(new BulkAdd("Set Crucible Recipe", CrucibleManager.getInstance(), r)); ModTweaker.LATE_ADDITIONS.add(new BulkAdd("Set Crucible Recipe", CrucibleManager.getInstance(), r));
} }
@ZenMethod @ZenMethod
public static void remove(IItemStack output) { public static void remove(IItemStack output) {
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Set Crucible Recipe", CrucibleManager.getInstance(), InputHelper.toStack(output), ItemStack.EMPTY)); ModTweaker.LATE_REMOVALS.add(new BulkRemove("Set Crucible Recipe", CrucibleManager.getInstance(), InputHelper.toStack(output), ItemStack.EMPTY));
} }
@ZenMethod @ZenMethod
public static void remove(IItemStack output, IItemStack secondary, IIngredient[] inputs) { public static void remove(IItemStack output, IItemStack secondary, IIngredient[] inputs) {
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Crucible Recipe", CrucibleManager.getInstance(), InputHelper.toStack(output), secondary != null ? InputHelper.toStack(secondary) : ItemStack.EMPTY, InputHelper.toObjects(inputs))); ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Crucible Recipe", CrucibleManager.getInstance(), InputHelper.toStack(output), secondary != null ? InputHelper.toStack(secondary) : ItemStack.EMPTY, InputHelper.toObjects(inputs)));

View file

@ -27,38 +27,39 @@ import java.util.Arrays;
@ZenClass("mods.betterwithmods.Kiln") @ZenClass("mods.betterwithmods.Kiln")
@Handler("betterwithmods") @Handler("betterwithmods")
public class Kiln { public class Kiln {
@ZenMethod @ZenMethod
public static void add(IItemStack[] output, @NotNull IItemStack input) { public static void add(IItemStack[] output, @NotNull IItemStack input) {
ItemStack stack = InputHelper.toStack(input); ItemStack stack = InputHelper.toStack(input);
if (InputHelper.isABlock(stack)) { if(InputHelper.isABlock(stack)) {
Block block = ((ItemBlock) stack.getItem()).getBlock(); Block block = ((ItemBlock) stack.getItem()).getBlock();
ItemStack[] outputs = InputHelper.toStacks(output); ItemStack[] outputs = InputHelper.toStacks(output);
KilnRecipe r = new KilnRecipe(block, stack.getMetadata(), Arrays.asList(outputs)); KilnRecipe r = new KilnRecipe(block, stack.getMetadata(), Arrays.asList(outputs));
ModTweaker.LATE_ADDITIONS.add(new BMAdd("Set Kiln Recipe", KilnManager.INSTANCE, Lists.newArrayList(r))); ModTweaker.LATE_ADDITIONS.add(new BMAdd("Set Kiln Recipe", KilnManager.INSTANCE, Lists.newArrayList(r)));
} }
} }
@ZenMethod @ZenMethod
public static void remove(IItemStack input) { public static void remove(IItemStack input) {
ModTweaker.LATE_REMOVALS.add(new BMRemove("Set Kiln Recipe", KilnManager.INSTANCE, InputHelper.toStack(input))); ModTweaker.LATE_REMOVALS.add(new BMRemove("Set Kiln Recipe", KilnManager.INSTANCE, InputHelper.toStack(input)));
} }
@ZenMethod @ZenMethod
public static void registerBlock(IItemStack block) { public static void registerBlock(IItemStack block) {
ModTweaker.LATE_ADDITIONS.add(new KilnBlock(BWMRecipes.getStateFromStack(InputHelper.toStack(block)))); ModTweaker.LATE_ADDITIONS.add(new KilnBlock(BWMRecipes.getStateFromStack(InputHelper.toStack(block))));
} }
public static class KilnBlock extends BaseUndoable { public static class KilnBlock extends BaseUndoable {
private IBlockState state; private IBlockState state;
protected KilnBlock(IBlockState state) { protected KilnBlock(IBlockState state) {
super("Set Kiln Structure Block"); super("Set Kiln Structure Block");
this.state = state; this.state = state;
} }
@Override @Override
public void apply() { public void apply() {
KilnStructureManager.registerKilnBlock(state); KilnStructureManager.registerKilnBlock(state);

View file

@ -20,20 +20,20 @@ import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.betterwithmods.Mill") @ZenClass("mods.betterwithmods.Mill")
@Handler("betterwithmods") @Handler("betterwithmods")
public class Mill { public class Mill {
@ZenMethod @ZenMethod
public static void add(IItemStack output, @Optional IItemStack secondaryOutput, @NotNull IIngredient[] inputs) { public static void add(IItemStack output, @Optional IItemStack secondaryOutput, @NotNull IIngredient[] inputs) {
MillRecipe r = new MillRecipe(0,InputHelper.toStack(output),InputHelper.toStack(secondaryOutput),InputHelper.toObjects(inputs)); MillRecipe r = new MillRecipe(0, InputHelper.toStack(output), InputHelper.toStack(secondaryOutput), InputHelper.toObjects(inputs));
ModTweaker.LATE_ADDITIONS.add(new BulkAdd("Set Mill Recipe", MillManager.getInstance(),r)); ModTweaker.LATE_ADDITIONS.add(new BulkAdd("Set Mill Recipe", MillManager.getInstance(), r));
} }
@ZenMethod @ZenMethod
public static void remove(IItemStack output) { public static void remove(IItemStack output) {
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Mill Recipe", MillManager.getInstance(),InputHelper.toStack(output), ItemStack.EMPTY)); ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Mill Recipe", MillManager.getInstance(), InputHelper.toStack(output), ItemStack.EMPTY));
} }
@ZenMethod @ZenMethod
public static void remove(IItemStack output, IIngredient[] inputs) { public static void remove(IItemStack output, IIngredient[] inputs) {
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Mill Recipe", MillManager.getInstance(),InputHelper.toStack(output), ItemStack.EMPTY, InputHelper.toObjects(inputs))); ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Mill Recipe", MillManager.getInstance(), InputHelper.toStack(output), ItemStack.EMPTY, InputHelper.toObjects(inputs)));
} }
} }

View file

@ -24,21 +24,21 @@ import java.util.Arrays;
@ZenClass("mods.betterwithmods.Saw") @ZenClass("mods.betterwithmods.Saw")
@Handler("betterwithmods") @Handler("betterwithmods")
public class Saw { public class Saw {
@ZenMethod @ZenMethod
public static void add(IItemStack[] output, @NotNull IItemStack input) { public static void add(IItemStack[] output, @NotNull IItemStack input) {
ItemStack stack = InputHelper.toStack(input); ItemStack stack = InputHelper.toStack(input);
if (InputHelper.isABlock(stack)) { if(InputHelper.isABlock(stack)) {
Block block = ((ItemBlock) stack.getItem()).getBlock(); Block block = ((ItemBlock) stack.getItem()).getBlock();
ItemStack[] outputs = InputHelper.toStacks(output); ItemStack[] outputs = InputHelper.toStacks(output);
SawRecipe r = new SawRecipe(block, stack.getMetadata(), Arrays.asList(outputs)); SawRecipe r = new SawRecipe(block, stack.getMetadata(), Arrays.asList(outputs));
ModTweaker.LATE_ADDITIONS.add(new BMAdd("Set Saw Recipe", SawManager.INSTANCE, Lists.newArrayList(r))); ModTweaker.LATE_ADDITIONS.add(new BMAdd("Set Saw Recipe", SawManager.INSTANCE, Lists.newArrayList(r)));
} }
} }
@ZenMethod @ZenMethod
public static void remove(IItemStack input) { public static void remove(IItemStack input) {
ModTweaker.LATE_REMOVALS.add(new BMRemove("Remove Saw Recipe", SawManager.INSTANCE, InputHelper.toStack(input))); ModTweaker.LATE_REMOVALS.add(new BMRemove("Remove Saw Recipe", SawManager.INSTANCE, InputHelper.toStack(input)));
} }
} }

View file

@ -21,20 +21,20 @@ import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.betterwithmods.StokedCauldron") @ZenClass("mods.betterwithmods.StokedCauldron")
@Handler("betterwithmods") @Handler("betterwithmods")
public class StokedCauldron { public class StokedCauldron {
@ZenMethod @ZenMethod
public static void add(IItemStack output, @Optional IItemStack secondaryOutput, @NotNull IIngredient[] inputs) { public static void add(IItemStack output, @Optional IItemStack secondaryOutput, @NotNull IIngredient[] inputs) {
StokedCauldronRecipe r = new StokedCauldronRecipe(InputHelper.toStack(output), InputHelper.toStack(secondaryOutput),InputHelper.toObjects(inputs)); StokedCauldronRecipe r = new StokedCauldronRecipe(InputHelper.toStack(output), InputHelper.toStack(secondaryOutput), InputHelper.toObjects(inputs));
ModTweaker.LATE_ADDITIONS.add(new BulkAdd("Set Stoked Cauldron Recipe", StokedCauldronManager.getInstance(),r)); ModTweaker.LATE_ADDITIONS.add(new BulkAdd("Set Stoked Cauldron Recipe", StokedCauldronManager.getInstance(), r));
} }
@ZenMethod @ZenMethod
public static void remove(IItemStack output) { public static void remove(IItemStack output) {
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Stoked Cauldron Recipe", StokedCauldronManager.getInstance(),InputHelper.toStack(output), ItemStack.EMPTY)); ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Stoked Cauldron Recipe", StokedCauldronManager.getInstance(), InputHelper.toStack(output), ItemStack.EMPTY));
} }
@ZenMethod @ZenMethod
public static void remove(IItemStack output, IIngredient[] inputs) { public static void remove(IItemStack output, IIngredient[] inputs) {
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Stoked Cauldron Recipe", StokedCauldronManager.getInstance(),InputHelper.toStack(output), ItemStack.EMPTY, InputHelper.toObjects(inputs))); ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Stoked Cauldron Recipe", StokedCauldronManager.getInstance(), InputHelper.toStack(output), ItemStack.EMPTY, InputHelper.toObjects(inputs)));
} }
} }

View file

@ -20,18 +20,18 @@ import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.betterwithmods.StokedCrucible") @ZenClass("mods.betterwithmods.StokedCrucible")
@Handler("betterwithmods") @Handler("betterwithmods")
public class StokedCrucible { public class StokedCrucible {
@ZenMethod @ZenMethod
public static void add(IItemStack output, @Optional IItemStack secondaryOutput, @NotNull IIngredient[] inputs) { public static void add(IItemStack output, @Optional IItemStack secondaryOutput, @NotNull IIngredient[] inputs) {
StokedCrucibleRecipe r = new StokedCrucibleRecipe(InputHelper.toStack(output), InputHelper.toStack(secondaryOutput), InputHelper.toObjects(inputs)); StokedCrucibleRecipe r = new StokedCrucibleRecipe(InputHelper.toStack(output), InputHelper.toStack(secondaryOutput), InputHelper.toObjects(inputs));
ModTweaker.LATE_ADDITIONS.add(new BulkAdd("Set Stoked Crucible Recipe", StokedCrucibleManager.getInstance(), r)); ModTweaker.LATE_ADDITIONS.add(new BulkAdd("Set Stoked Crucible Recipe", StokedCrucibleManager.getInstance(), r));
} }
@ZenMethod @ZenMethod
public static void remove(IItemStack output, @Optional IItemStack secondary) { public static void remove(IItemStack output, @Optional IItemStack secondary) {
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Set Stoked Crucible Recipe", StokedCrucibleManager.getInstance(), InputHelper.toStack(output), secondary != null ? InputHelper.toStack(secondary) : ItemStack.EMPTY)); ModTweaker.LATE_REMOVALS.add(new BulkRemove("Set Stoked Crucible Recipe", StokedCrucibleManager.getInstance(), InputHelper.toStack(output), secondary != null ? InputHelper.toStack(secondary) : ItemStack.EMPTY));
} }
@ZenMethod @ZenMethod
public static void remove(IItemStack output, @Optional IItemStack secondary, @NotNull IIngredient[] inputs) { public static void remove(IItemStack output, @Optional IItemStack secondary, @NotNull IIngredient[] inputs) {
ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Stoked Crucible Recipe", StokedCrucibleManager.getInstance(), InputHelper.toStack(output), secondary != null ? InputHelper.toStack(secondary) : ItemStack.EMPTY, InputHelper.toObjects(inputs))); ModTweaker.LATE_REMOVALS.add(new BulkRemove("Remove Stoked Crucible Recipe", StokedCrucibleManager.getInstance(), InputHelper.toStack(output), secondary != null ? InputHelper.toStack(secondary) : ItemStack.EMPTY, InputHelper.toObjects(inputs)));

View file

@ -23,37 +23,39 @@ import java.util.List;
@ZenClass("mods.betterwithmods.Turntable") @ZenClass("mods.betterwithmods.Turntable")
@Handler("betterwithmods") @Handler("betterwithmods")
public class Turntable { public class Turntable {
@ZenMethod @ZenMethod
public static void add(IItemStack inputBlock, IItemStack outputBlock, IItemStack[] additionalOutput) { public static void add(IItemStack inputBlock, IItemStack outputBlock, IItemStack[] additionalOutput) {
if (InputHelper.isABlock(inputBlock)) if(InputHelper.isABlock(inputBlock))
LogHelper.logError("Input must be a block", new IllegalArgumentException()); LogHelper.logError("Input must be a block", new IllegalArgumentException());
ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toStack(inputBlock), InputHelper.toStack(outputBlock), Lists.newArrayList(InputHelper.toStacks(additionalOutput)))); ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toStack(inputBlock), InputHelper.toStack(outputBlock), Lists.newArrayList(InputHelper.toStacks(additionalOutput))));
} }
public static class Add extends BMAdd { public static class Add extends BMAdd {
public Add(ItemStack input, ItemStack output, List<ItemStack> scraps) { public Add(ItemStack input, ItemStack output, List<ItemStack> scraps) {
super(TurntableRecipeCategory.UID, TurntableManager.INSTANCE, Lists.newArrayList(new TurntableRecipe(input, output, scraps))); super(TurntableRecipeCategory.UID, TurntableManager.INSTANCE, Lists.newArrayList(new TurntableRecipe(input, output, scraps)));
} }
} }
@ZenMethod @ZenMethod
public static void remove(IItemStack inputBlock) { public static void remove(IItemStack inputBlock) {
if (!InputHelper.isABlock(inputBlock)) if(!InputHelper.isABlock(inputBlock))
LogHelper.logError("Input must be a block", new IllegalArgumentException()); LogHelper.logError("Input must be a block", new IllegalArgumentException());
ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toStack(inputBlock))); ModTweaker.LATE_REMOVALS.add(new Remove(InputHelper.toStack(inputBlock)));
} }
public static class Remove extends BaseListRemoval<TurntableRecipe> { public static class Remove extends BaseListRemoval<TurntableRecipe> {
protected Remove(ItemStack input) { protected Remove(ItemStack input) {
super("Remove Turntable Recipe", TurntableManager.INSTANCE.getRecipes(), TurntableManager.INSTANCE.removeTurntableRecipe(input)); super("Remove Turntable Recipe", TurntableManager.INSTANCE.getRecipes(), TurntableManager.INSTANCE.removeTurntableRecipe(input));
} }
@Override @Override
protected String getRecipeInfo(TurntableRecipe recipe) { protected String getRecipeInfo(TurntableRecipe recipe) {
return recipe.getStack().getDisplayName(); return recipe.getStack().getDisplayName();
} }
} }
} }

View file

@ -7,14 +7,14 @@ import com.blamejared.mtlib.utils.BaseListAddition;
import java.util.List; import java.util.List;
public class BMAdd<T extends BlockMetaRecipe> extends BaseListAddition<T> { public class BMAdd<T extends BlockMetaRecipe> extends BaseListAddition<T> {
public BMAdd(String name, BlockMetaManager<T> handler, List<T> recipes) { public BMAdd(String name, BlockMetaManager<T> handler, List<T> recipes) {
super(name, handler.getRecipes(), recipes); super(name, handler.getRecipes(), recipes);
} }
@Override @Override
protected String getRecipeInfo(BlockMetaRecipe recipe) { protected String getRecipeInfo(BlockMetaRecipe recipe) {
return recipe.getStack().getDisplayName(); return recipe.getStack().getDisplayName();
} }
} }

View file

@ -6,13 +6,14 @@ import com.blamejared.mtlib.utils.BaseListRemoval;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class BMRemove extends BaseListRemoval<BlockMetaRecipe> { public class BMRemove extends BaseListRemoval<BlockMetaRecipe> {
public BMRemove(String name, BlockMetaManager recipes, ItemStack input) { public BMRemove(String name, BlockMetaManager recipes, ItemStack input) {
super(name, recipes.getRecipes(), recipes.removeRecipes(input)); super(name, recipes.getRecipes(), recipes.removeRecipes(input));
} }
@Override @Override
protected String getRecipeInfo(BlockMetaRecipe recipe) { protected String getRecipeInfo(BlockMetaRecipe recipe) {
return recipe.getStack().getDisplayName(); return recipe.getStack().getDisplayName();
} }
} }

View file

@ -6,14 +6,14 @@ import com.blamejared.mtlib.utils.BaseListAddition;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
public class BulkAdd<T extends BulkRecipe> extends BaseListAddition<T> { public class BulkAdd<T extends BulkRecipe> extends BaseListAddition<T> {
public BulkAdd(String name, CraftingManagerBulk<T> recipes, T recipe) { public BulkAdd(String name, CraftingManagerBulk<T> recipes, T recipe) {
super(name, recipes.getRecipes(), Lists.newArrayList(recipe)); super(name, recipes.getRecipes(), Lists.newArrayList(recipe));
} }
@Override @Override
protected String getRecipeInfo(T recipe) { protected String getRecipeInfo(T recipe) {
return recipe.getOutput().getDisplayName(); return recipe.getOutput().getDisplayName();
} }
} }

View file

@ -8,14 +8,14 @@ import net.minecraft.item.ItemStack;
public class BulkRemove<T extends BulkRecipe> extends BaseListRemoval<T> { public class BulkRemove<T extends BulkRecipe> extends BaseListRemoval<T> {
public BulkRemove(String name, CraftingManagerBulk<T> recipes, ItemStack output, ItemStack secondary, Object... inputs) { public BulkRemove(String name, CraftingManagerBulk<T> recipes, ItemStack output, ItemStack secondary, Object... inputs) {
super(name, recipes.getRecipes(), recipes.findRecipeForRemoval(output, secondary, inputs)); super(name, recipes.getRecipes(), recipes.findRecipeForRemoval(output, secondary, inputs));
} }
@Override @Override
protected String getRecipeInfo(BulkRecipe recipe) { protected String getRecipeInfo(BulkRecipe recipe) {
return recipe.getOutput().getDisplayName(); return recipe.getOutput().getDisplayName();
} }
} }