Skip to content

Commit 464da11

Browse files
authored
Adjust getMaxItemInput in missing places, fix examples (#303)
* add getMaxItemInput 1 to some places missing it * fix old references to placeholdername * fix reloading compat
1 parent 9deea57 commit 464da11

File tree

11 files changed

+51
-21
lines changed

11 files changed

+51
-21
lines changed

examples/postInit/custom/hard_mode.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// PACKMODE: hard
22

33
crafting.shapedBuilder()
4-
.output(item('placeholdername:clay_2'))
4+
.output(item('groovyscriptdev:clay_2'))
55
.shape([[null, item('minecraft:diamond'), null],
66
[item('minecraft:diamond'), null, item('minecraft:diamond')],
77
[null, item('minecraft:diamond'), null]])

examples/postInit/custom/normal_mode.gvy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
crafting.removeByOutput(item('minecraft:furnace'))
55
crafting.shapedBuilder()
6-
.output(item('placeholdername:clay_2'))
6+
.output(item('groovyscriptdev:clay_2'))
77
.shape([[null, item('minecraft:iron_ingot'), null],
88
[item('minecraft:iron_ingot'), null, item('minecraft:iron_ingot')],
99
[null, item('minecraft:iron_ingot'), null]])

examples/postInit/custom/reloading_compat.groovy

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,21 @@ import classes.GenericRecipeReloading
66
import classes.SimpleConversionRecipe
77
import net.minecraft.util.text.TextComponentString
88
import net.minecraftforge.event.world.BlockEvent
9-
import com.cleanroommc.groovyscript.event.GroovyReloadEvent
109

11-
// add the example recipe
12-
GenericRecipeReloading.instance.add(new SimpleConversionRecipe(item('minecraft:clay'), item('minecraft:gold_ingot')))
13-
14-
// reload via an event
15-
eventManager.listen(GroovyReloadEvent) {
10+
// only run the onReload code when reloading. must be done before any further manipulations occur
11+
if (isReloading()) {
1612
GenericRecipeReloading.instance.onReload()
1713
}
1814

15+
// add the example recipe
16+
GenericRecipeReloading.instance.add(new SimpleConversionRecipe(item('minecraft:clay'), item('minecraft:gold_ingot')))
17+
1918
// use an event to demonstrate the recipe in-game
2019
eventManager.listen(BlockEvent.BreakEvent) {
2120
// get the block drop if it was silk touched
2221
def drop = it.getState().getBlock().getSilkTouchDrop(it.getState())
2322
// find if any of the recipes have an input that match the drop
24-
def found = SimpleConversionRecipe.recipes.find { it.input in drop }
23+
def found = SimpleConversionRecipe.recipes.find({ it.input in drop })
2524
if (found != null) {
2625
// send the player a pair of messages to demonstrate the recipe
2726
it.player.sendMessage(new TextComponentString("You broke a ${it.getState().getBlock().getLocalizedName()} Block!"))

examples/preInit/vanilla.groovy

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import net.minecraft.util.math.AxisAlignedBB
99
import net.minecraft.world.IBlockAccess
1010

1111

12-
// Localization is done in 'assets/placeholdername/lang/[language].lang'
12+
// Localization is done in 'assets/groovyscriptdev/lang/[language].lang'
1313

14-
// Textures for items are created at 'assets/placeholdername/textures/items/'.
14+
// Textures for items are created at 'assets/groovyscriptdev/textures/items/'.
1515
// Add a file called '[itemname].png' to create a static item texture, and a file called
1616
// '[itemname].png.mcmeta' to create an animated file.
17-
// A file will be created in 'assets/placeholdername/models/item/' called '[itemname].json' and point to this location in textures.
17+
// A file will be created in 'assets/groovyscriptdev/models/item/' called '[itemname].json' and point to this location in textures.
1818

1919
def HOAU = content.createItem('heartofauniverse') // Set item name at 'item.[itemname].name=[desired name]'
2020
.setRarity(EnumRarity.EPIC) // Optional IRarity, sets the default text formatting (default none)
@@ -31,13 +31,13 @@ content.setDefaultCreativeTab(tab)
3131
HOAU.register()
3232

3333

34-
// Create an item at the location 'placeholdername:clay_2'
34+
// Create an item at the location 'groovyscriptdev:clay_2'
3535
content.createItem('clay_2')
3636
.setMaxStackSize(5) // Optional int, sets the max stack size (default 64)
3737
.setRarity(EnumRarity.RARE) // Optional IRarity, sets the default text formatting (default none)
3838
.register()
3939

40-
// Create an item at the location 'placeholdername:clay_3'.
40+
// Create an item at the location 'groovyscriptdev:clay_3'.
4141
content.createItem('clay_3')
4242
.setCreativeTab(creativeTab('misc')) // Optional CreativeTab, sets the creative tab (default set via setDefaultCreativeTab)
4343
.setEnchantedEffect() // Optional boolean, controls if the enchanted effect plays on the item
@@ -62,17 +62,17 @@ content.registerItem('snack', (new ItemFood(20, 10, false) {
6262

6363
// block
6464

65-
// Textures for blocks are created at 'assets/placeholdername/textures/blocks/'.
65+
// Textures for blocks are created at 'assets/groovyscriptdev/textures/blocks/'.
6666
// Add a file called '[blockname].png' to create a static item texture, and a file called
6767
// '[blockname].png.mcmeta' to create an animated file.
68-
// A file will be created in 'assets/placeholdername/models/block/' called '[blockname].json' and point to this location in textures.
68+
// A file will be created in 'assets/groovyscriptdev/models/block/' called '[blockname].json' and point to this location in textures.
6969

70-
// Create a block at the location 'placeholdername:generic_block'
70+
// Create a block at the location 'groovyscriptdev:generic_block'
7171
content.createBlock('generic_block')// Set block name at 'tile.[blockname].name=[desired name]'
7272
.register()
7373

74-
// Create a custom block at the location 'placeholdername:dragon_egg_lamp'
75-
// Also changes the 'parent' setting in 'assets/placeholdername/models/block/[blockname].json' from 'block/cube_all' to 'block/dragon_egg'
74+
// Create a custom block at the location 'groovyscriptdev:dragon_egg_lamp'
75+
// Also changes the 'parent' setting in 'assets/groovyscriptdev/models/block/[blockname].json' from 'block/cube_all' to 'block/dragon_egg'
7676
content.registerBlock('dragon_egg_lamp', (new Block(Material.REDSTONE_LIGHT) {
7777
protected static final AxisAlignedBB DRAGON_EGG_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 1.0D, 0.9375D)
7878

src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/BlastFurnace.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ public void removeByOutput(IIngredient output) {
4343
@Property(property = "output", comp = @Comp(eq = 1))
4444
public static class RecipeBuilder extends AbstractRecipeBuilder<SimpleRecipe> {
4545

46+
@Override
47+
protected int getMaxItemInput() {
48+
return 1;
49+
}
50+
4651
@Override
4752
public String getErrorMsg() {
4853
return "Error adding FutureMC Blast Furnace recipe";

src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Campfire.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ public RecipeBuilder duration(int duration) {
5252
return this;
5353
}
5454

55+
@Override
56+
protected int getMaxItemInput() {
57+
return 1;
58+
}
59+
5560
@Override
5661
public String getErrorMsg() {
5762
return "Error adding FutureMC Campfire recipe";

src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Smoker.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ public void removeByOutput(IIngredient output) {
4343
@Property(property = "output", comp = @Comp(eq = 1))
4444
public static class RecipeBuilder extends AbstractRecipeBuilder<SimpleRecipe> {
4545

46+
@Override
47+
protected int getMaxItemInput() {
48+
return 1;
49+
}
50+
4651
@Override
4752
public String getErrorMsg() {
4853
return "Error adding FutureMC Smoker recipe";

src/main/java/com/cleanroommc/groovyscript/compat/mods/futuremc/Stonecutter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ public void removeByOutput(IIngredient output) {
4343
@Property(property = "output", comp = @Comp(eq = 1))
4444
public static class RecipeBuilder extends AbstractRecipeBuilder<SimpleRecipe> {
4545

46+
@Override
47+
protected int getMaxItemInput() {
48+
return 1;
49+
}
50+
4651
@Override
4752
public String getErrorMsg() {
4853
return "Error adding FutureMC Stonecutter recipe";

src/main/java/com/cleanroommc/groovyscript/compat/mods/horsepower/ChoppingBlock.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ public RecipeBuilder time(int time) {
101101
return this;
102102
}
103103

104-
// todo this can only handle an input with a size of 1, should validate that here
104+
@Override
105+
protected int getMaxItemInput() {
106+
return 1;
107+
}
105108

106109
@Override
107110
public String getErrorMsg() {

src/main/java/com/cleanroommc/groovyscript/compat/mods/horsepower/ManualChoppingBlock.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ public RecipeBuilder time(int time) {
8383
return this;
8484
}
8585

86-
// todo this can only handle an input with a size of 1, should validate that here
86+
@Override
87+
protected int getMaxItemInput() {
88+
return 1;
89+
}
8790

8891
@Override
8992
public String getErrorMsg() {

0 commit comments

Comments
 (0)