BWM Integration Update (#627)
* - Adds Bellows support - Adds HCFurnace support - Adds Filtered Hopper support - Readds removal by input for block-based recipes - Fixes busted Turntable removal by adding a removal method that takes the output blockstate - Succes's'fully - Updates test script * - Exposes BlockDrop ingredients for Block Recipes * - Yeah uhhhh properly implements recipe info * - Copy back test script - Move build method annotation to the superclass - Make builder method return itself
This commit is contained in:
parent
f9d0fa11aa
commit
5b40803ed5
17 changed files with 518 additions and 24 deletions
|
@ -76,7 +76,7 @@ dependencies {
|
|||
deobfCompile("cofh:ThermalExpansion:1.12.2-5.3.12.17:deobf") {
|
||||
exclude group: 'mezz.jei'
|
||||
}
|
||||
deobfCompile("betterwithmods:BetterWithMods:1.12-2.1.+") {
|
||||
deobfCompile("betterwithmods:BetterWithMods:1.12-2.1.11-491") {
|
||||
exclude group: 'mezz.jei'
|
||||
}
|
||||
deobfCompile("de.ellpeck.actuallyadditions:ActuallyAdditions:1.12.1-r121") {
|
||||
|
|
|
@ -45,7 +45,12 @@ public class Anvil {
|
|||
public static void removeShapeless(IItemStack output, @Optional IIngredient[] ingredients) {
|
||||
ModTweaker.LATE_REMOVALS.add(new RemoveShapeless(output, ingredients));
|
||||
}
|
||||
|
||||
|
||||
@ZenMethod
|
||||
public static void removeAll() {
|
||||
ModTweaker.LATE_REMOVALS.add(new RemoveAll());
|
||||
}
|
||||
|
||||
public static class AddShaped extends BaseAction {
|
||||
|
||||
private final IItemStack output;
|
||||
|
@ -190,4 +195,21 @@ public class Anvil {
|
|||
return output.getDisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
public static class RemoveAll extends BaseAction {
|
||||
|
||||
protected RemoveAll() {
|
||||
super("Remove All Anvil");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
AnvilCraftingManager.ANVIL_CRAFTING.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo() {
|
||||
return "all";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package com.blamejared.compat.betterwithmods;
|
||||
|
||||
import betterwithmods.common.registry.BellowsManager;
|
||||
import betterwithmods.module.hardcore.world.HCBuoy;
|
||||
import betterwithmods.util.item.Stack;
|
||||
import betterwithmods.util.item.StackMap;
|
||||
import com.blamejared.ModTweaker;
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.utils.BaseMapAddition;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.betterwithmods.Bellows")
|
||||
@ModOnly("betterwithmods")
|
||||
@ZenRegister
|
||||
public class Bellows {
|
||||
|
||||
@ZenMethod
|
||||
public static void set(IItemStack stack, float value) {
|
||||
StackMap<Float> map = new StackMap<>(1.0f);
|
||||
map.put(new Stack(InputHelper.toStack(stack)), value);
|
||||
ModTweaker.LATE_ADDITIONS.add(new Set(map));
|
||||
}
|
||||
|
||||
public static class Set extends BaseMapAddition<Stack, Float> {
|
||||
|
||||
protected Set(StackMap<Float> map) {
|
||||
super("Set Bellows Item Weight", BellowsManager.bellowing, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Map.Entry<Stack, Float> recipe) {
|
||||
return recipe.getKey().toString() + " -> " + recipe.getValue();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ public class Buoyancy {
|
|||
|
||||
@ZenMethod
|
||||
public static void set(IItemStack stack, float value) {
|
||||
StackMap<Float> map = new StackMap(1.0);
|
||||
StackMap<Float> map = new StackMap<>(1.0f);
|
||||
map.put(new Stack(InputHelper.toStack(stack)), value);
|
||||
ModTweaker.LATE_ADDITIONS.add(new Set(map));
|
||||
}
|
||||
|
@ -36,6 +36,5 @@ public class Buoyancy {
|
|||
protected String getRecipeInfo(Map.Entry<Stack, Float> recipe) {
|
||||
return recipe.getKey().toString() + " -> " + recipe.getValue();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
276
src/main/java/com/blamejared/compat/betterwithmods/Hopper.java
Normal file
276
src/main/java/com/blamejared/compat/betterwithmods/Hopper.java
Normal file
|
@ -0,0 +1,276 @@
|
|||
package com.blamejared.compat.betterwithmods;
|
||||
|
||||
import betterwithmods.api.tile.IHopperFilter;
|
||||
import betterwithmods.common.BWRegistry;
|
||||
import betterwithmods.common.registry.HopperFilter;
|
||||
import betterwithmods.common.registry.HopperInteractions;
|
||||
import betterwithmods.module.gameplay.HopperRecipes;
|
||||
import com.blamejared.ModTweaker;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseAction;
|
||||
import com.google.common.collect.Lists;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ZenClass("mods.betterwithmods.FilteredHopper")
|
||||
@ModOnly("betterwithmods")
|
||||
@ZenRegister
|
||||
public class Hopper {
|
||||
@ZenMethod
|
||||
public static void addFilter(String name, IIngredient filter) {
|
||||
ModTweaker.LATE_ADDITIONS.add(new AddFilter(name,CraftTweakerMC.getIngredient(filter)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addFilteredItem(String name, IIngredient item) {
|
||||
addFilteredItem(name, new IIngredient[]{item});
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addFilteredItem(String name, IIngredient[] items) {
|
||||
ModTweaker.LATE_ADDITIONS.add(new AddFilterItem(name,Arrays.stream(items).map(CraftTweakerMC::getIngredient).collect(Collectors.toList())));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addFilterRecipe(String name, IIngredient input, IItemStack[] outputs, IItemStack[] secondary) {
|
||||
ModTweaker.LATE_ADDITIONS.add(new AddHopperRecipe(name,
|
||||
CraftTweakerMC.getIngredient(input),
|
||||
Lists.newArrayList(CraftTweakerMC.getItemStacks(outputs)),
|
||||
Lists.newArrayList(CraftTweakerMC.getItemStacks(secondary))));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void addSoulUrnRecipe(IIngredient input, IItemStack[] outputs, IItemStack[] secondary) {
|
||||
ModTweaker.LATE_ADDITIONS.add(new AddSoulUrnRecipe(CraftTweakerMC.getIngredient(input),
|
||||
Lists.newArrayList(CraftTweakerMC.getItemStacks(outputs)),
|
||||
Lists.newArrayList(CraftTweakerMC.getItemStacks(secondary))));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void clearFilter(String name) {
|
||||
ModTweaker.LATE_REMOVALS.add(new ClearFilter(name));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack[] outputs, IItemStack[] secondary) {
|
||||
ModTweaker.LATE_REMOVALS.add(new RemoveHopperRecipe(Lists.newArrayList(CraftTweakerMC.getItemStacks(outputs)),
|
||||
Lists.newArrayList(CraftTweakerMC.getItemStacks(secondary))));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipeByInput(IItemStack input) {
|
||||
ModTweaker.LATE_REMOVALS.add(new RemoveHopperRecipeByInput(CraftTweakerMC.getItemStack(input)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeAll() {
|
||||
ModTweaker.LATE_REMOVALS.add(new RemoveAll());
|
||||
}
|
||||
|
||||
|
||||
public static class AddFilter extends BaseAction {
|
||||
Ingredient ingredient;
|
||||
String filterName;
|
||||
|
||||
protected AddFilter(String filterName, Ingredient ingredient) {
|
||||
super("Filtered Hopper");
|
||||
this.filterName = filterName;
|
||||
this.ingredient = ingredient;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo() {
|
||||
return filterName+" ("+Arrays.toString(ingredient.getMatchingStacks())+")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
if(BWRegistry.HOPPER_FILTERS.getFilter(filterName) != HopperFilter.NONE)
|
||||
LogHelper.logWarning(String.format("Hopper Filter %s couldn't be added: Filter already exists", getRecipeInfo()));
|
||||
else {
|
||||
BWRegistry.HOPPER_FILTERS.addFilter(new HopperFilter(filterName, ingredient, Lists.newArrayList()));
|
||||
LogHelper.logInfo(String.format("Successfully added Hopper Filter %s", getRecipeInfo()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class ClearFilter extends BaseAction {
|
||||
String filterName;
|
||||
|
||||
protected ClearFilter(String filterName) {
|
||||
super("Filtered Hopper");
|
||||
this.filterName = filterName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo() {
|
||||
return filterName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
IHopperFilter filter = BWRegistry.HOPPER_FILTERS.getFilter(filterName);
|
||||
if(filter == HopperFilter.NONE || !(filter instanceof HopperFilter))
|
||||
LogHelper.logWarning(String.format("Hopper Filter %s couldn't be cleared: Filter doesn't exist or is not a modifiable filter.", getRecipeInfo()));
|
||||
else {
|
||||
((HopperFilter) filter).getFiltered().clear();
|
||||
LogHelper.logInfo(String.format("Successfully cleared Hopper Filter %s", getRecipeInfo()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class AddFilterItem extends BaseAction {
|
||||
String filterName;
|
||||
List<Ingredient> items;
|
||||
|
||||
protected AddFilterItem(String filterName, List<Ingredient> item) {
|
||||
super("Filtered Hopper");
|
||||
this.filterName = filterName;
|
||||
this.items = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo() {
|
||||
return String.format("%s - %s", items.stream().map(ingredient -> Arrays.toString(ingredient.getMatchingStacks())).collect(Collectors.joining(",")), filterName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
IHopperFilter filter = BWRegistry.HOPPER_FILTERS.getFilter(filterName);
|
||||
if(filter == HopperFilter.NONE || !(filter instanceof HopperFilter))
|
||||
LogHelper.logWarning(String.format("Filtered items %s couldn't be added: Filter doesn't exist or is not a modifiable filter.", getRecipeInfo()));
|
||||
else {
|
||||
((HopperFilter) filter).getFiltered().addAll(items);
|
||||
LogHelper.logInfo(String.format("Successfully added items %s", getRecipeInfo()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class AddHopperRecipe extends BaseAction {
|
||||
String filterName;
|
||||
Ingredient input;
|
||||
List<ItemStack> outputs;
|
||||
List<ItemStack> secondary;
|
||||
|
||||
public AddHopperRecipe(String filterName, Ingredient input, List<ItemStack> outputs, List<ItemStack> secondary) {
|
||||
super("Filtered Hopper");
|
||||
this.filterName = filterName;
|
||||
this.input = input;
|
||||
this.outputs = outputs;
|
||||
this.secondary = secondary;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo() {
|
||||
return String.format("%s -> %s,%s in %s",
|
||||
Arrays.toString(input.getMatchingStacks()),
|
||||
outputs.stream().map(ItemStack::getDisplayName).collect(Collectors.joining(",")),
|
||||
secondary.stream().map(ItemStack::getDisplayName).collect(Collectors.joining(",")),
|
||||
filterName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
HopperInteractions.addHopperRecipe(new HopperInteractions.HopperRecipe(filterName,input,outputs,secondary));
|
||||
}
|
||||
}
|
||||
|
||||
public static class AddSoulUrnRecipe extends BaseAction {
|
||||
Ingredient input;
|
||||
List<ItemStack> outputs;
|
||||
List<ItemStack> secondary;
|
||||
|
||||
public AddSoulUrnRecipe(Ingredient input, List<ItemStack> outputs, List<ItemStack> secondary) {
|
||||
super("Filtered Hopper");
|
||||
this.input = input;
|
||||
this.outputs = outputs;
|
||||
this.secondary = secondary;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo() {
|
||||
return String.format("%s -> %s,%s (soul urn)",
|
||||
Arrays.toString(input.getMatchingStacks()),
|
||||
outputs.stream().map(ItemStack::getDisplayName).collect(Collectors.joining(",")),
|
||||
secondary.stream().map(ItemStack::getDisplayName).collect(Collectors.joining(",")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
HopperInteractions.addHopperRecipe(new HopperInteractions.SoulUrnRecipe(input,outputs,secondary));
|
||||
}
|
||||
}
|
||||
|
||||
public static class RemoveHopperRecipe extends BaseAction {
|
||||
List<ItemStack> outputs;
|
||||
List<ItemStack> secondary;
|
||||
|
||||
public RemoveHopperRecipe(List<ItemStack> outputs, List<ItemStack> secondary) {
|
||||
super("Filtered Hopper");
|
||||
this.outputs = outputs;
|
||||
this.secondary = secondary;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo() {
|
||||
return String.format("%s,%s",
|
||||
outputs.stream().map(ItemStack::getDisplayName).collect(Collectors.joining(",")),
|
||||
secondary.stream().map(ItemStack::getDisplayName).collect(Collectors.joining(",")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
if (!HopperInteractions.remove(outputs,secondary)) {
|
||||
LogHelper.logWarning(String.format("No recipes were removed for outputs %s", getRecipeInfo()));
|
||||
} else {
|
||||
LogHelper.logInfo(String.format("Successfully removed all recipes for %s", getRecipeInfo()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class RemoveHopperRecipeByInput extends BaseAction {
|
||||
ItemStack input;
|
||||
|
||||
public RemoveHopperRecipeByInput(ItemStack input) {
|
||||
super("Filtered Hopper");
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo() {
|
||||
return input.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
if (!HopperInteractions.removeByInput(input)) {
|
||||
LogHelper.logWarning(String.format("No recipes were removed for input %s", getRecipeInfo()));
|
||||
} else {
|
||||
LogHelper.logInfo(String.format("Successfully removed all recipes for %s", getRecipeInfo()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class RemoveAll extends BaseAction {
|
||||
public RemoveAll() {
|
||||
super("Filtered Hopper");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
HopperInteractions.RECIPES.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -44,10 +44,9 @@ public class Kiln {
|
|||
add(input, output);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void remove(IItemStack input) {
|
||||
LogHelper.logError("This operation has been removed, use mods.betterwithmods.Kiln.remove(IItemStack[] outputs)");
|
||||
INSTANCE.removeRecipe(input);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
|
|
45
src/main/java/com/blamejared/compat/betterwithmods/Misc.java
Normal file
45
src/main/java/com/blamejared/compat/betterwithmods/Misc.java
Normal file
|
@ -0,0 +1,45 @@
|
|||
package com.blamejared.compat.betterwithmods;
|
||||
|
||||
import betterwithmods.common.registry.BellowsManager;
|
||||
import betterwithmods.module.hardcore.crafting.HCFurnace;
|
||||
import betterwithmods.util.item.Stack;
|
||||
import betterwithmods.util.item.StackMap;
|
||||
import com.blamejared.ModTweaker;
|
||||
import com.blamejared.mtlib.utils.BaseMapAddition;
|
||||
import com.google.common.collect.Maps;
|
||||
import crafttweaker.annotations.ModOnly;
|
||||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import crafttweaker.mc1120.CraftTweaker;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ZenClass("mods.betterwithmods.Misc")
|
||||
@ModOnly("betterwithmods")
|
||||
@ZenRegister
|
||||
public class Misc {
|
||||
@ZenMethod
|
||||
public static void setFurnaceSmeltingTime(IIngredient ingredient, int time) {
|
||||
HashMap<Ingredient,Integer> map = new HashMap<>();
|
||||
map.put(CraftTweakerMC.getIngredient(ingredient),time);
|
||||
ModTweaker.LATE_ADDITIONS.add(new SetSmeltingTime(map));
|
||||
}
|
||||
|
||||
public static class SetSmeltingTime extends BaseMapAddition<Ingredient,Integer> {
|
||||
|
||||
protected SetSmeltingTime(Map<Ingredient,Integer> map) {
|
||||
super("Set HCFurnace Smelting Time", HCFurnace.FURNACE_TIMINGS, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(Map.Entry<Ingredient,Integer> recipe) {
|
||||
return Arrays.toString(recipe.getKey().getMatchingStacks()) + " -> " + recipe.getValue(); //Fortunately mojang is adding a toString method to Ingredient
|
||||
}
|
||||
}
|
||||
}
|
|
@ -38,10 +38,9 @@ public class Saw {
|
|||
add(input, output);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ZenMethod
|
||||
public static void remove(IItemStack input) {
|
||||
LogHelper.logError("This operation has been removed, use mods.betterwithmods.Saw.remove(IItemStack[] outputs)");
|
||||
INSTANCE.removeRecipe(input);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.blamejared.compat.betterwithmods;
|
||||
|
||||
import betterwithmods.common.BWMRecipes;
|
||||
import betterwithmods.common.BWRegistry;
|
||||
import com.blamejared.compat.betterwithmods.base.blockrecipes.TurntableBuilder;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
|
@ -7,6 +8,7 @@ import crafttweaker.annotations.ModOnly;
|
|||
import crafttweaker.annotations.ZenRegister;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
|
@ -33,15 +35,14 @@ public class Turntable {
|
|||
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.Turntable.remove(IItemStack[] outputs)");
|
||||
INSTANCE.removeRecipe(input);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(IItemStack[] outputs) {
|
||||
INSTANCE.removeRecipe(outputs);
|
||||
public static void removeByProductState(IItemStack output) {
|
||||
INSTANCE.removeRecipe(BWMRecipes.getStateFromStack(CraftTweakerMC.getItemStack(output)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.blamejared.compat.betterwithmods.base.blockrecipes;
|
||||
|
||||
import betterwithmods.common.registry.block.managers.CraftingManagerBlock;
|
||||
import betterwithmods.common.registry.block.recipe.BlockDropIngredient;
|
||||
import betterwithmods.common.registry.block.recipe.BlockIngredient;
|
||||
import betterwithmods.common.registry.block.recipe.BlockRecipe;
|
||||
import com.blamejared.ModTweaker;
|
||||
|
@ -20,7 +21,7 @@ public abstract class BlockRecipeBuilder<T extends BlockRecipe> {
|
|||
protected BlockIngredient input;
|
||||
protected List<ItemStack> outputs;
|
||||
private Supplier<CraftingManagerBlock<T>> registry;
|
||||
private String name;
|
||||
protected String name;
|
||||
|
||||
public BlockRecipeBuilder(Supplier<CraftingManagerBlock<T>> registry, String name) {
|
||||
this.registry = registry;
|
||||
|
@ -31,17 +32,34 @@ public abstract class BlockRecipeBuilder<T extends BlockRecipe> {
|
|||
ModTweaker.LATE_ADDITIONS.add(new BlockRecipeAdd<>(name, registry.get(), recipe));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public abstract void build();
|
||||
|
||||
public void removeRecipe(IItemStack[] output) {
|
||||
ModTweaker.LATE_REMOVALS.add(new BlockRecipeRemove<>(name, registry.get(), output));
|
||||
}
|
||||
|
||||
public void removeRecipe(IItemStack input) {
|
||||
ModTweaker.LATE_REMOVALS.add(new BlockRecipeRemoveInput<>(name, registry.get(), input));
|
||||
}
|
||||
|
||||
public void _buildRecipe(IIngredient input, IItemStack[] outputs) {
|
||||
this.input = new BlockIngredient(CraftTweakerMC.getIngredient(input));
|
||||
this.outputs = InputHelper.toNonNullList(CraftTweakerMC.getItemStacks(outputs));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public BlockRecipeBuilder setInputBlockDrop(IItemStack input) {
|
||||
this.input = new BlockDropIngredient(CraftTweakerMC.getItemStack(input));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public BlockRecipeBuilder setInputBlockDrop(IItemStack[] inputs) {
|
||||
this.input = new BlockDropIngredient(CraftTweakerMC.getItemStacks(inputs));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public void removeAll() {
|
||||
ModTweaker.LATE_REMOVALS.add(new RemoveAll<>(name, registry.get().getRecipes()));
|
||||
|
|
|
@ -30,13 +30,14 @@ public class BlockRecipeRemove<T extends BlockRecipe> extends BaseAction {
|
|||
@Override
|
||||
public void apply() {
|
||||
if (!manager.remove(outputs)) {
|
||||
LogHelper.logWarning(String.format("No recipes were removed for output %s", getRecipeInfo(outputs)));
|
||||
LogHelper.logWarning(String.format("No recipes were removed for output %s", getRecipeInfo()));
|
||||
} else {
|
||||
LogHelper.logInfo(String.format("Succesfully removed all recipes for %s", getRecipeInfo(outputs)));
|
||||
LogHelper.logInfo(String.format("Successfully removed all recipes for %s", getRecipeInfo()));
|
||||
}
|
||||
}
|
||||
|
||||
private String getRecipeInfo(List<ItemStack> outputs) {
|
||||
@Override
|
||||
protected String getRecipeInfo() {
|
||||
return String.format("%s - %s", name, outputs.stream().map(ItemStack::getDisplayName).collect(Collectors.joining(",")));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package com.blamejared.compat.betterwithmods.base.blockrecipes;
|
||||
|
||||
import betterwithmods.common.registry.block.managers.CraftingManagerBlock;
|
||||
import betterwithmods.common.registry.block.recipe.BlockRecipe;
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseAction;
|
||||
import com.google.common.collect.Lists;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class BlockRecipeRemoveInput<T extends BlockRecipe> extends BaseAction {
|
||||
|
||||
private final ItemStack input;
|
||||
private CraftingManagerBlock<T> manager;
|
||||
|
||||
public BlockRecipeRemoveInput(String name, CraftingManagerBlock<T> manager, IItemStack input) {
|
||||
this(name, manager, InputHelper.toStack(input));
|
||||
}
|
||||
|
||||
private BlockRecipeRemoveInput(String name, CraftingManagerBlock<T> manager, ItemStack input) {
|
||||
super(name);
|
||||
this.manager = manager;
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
if (!manager.removeByInput(input)) {
|
||||
LogHelper.logWarning(String.format("No recipes were removed for input %s", getRecipeInfo()));
|
||||
} else {
|
||||
LogHelper.logInfo(String.format("Successfully removed all recipes with %s as input", getRecipeInfo()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo() {
|
||||
return String.format("%s - %s", name, input.getDisplayName());
|
||||
}
|
||||
}
|
|
@ -34,7 +34,6 @@ public class KilnBuilder extends BlockRecipeBuilder<KilnRecipe> {
|
|||
return this;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@Override
|
||||
public void build() {
|
||||
addRecipe(new KilnRecipe(input, outputs, heat).setIgnoreHeat(ignoreHeat));
|
||||
|
|
|
@ -20,7 +20,6 @@ public class SawBuilder extends BlockRecipeBuilder<SawRecipe> {
|
|||
return this;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@Override
|
||||
public void build() {
|
||||
addRecipe(new SawRecipe(input,outputs));
|
||||
|
|
|
@ -1,15 +1,22 @@
|
|||
package com.blamejared.compat.betterwithmods.base.blockrecipes;
|
||||
|
||||
import betterwithmods.common.BWMRecipes;
|
||||
import betterwithmods.common.BWRegistry;
|
||||
import betterwithmods.common.registry.block.managers.CraftingManagerBlock;
|
||||
import betterwithmods.common.registry.block.recipe.BlockRecipe;
|
||||
import betterwithmods.common.registry.block.recipe.TurntableRecipe;
|
||||
import com.blamejared.ModTweaker;
|
||||
import com.blamejared.mtlib.helpers.InputHelper;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseAction;
|
||||
import crafttweaker.api.item.IIngredient;
|
||||
import crafttweaker.api.item.IItemStack;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
@ -45,9 +52,35 @@ public class TurntableBuilder extends BlockRecipeBuilder<TurntableRecipe> {
|
|||
return this;
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
@Override
|
||||
public void build() {
|
||||
addRecipe(new TurntableRecipe(input, outputs, productState, rotations));
|
||||
}
|
||||
|
||||
public void removeRecipe(IBlockState productState) {
|
||||
ModTweaker.LATE_REMOVALS.add(new TurntableRemoveProduct(name, productState));
|
||||
}
|
||||
|
||||
public class TurntableRemoveProduct extends BaseAction {
|
||||
|
||||
private final IBlockState productState;
|
||||
|
||||
private TurntableRemoveProduct(String name, IBlockState productState) {
|
||||
super(name);
|
||||
this.productState = productState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
if (!BWRegistry.TURNTABLE.remove(productState)) {
|
||||
LogHelper.logWarning(String.format("No recipes were removed for input %s", getRecipeInfo(productState)));
|
||||
} else {
|
||||
LogHelper.logInfo(String.format("Succesfully removed all recipes with %s as input", getRecipeInfo(productState)));
|
||||
}
|
||||
}
|
||||
|
||||
private String getRecipeInfo(IBlockState productState) {
|
||||
return String.format("%s - %s", name, productState.getBlock().toString()+"@"+productState.getBlock().getMetaFromState(productState));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,13 +33,14 @@ public class BulkRecipeRemove<T extends BulkRecipe> extends BaseAction {
|
|||
@Override
|
||||
public void apply() {
|
||||
if (!manager.remove(outputs)) {
|
||||
LogHelper.logWarning(String.format("No recipes were removed for output %s", getRecipeInfo(outputs)));
|
||||
LogHelper.logWarning(String.format("No recipes were removed for output %s", getRecipeInfo()));
|
||||
} else {
|
||||
LogHelper.logInfo(String.format("Succesfully removed all recipes for %s", getRecipeInfo(outputs)));
|
||||
LogHelper.logInfo(String.format("Successfully removed all recipes for %s", getRecipeInfo()));
|
||||
}
|
||||
}
|
||||
|
||||
private String getRecipeInfo(List<ItemStack> outputs) {
|
||||
@Override
|
||||
protected String getRecipeInfo() {
|
||||
return String.format("%s - %s", name, outputs.stream().map(ItemStack::getDisplayName).collect(Collectors.joining(",")));
|
||||
}
|
||||
}
|
|
@ -62,12 +62,17 @@ mods.betterwithmods.Mill.builder()
|
|||
|
||||
//Saw
|
||||
|
||||
mods.betterwithmods.Saw.remove(<minecraft:vine>);
|
||||
mods.betterwithmods.Saw.builder()
|
||||
.buildRecipe(<minecraft:fence>, [<minecraft:stick>*6])
|
||||
.build();
|
||||
mods.betterwithmods.Saw.builder()
|
||||
.buildRecipe(<minecraft:torch>, [<minecraft:stick>])
|
||||
.setInputBlockDrop(<minecraft:torch>)
|
||||
.build();
|
||||
|
||||
//Turntable
|
||||
mods.betterwithmods.Turntable.removeAll();
|
||||
mods.betterwithmods.Turntable.remove(<betterwithmods:unfired_pottery:3>);
|
||||
mods.betterwithmods.Turntable.add(<minecraft:grass>, <minecraft:dirt>, [<minecraft:wheat_seeds>]);
|
||||
mods.betterwithmods.Turntable.add(<minecraft:gravel>, [<minecraft:flint>]);
|
||||
|
||||
|
@ -80,4 +85,17 @@ 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>)]]);
|
||||
|
||||
//Hopper
|
||||
mods.betterwithmods.FilteredHopper.addFilter("dumb",<minecraft:planks>);
|
||||
mods.betterwithmods.FilteredHopper.addFilteredItem("dumb",<minecraft:dirt>);
|
||||
mods.betterwithmods.FilteredHopper.addFilteredItem("dumb",<minecraft:flint>);
|
||||
mods.betterwithmods.FilteredHopper.addFilterRecipe("dumb",<minecraft:grass>,[<minecraft:flint>],[<minecraft:diamond>*9]);
|
||||
mods.betterwithmods.FilteredHopper.addSoulUrnRecipe(<minecraft:stone>,[],[<minecraft:diamond>*9]);
|
||||
mods.betterwithmods.FilteredHopper.clearFilter("betterwithmods:wicker");
|
||||
mods.betterwithmods.FilteredHopper.removeRecipe([<minecraft:sand>,<minecraft:sand:1>],[<minecraft:flint>]);
|
||||
mods.betterwithmods.FilteredHopper.removeRecipeByInput(<minecraft:sand>);
|
||||
|
||||
//Misc
|
||||
mods.betterwithmods.Misc.setFurnaceSmeltingTime(<minecraft:potato>,100000);
|
Loading…
Reference in a new issue