Skip to content

Commit 9c13622

Browse files
authored
add Better With Addons compat (#271)
* create validateStackSize * remove incorrect annotations from BWM recipeBuilder * create toItemStack from IBlockState * add BWA BWE debug * add betterwithaddons mixins * implement BWA content * examples for BWA * remove some unused imports * it shouldnt matter, but check betterwithaddons
1 parent c82e996 commit 9c13622

40 files changed

+1770
-37
lines changed

dependencies.gradle

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ final def mod_dependencies = [
4747
'the-aurorian-352137:4981736' : [project.debug_aurorian],
4848
'avaritia_1_10-261348:3143349' : [project.debug_avaritia],
4949
'atum-2-59621:3116599' : [project.debug_atum],
50-
'bwm-core-294335:2624990' : [project.debug_better_with_mods],
51-
'bwm-suite-246760:3289033' : [project.debug_better_with_mods],
50+
'better-with-addons-268326:2899407' : [project.debug_better_with_addons],
51+
'bwm-core-294335:2624990' : [project.debug_better_with_addons, project.debug_better_with_mods],
52+
'bwm-suite-246760:3289033' : [project.debug_better_with_addons, project.debug_better_with_mods],
5253
'blood-arsenal-228823:2904183' : [project.debug_blood_arsenal],
5354
'blood-magic-224791:2822288' : [project.debug_blood_arsenal, project.debug_blood_magic],
5455
'guide-api-228832:2645992' : [project.debug_blood_arsenal, project.debug_blood_magic, project.debug_woot],
@@ -180,6 +181,11 @@ dependencies {
180181
// runtimeOnly rfg.deobf('curse.maven:angry-pixel-the-betweenlands-mod-243363:4479688')
181182
}
182183

184+
compileOnly rfg.deobf('curse.maven:better-with-everything-896908:5202745')
185+
if (!(project.debug_better_with_addons.toBoolean() || project.debug_better_with_mods.toBoolean()) && project.debug_better_with_everything.toBoolean()) {
186+
runtimeOnly rfg.deobf('curse.maven:better-with-everything-896908:5202745')
187+
}
188+
183189
compileOnly 'com.enderio:endercore:0.5.78'
184190
compileOnly 'crazypants:enderio:5.3.72'
185191
if (project.debug_enderio.toBoolean()) {
Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
2+
// Auto generated groovyscript example file
3+
// MODS_LOADED: betterwithaddons
4+
5+
log.info 'mod \'betterwithaddons\' detected, running script'
6+
7+
// Drying Unit:
8+
// Converts an input item into an output itemstack if placed within the appropriate multiblock. The multiblock is Sandstone
9+
// directly below the Drying Box, 8 Sand around the Drying Box, and a Dead Bush placed on the Sand. Only functions in a
10+
// non-snowy biome with sky access during the day, and functions twice as fast when in a hot biome.
11+
12+
mods.betterwithaddons.drying_box.removeByInput(item('betterwithaddons:japanmat:2'))
13+
mods.betterwithaddons.drying_box.removeByOutput(item('minecraft:sponge'))
14+
// mods.betterwithaddons.drying_box.removeAll()
15+
16+
mods.betterwithaddons.drying_box.recipeBuilder()
17+
.input(item('minecraft:diamond'))
18+
.output(item('minecraft:clay'))
19+
.register()
20+
21+
mods.betterwithaddons.drying_box.recipeBuilder()
22+
.input(item('minecraft:gold_ingot'))
23+
.output(item('minecraft:clay') * 4)
24+
.register()
25+
26+
27+
// Fire Net:
28+
// Converts an input item into any number of output itemstacks if placed within the appropriate multiblock. The multiblock
29+
// is Lava or Fire directly below the Netted Screen, 8 Stone Brick around the Lava or Fire, and 8 Slat Blocks placed around
30+
// the Netted Screen.
31+
32+
mods.betterwithaddons.fire_net.removeByInput(item('betterwithaddons:iron_sand'))
33+
mods.betterwithaddons.fire_net.removeByOutput(item('betterwithaddons:japanmat:12'))
34+
// mods.betterwithaddons.fire_net.removeAll()
35+
36+
mods.betterwithaddons.fire_net.recipeBuilder()
37+
.input(item('minecraft:diamond'))
38+
.output(item('minecraft:clay'))
39+
.register()
40+
41+
mods.betterwithaddons.fire_net.recipeBuilder()
42+
.input(item('minecraft:gold_ingot'))
43+
.output(item('minecraft:clay') * 4, item('minecraft:diamond'), item('minecraft:diamond') * 2)
44+
.register()
45+
46+
47+
// Ancestral Infusion Crafting:
48+
// Converts a custom crafting recipe an output itemstack, consuming Spirits from the Infused Soul Sand placed below the
49+
// Ancestral Infuser if placed within the appropriate multiblock. The multiblock is either Soul Sand or Infused Soul Sand
50+
// placed below the Ancestral Infuser and exclusively air blocks adjacent to the Infuser and Soul Sand blocks.
51+
52+
mods.betterwithaddons.infuser.removeByInput(item('betterwithaddons:japanmat:16'))
53+
mods.betterwithaddons.infuser.removeByOutput(item('betterwithaddons:ya'))
54+
// mods.betterwithaddons.infuser.removeAll()
55+
56+
mods.betterwithaddons.infuser.shapedBuilder()
57+
.output(item('minecraft:stone'))
58+
.matrix('BXX',
59+
'X B')
60+
.key('B', item('minecraft:stone'))
61+
.key('X', item('minecraft:gold_ingot'))
62+
.spirits(1)
63+
.mirrored()
64+
.register()
65+
66+
mods.betterwithaddons.infuser.shapedBuilder()
67+
.output(item('minecraft:diamond') * 32)
68+
.matrix([[item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')],
69+
[item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')],
70+
[item('minecraft:gold_ingot'), item('minecraft:gold_ingot'), item('minecraft:gold_ingot')]])
71+
.spirits(6)
72+
.register()
73+
74+
mods.betterwithaddons.infuser.shapelessBuilder()
75+
.output(item('minecraft:clay') * 8)
76+
.input(item('minecraft:stone'), item('minecraft:stone'), item('minecraft:stone'))
77+
.register()
78+
79+
mods.betterwithaddons.infuser.shapelessBuilder()
80+
.output(item('minecraft:clay') * 32)
81+
.input(item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'))
82+
.spirits(8)
83+
.register()
84+
85+
86+
// Alicio Tree Foods:
87+
// Converts an input item into an amount of food for the tree to gradually consume, eventually summoning a random creature
88+
// nearby.
89+
90+
mods.betterwithaddons.lure_tree.removeByInput(item('minecraft:rotten_flesh'))
91+
// mods.betterwithaddons.lure_tree.removeAll()
92+
93+
mods.betterwithaddons.lure_tree.recipeBuilder()
94+
.input(item('minecraft:diamond'))
95+
.food(1000)
96+
.register()
97+
98+
mods.betterwithaddons.lure_tree.recipeBuilder()
99+
.input(item('minecraft:gold_ingot'))
100+
.food(4)
101+
.register()
102+
103+
104+
mods.betterwithaddons.lure_tree.addBlacklist(entity('minecraft:chicken'))
105+
106+
// Rotting Food:
107+
// Converts an input item into an output itemstack after the given time has passed. Has the ability to customize the
108+
// terminology used to indicate the age.
109+
110+
mods.betterwithaddons.rotting.removeByInput(item('betterwithaddons:food_cooked_rice'))
111+
mods.betterwithaddons.rotting.removeByOutput(item('minecraft:rotten_flesh'))
112+
// mods.betterwithaddons.rotting.removeAll()
113+
114+
mods.betterwithaddons.rotting.recipeBuilder()
115+
.input(item('minecraft:gold_ingot'))
116+
.register()
117+
118+
mods.betterwithaddons.rotting.recipeBuilder()
119+
.input(item('placeholdername:snack'))
120+
.time(100)
121+
.key('groovy_example')
122+
.rotted(item('minecraft:clay') * 4)
123+
.register()
124+
125+
126+
// Sand Net:
127+
// Converts an input item into any number of output itemstacks if placed within the appropriate multiblock. The multiblock
128+
// is a Slat Block directly below the Netted Screen, 8 Water Blocks around the Water, and 8 Slat Blocks placed around the
129+
// Netted Screen.
130+
131+
mods.betterwithaddons.sand_net.removeByInput(item('minecraft:iron_ingot'))
132+
mods.betterwithaddons.sand_net.removeByOutput(item('minecraft:sand'))
133+
mods.betterwithaddons.sand_net.removeByOutput(item('betterwithaddons:iron_sand'))
134+
// mods.betterwithaddons.sand_net.removeAll()
135+
136+
mods.betterwithaddons.sand_net.recipeBuilder()
137+
.input(item('minecraft:diamond'))
138+
.output(item('minecraft:clay'))
139+
.register()
140+
141+
mods.betterwithaddons.sand_net.recipeBuilder()
142+
.input(item('minecraft:diamond'))
143+
.output(item('minecraft:gold_ingot'))
144+
.sand(2)
145+
.register()
146+
147+
mods.betterwithaddons.sand_net.recipeBuilder()
148+
.input(item('minecraft:gold_ingot'))
149+
.output(item('minecraft:clay') * 4, item('minecraft:diamond'), item('minecraft:diamond') * 2)
150+
.sand(5)
151+
.register()
152+
153+
154+
// Soaking Unit:
155+
// Converts an input item into an output itemstack if placed within the appropriate multiblock. The multiblock is Ice
156+
// directly above the Soaking Box, 8 Water around the Soaking Box, and Water directly below the Soaking Box.
157+
158+
mods.betterwithaddons.soaking_box.removeByInput(item('betterwithaddons:bamboo'))
159+
mods.betterwithaddons.soaking_box.removeByOutput(item('betterwithaddons:japanmat:8'))
160+
// mods.betterwithaddons.soaking_box.removeAll()
161+
162+
mods.betterwithaddons.soaking_box.recipeBuilder()
163+
.input(item('minecraft:diamond'))
164+
.output(item('minecraft:clay'))
165+
.register()
166+
167+
mods.betterwithaddons.soaking_box.recipeBuilder()
168+
.input(item('minecraft:gold_ingot'))
169+
.output(item('minecraft:clay') * 4)
170+
.register()
171+
172+
173+
// Spindle:
174+
// Converts an input itemstack into an output itemstack, with the ability to consume the Spindle, when placed against a
175+
// Spinning Wheel powered by Mechanical Power.
176+
177+
mods.betterwithaddons.spindle.removeByInput(item('minecraft:vine'))
178+
mods.betterwithaddons.spindle.removeByOutput(item('betterwithaddons:bolt'))
179+
// mods.betterwithaddons.spindle.removeAll()
180+
181+
mods.betterwithaddons.spindle.recipeBuilder()
182+
.input(item('minecraft:diamond'))
183+
.output(item('minecraft:clay'))
184+
.register()
185+
186+
mods.betterwithaddons.spindle.recipeBuilder()
187+
.input(item('minecraft:clay') * 3)
188+
.output(item('minecraft:diamond'))
189+
.popoff()
190+
.register()
191+
192+
mods.betterwithaddons.spindle.recipeBuilder()
193+
.input(item('minecraft:gold_ingot'))
194+
.output(item('minecraft:clay') * 4)
195+
.register()
196+
197+
198+
// Tatara:
199+
// Converts an input item into an output itemstack if placed within the appropriate multiblock while fueled by Rice Ashes.
200+
// The multiblock is Lava or Fire directly below the Tatara, 8 Clay around the Lava or Fire, 9 Nether Brick above the
201+
// Tatara, 4 Stone Brick diagonal to the Tatara and two Iron Blocks across from each other adjacent to the Tatara.
202+
203+
mods.betterwithaddons.tatara.removeByInput(item('betterwithaddons:japanmat:20'))
204+
mods.betterwithaddons.tatara.removeByOutput(item('betterwithaddons:kera'))
205+
// mods.betterwithaddons.tatara.removeAll()
206+
207+
mods.betterwithaddons.tatara.recipeBuilder()
208+
.input(item('minecraft:diamond'))
209+
.output(item('minecraft:clay'))
210+
.register()
211+
212+
mods.betterwithaddons.tatara.recipeBuilder()
213+
.input(item('minecraft:gold_ingot'))
214+
.output(item('minecraft:clay') * 4)
215+
.register()
216+
217+
218+
// Ancestral Infusion Transmutation:
219+
// Converts an input item into an output itemstack, consuming Spirits from the Infused Soul Sand placed below the Ancestral
220+
// Infuser if placed within the appropriate multiblock. The multiblock is either Soul Sand or Infused Soul Sand placed
221+
// below the Ancestral Infuser and exclusively air blocks adjacent to the Infuser and Soul Sand blocks.
222+
223+
mods.betterwithaddons.transmutation.removeByInput(item('minecraft:reeds'))
224+
mods.betterwithaddons.transmutation.removeByOutput(item('betterwithaddons:crop_rice'))
225+
// mods.betterwithaddons.transmutation.removeAll()
226+
227+
mods.betterwithaddons.transmutation.recipeBuilder()
228+
.input(item('minecraft:diamond'))
229+
.output(item('minecraft:clay'))
230+
.spirits(0)
231+
.register()
232+
233+
mods.betterwithaddons.transmutation.recipeBuilder()
234+
.input(item('minecraft:gold_ingot'))
235+
.output(item('minecraft:clay') * 4)
236+
.spirits(5)
237+
.register()
238+
239+
240+
// Water Net:
241+
// Converts an input item into any number of output itemstacks if placed within the appropriate multiblock. The multiblock
242+
// is a Water Block directly below the Netted Screen, 8 Sakura Planks around the Water Block, and 8 Slat Blocks placed
243+
// around the Netted Screen.
244+
245+
mods.betterwithaddons.water_net.removeByInput(item('betterwithaddons:iron_sand'))
246+
mods.betterwithaddons.water_net.removeByOutput(item('betterwithaddons:food_sashimi'))
247+
mods.betterwithaddons.water_net.removeByOutput(item('betterwithaddons:food_fugu_sac'))
248+
// mods.betterwithaddons.water_net.removeAll()
249+
250+
mods.betterwithaddons.water_net.recipeBuilder()
251+
.input(item('minecraft:diamond'))
252+
.output(item('minecraft:clay'))
253+
.register()
254+
255+
mods.betterwithaddons.water_net.recipeBuilder()
256+
.input(item('minecraft:gold_ingot'))
257+
.output(item('minecraft:clay') * 4, item('minecraft:diamond'), item('minecraft:diamond') * 2)
258+
.register()
259+
260+

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ debug_atum = false
3333
debug_aurorian = false
3434
debug_avaritia = false
3535

36+
debug_better_with_addons = false
37+
debug_better_with_everything = false
3638
debug_better_with_mods = false
3739
debug_betweenlands = false
3840
debug_blood_arsenal = false

src/main/java/com/cleanroommc/groovyscript/compat/mods/ModSupport.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import com.cleanroommc.groovyscript.compat.mods.astralsorcery.AstralSorcery;
1616
import com.cleanroommc.groovyscript.compat.mods.atum.Atum;
1717
import com.cleanroommc.groovyscript.compat.mods.avaritia.Avaritia;
18+
import com.cleanroommc.groovyscript.compat.mods.betterwithaddons.BetterWithAddons;
1819
import com.cleanroommc.groovyscript.compat.mods.betterwithmods.BetterWithMods;
1920
import com.cleanroommc.groovyscript.compat.mods.betweenlands.Betweenlands;
2021
import com.cleanroommc.groovyscript.compat.mods.bloodarsenal.BloodArsenal;
@@ -98,6 +99,7 @@ public class ModSupport {
9899
public static final GroovyContainer<AstralSorcery> ASTRAL_SORCERY = new InternalModContainer<>("astralsorcery", "Astral Sorcery", AstralSorcery::new, "astral");
99100
public static final GroovyContainer<Atum> ATUM = new InternalModContainer<>("atum", "Atum 2", Atum::new);
100101
public static final GroovyContainer<Avaritia> AVARITIA = new InternalModContainer<>("avaritia", "Avaritia", Avaritia::new);
102+
public static final GroovyContainer<BetterWithAddons> BETTER_WITH_ADDONS = new InternalModContainer<>("betterwithaddons", "Better With Addons", BetterWithAddons::new);
101103
public static final GroovyContainer<BetterWithMods> BETTER_WITH_MODS = new InternalModContainer<>("betterwithmods", "Better With Mods", BetterWithMods::new);
102104
public static final GroovyContainer<Betweenlands> BETWEENLANDS = new InternalModContainer<>("thebetweenlands", "The Betweenlands", Betweenlands::new, "betweenlands");
103105
public static final GroovyContainer<BloodArsenal> BLOOD_ARSENAL = new InternalModContainer<>("bloodarsenal", "Blood Arsenal", BloodArsenal::new);

src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Empowerer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public void validate(GroovyLog.Msg msg) {
182182
validateItems(msg, 4, 4, 1, 1);
183183
validateFluids(msg);
184184
msg.add(mainInput == null, "mainInput must be defined");
185-
msg.add(IngredientHelper.overMaxSize(mainInput, 1), "mainInput must have a stack size of 1");
185+
validateStackSize(msg, 1, "mainInput", mainInput);
186186
msg.add(energyPerStand < 0, "energyPerStand must be a non negative integer, yet it was {}", energyPerStand);
187187
msg.add(time <= 0, "time must be an integer greater than 0, yet it was {}", time);
188188
msg.add(red < 0 || red > 1, "red must be a float between 0 and 1, yet it was {}", red);
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.cleanroommc.groovyscript.compat.mods.betterwithaddons;
2+
3+
import betterwithaddons.util.IngredientSized;
4+
import com.cleanroommc.groovyscript.api.IIngredient;
5+
import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer;
6+
import net.minecraft.item.crafting.Ingredient;
7+
import net.minecraftforge.fml.common.Loader;
8+
9+
public class BetterWithAddons extends GroovyPropertyContainer {
10+
11+
public final DryingBox dryingBox = new DryingBox();
12+
public final FireNet fireNet = new FireNet();
13+
public final Infuser infuser = new Infuser();
14+
public final LureTree lureTree = new LureTree();
15+
public final Packing packing;
16+
public final Rotting rotting = new Rotting();
17+
public final SandNet sandNet = new SandNet();
18+
public final SoakingBox soakingBox = new SoakingBox();
19+
public final Spindle spindle = new Spindle();
20+
public final Tatara tatara = new Tatara();
21+
public final Transmutation transmutation = new Transmutation();
22+
public final WaterNet waterNet = new WaterNet();
23+
24+
public BetterWithAddons() {
25+
// the format of "PackingRecipe" has changed, and we cannot build against both.
26+
packing = isBetterWithEverything() ? null : new Packing();
27+
}
28+
29+
/**
30+
* Because Better With Addons checks if the ingredient is an instanceof {@link betterwithaddons.util.IHasSize IHasSize}
31+
* to determine if the Ingredient has an amount, we have to use their custom Ingredient.
32+
* <p>
33+
* If this isn't used, then the recipe may appear correctly in JEI but will actually only consume 1 when done in-game.
34+
*/
35+
public static Ingredient fromIIngredient(IIngredient ingredient) {
36+
return new IngredientSized(ingredient.toMcIngredient(), ingredient.getAmount());
37+
}
38+
39+
public static boolean isBetterWithEverything() {
40+
var entry = Loader.instance().getIndexedModList().get("betterwithaddons");
41+
if (entry == null) return false;
42+
return entry.getMetadata().authorList.contains("ACGaming"); // TODO identify a better way to do this, if one exists
43+
}
44+
}

0 commit comments

Comments
 (0)