Improve logging for recipe removal. Fix removeAll functions. Fix addition of Turntable recipes (#626)
This commit is contained in:
parent
ac3423961e
commit
f9d0fa11aa
12 changed files with 67 additions and 31 deletions
|
@ -18,27 +18,23 @@ import java.util.function.Supplier;
|
|||
@ZenClass("mods.betterwithmods.Cauldron")
|
||||
@ModOnly("betterwithmods")
|
||||
@ZenRegister
|
||||
public class Cauldron extends CookingPotBuilder {
|
||||
public class Cauldron {
|
||||
|
||||
public static Cauldron INSTANCE = new Cauldron(() -> BWRegistry.CAULDRON, "Cauldron");
|
||||
|
||||
protected Cauldron(Supplier<CraftingManagerBulk<CookingPotRecipe>> registry, String name) {
|
||||
super(registry, name);
|
||||
}
|
||||
public static CookingPotBuilder INSTANCE = new CookingPotBuilder(() -> BWRegistry.CAULDRON, "Cauldron");
|
||||
|
||||
@ZenMethod
|
||||
public static Cauldron builder() {
|
||||
public static CookingPotBuilder builder() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addStoked(IIngredient[] inputs, IItemStack[] outputs) {
|
||||
INSTANCE.buildRecipe(inputs, outputs).setHeat(STOKED).build();
|
||||
INSTANCE.buildRecipe(inputs, outputs).setHeat(CookingPotBuilder.STOKED).build();
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addUnstoked(IIngredient[] inputs, IItemStack[] outputs) {
|
||||
INSTANCE.buildRecipe(inputs, outputs).setHeat(UNSTOKED).build();
|
||||
INSTANCE.buildRecipe(inputs, outputs).setHeat(CookingPotBuilder.UNSTOKED).build();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -57,4 +53,9 @@ public class Cauldron extends CookingPotBuilder {
|
|||
public static void remove(IItemStack[] output) {
|
||||
INSTANCE.removeRecipe(output);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeAll() {
|
||||
builder().removeAll();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,26 +18,22 @@ import java.util.function.Supplier;
|
|||
@ZenClass("mods.betterwithmods.Crucible")
|
||||
@ModOnly("betterwithmods")
|
||||
@ZenRegister
|
||||
public class Crucible extends CookingPotBuilder {
|
||||
public static Crucible INSTANCE = new Crucible(() -> BWRegistry.CRUCIBLE, "Crucible");
|
||||
|
||||
private Crucible(Supplier<CraftingManagerBulk<CookingPotRecipe>> registry, String name) {
|
||||
super(registry, name);
|
||||
}
|
||||
public class Crucible {
|
||||
public static CookingPotBuilder INSTANCE = new CookingPotBuilder(() -> BWRegistry.CRUCIBLE, "Crucible");
|
||||
|
||||
@ZenMethod
|
||||
public static Crucible builder() {
|
||||
public static CookingPotBuilder builder() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addStoked(IIngredient[] inputs, IItemStack[] outputs) {
|
||||
INSTANCE.buildRecipe(inputs, outputs).setHeat(STOKED).build();
|
||||
INSTANCE.buildRecipe(inputs, outputs).setHeat(CookingPotBuilder.STOKED).build();
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addUnstoked(IIngredient[] inputs, IItemStack[] outputs) {
|
||||
INSTANCE.buildRecipe(inputs, outputs).setHeat(UNSTOKED).build();
|
||||
INSTANCE.buildRecipe(inputs, outputs).setHeat(CookingPotBuilder.UNSTOKED).build();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -56,4 +52,9 @@ public class Crucible extends CookingPotBuilder {
|
|||
public static void remove(IItemStack[] output) {
|
||||
INSTANCE.removeRecipe(output);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeAll() {
|
||||
builder().removeAll();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class Kiln {
|
|||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void remove(IItemStack input) {
|
||||
LogHelper.logError("This operation has been removed, use mods.betterwithmods.Saw.remove(IItemStack[] outputs)");
|
||||
LogHelper.logError("This operation has been removed, use mods.betterwithmods.Kiln.remove(IItemStack[] outputs)");
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
|
@ -55,6 +55,11 @@ public class Kiln {
|
|||
INSTANCE.removeRecipe(outputs);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeAll() {
|
||||
builder().removeAll();
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void registerBlock(IItemStack block) {
|
||||
ModTweaker.LATE_ADDITIONS.add(new KilnBlock(BWMRecipes.getStateFromStack(InputHelper.toStack(block))));
|
||||
|
|
|
@ -48,4 +48,10 @@ public class Mill {
|
|||
public static void remove(IItemStack[] output) {
|
||||
INSTANCE.removeRecipe(output);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeAll() {
|
||||
builder().removeAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,4 +49,8 @@ public class Saw {
|
|||
INSTANCE.removeRecipe(outputs);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeAll() {
|
||||
builder().removeAll();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,18 +25,18 @@ public class Turntable {
|
|||
|
||||
@ZenMethod
|
||||
public static void add(IIngredient inputBlock, IItemStack[] additionalOutput) {
|
||||
builder().buildRecipe(inputBlock, additionalOutput);
|
||||
builder().buildRecipe(inputBlock, additionalOutput).build();
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void add(IIngredient inputBlock, IItemStack productState, IItemStack[] additionalOutput) {
|
||||
builder().buildRecipe(inputBlock, additionalOutput).setProductState(productState);
|
||||
builder().buildRecipe(inputBlock, additionalOutput).setProductState(productState).build();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void remove(IItemStack input) {
|
||||
LogHelper.logError("This operation has been removed, use mods.betterwithmods.Saw.remove(IItemStack[] outputs)");
|
||||
LogHelper.logError("This operation has been removed, use mods.betterwithmods.Turntable.remove(IItemStack[] outputs)");
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
|
@ -44,4 +44,8 @@ public class Turntable {
|
|||
INSTANCE.removeRecipe(outputs);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeAll() {
|
||||
builder().removeAll();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,13 @@ public class RemoveAll<T> extends BaseAction {
|
|||
this.list = list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo() {
|
||||
return String.format("Removing all recipes for %s", name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,11 +30,13 @@ public class BlockRecipeRemove<T extends BlockRecipe> extends BaseAction {
|
|||
@Override
|
||||
public void apply() {
|
||||
if (!manager.remove(outputs)) {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe for %s", name, getRecipeInfo(outputs)));
|
||||
LogHelper.logWarning(String.format("No recipes were removed for output %s", getRecipeInfo(outputs)));
|
||||
} else {
|
||||
LogHelper.logInfo(String.format("Succesfully removed all recipes for %s", getRecipeInfo(outputs)));
|
||||
}
|
||||
}
|
||||
|
||||
private String getRecipeInfo(List<ItemStack> outputs) {
|
||||
return outputs.stream().map(ItemStack::getDisplayName).collect(Collectors.joining(","));
|
||||
return String.format("%s - %s", name, outputs.stream().map(ItemStack::getDisplayName).collect(Collectors.joining(",")));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,4 +25,10 @@ public class SawBuilder extends BlockRecipeBuilder<SawRecipe> {
|
|||
public void build() {
|
||||
addRecipe(new SawRecipe(input,outputs));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@Override
|
||||
public void removeAll() {
|
||||
super.removeAll();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,11 +33,13 @@ public class BulkRecipeRemove<T extends BulkRecipe> extends BaseAction {
|
|||
@Override
|
||||
public void apply() {
|
||||
if (!manager.remove(outputs)) {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe for %s", name, getRecipeInfo(outputs)));
|
||||
LogHelper.logWarning(String.format("No recipes were removed for output %s", getRecipeInfo(outputs)));
|
||||
} else {
|
||||
LogHelper.logInfo(String.format("Succesfully removed all recipes for %s", getRecipeInfo(outputs)));
|
||||
}
|
||||
}
|
||||
|
||||
private String getRecipeInfo(List<ItemStack> outputs) {
|
||||
return outputs.stream().map(ItemStack::getDisplayName).collect(Collectors.joining(","));
|
||||
return String.format("%s - %s", name, outputs.stream().map(ItemStack::getDisplayName).collect(Collectors.joining(",")));
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ public class CookingPotBuilder extends BulkRecipeBuilder<CookingPotRecipe> {
|
|||
private int heat = 1;
|
||||
private boolean ignoreHeat = false;
|
||||
|
||||
protected CookingPotBuilder(Supplier<CraftingManagerBulk<CookingPotRecipe>> registry, String name) {
|
||||
public CookingPotBuilder(Supplier<CraftingManagerBulk<CookingPotRecipe>> registry, String name) {
|
||||
super(registry, name);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ mods.betterwithmods.Anvil.addShaped(<minecraft:dirt>, [
|
|||
|
||||
//Cauldron
|
||||
|
||||
mods.betterwithmods.Cauldron.removeAll();
|
||||
|
||||
mods.betterwithmods.Cauldron.builder()
|
||||
.buildRecipe([<ore:stone>], [<minecraft:dirt>])
|
||||
.setHeat(2)
|
||||
|
@ -65,9 +67,8 @@ mods.betterwithmods.Saw.builder()
|
|||
.build();
|
||||
|
||||
//Turntable
|
||||
|
||||
mods.betterwithmods.Turntable.removeAll();
|
||||
mods.betterwithmods.Turntable.add(<minecraft:grass>, <minecraft:dirt>, [<minecraft:wheat_seeds>]);
|
||||
|
||||
mods.betterwithmods.Turntable.add(<minecraft:gravel>, [<minecraft:flint>]);
|
||||
|
||||
|
||||
|
@ -79,4 +80,4 @@ mods.betterwithmods.Kiln.builder()
|
|||
.build();
|
||||
|
||||
//Mini Block
|
||||
recipes.addShaped("siding_test", <minecraft:planks>,[[mods.betterwithmods.MiniBlocks.getMiniBlock("siding", <minecraft:bookshelf>, 1)]]);
|
||||
recipes.addShaped("siding_test", <minecraft:planks>,[[mods.betterwithmods.MiniBlocks.getMiniBlock("siding", <minecraft:bookshelf>, 1)]]);
|
||||
|
|
Loading…
Reference in a new issue