Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/postInit/custom/hard_mode.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// PACKMODE: hard

crafting.shapedBuilder()
.output(item('placeholdername:clay_2'))
.output(item('groovyscriptdev:clay_2'))
.shape([[null, item('minecraft:diamond'), null],
[item('minecraft:diamond'), null, item('minecraft:diamond')],
[null, item('minecraft:diamond'), null]])
Expand Down
2 changes: 1 addition & 1 deletion examples/postInit/custom/normal_mode.gvy
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

crafting.removeByOutput(item('minecraft:furnace'))
crafting.shapedBuilder()
.output(item('placeholdername:clay_2'))
.output(item('groovyscriptdev:clay_2'))
.shape([[null, item('minecraft:iron_ingot'), null],
[item('minecraft:iron_ingot'), null, item('minecraft:iron_ingot')],
[null, item('minecraft:iron_ingot'), null]])
Expand Down
13 changes: 6 additions & 7 deletions examples/postInit/custom/reloading_compat.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@ import classes.GenericRecipeReloading
import classes.SimpleConversionRecipe
import net.minecraft.util.text.TextComponentString
import net.minecraftforge.event.world.BlockEvent
import com.cleanroommc.groovyscript.event.GroovyReloadEvent

// add the example recipe
GenericRecipeReloading.instance.add(new SimpleConversionRecipe(item('minecraft:clay'), item('minecraft:gold_ingot')))

// reload via an event
eventManager.listen(GroovyReloadEvent) {
// only run the onReload code when reloading. must be done before any further manipulations occur
if (isReloading()) {
GenericRecipeReloading.instance.onReload()
}

// add the example recipe
GenericRecipeReloading.instance.add(new SimpleConversionRecipe(item('minecraft:clay'), item('minecraft:gold_ingot')))

// use an event to demonstrate the recipe in-game
eventManager.listen(BlockEvent.BreakEvent) {
// get the block drop if it was silk touched
def drop = it.getState().getBlock().getSilkTouchDrop(it.getState())
// find if any of the recipes have an input that match the drop
def found = SimpleConversionRecipe.recipes.find { it.input in drop }
def found = SimpleConversionRecipe.recipes.find({ it.input in drop })
if (found != null) {
// send the player a pair of messages to demonstrate the recipe
it.player.sendMessage(new TextComponentString("You broke a ${it.getState().getBlock().getLocalizedName()} Block!"))
Expand Down
20 changes: 10 additions & 10 deletions examples/preInit/vanilla.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import net.minecraft.util.math.AxisAlignedBB
import net.minecraft.world.IBlockAccess


// Localization is done in 'assets/placeholdername/lang/[language].lang'
// Localization is done in 'assets/groovyscriptdev/lang/[language].lang'

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

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


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

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

// block

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

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public void removeByOutput(IIngredient output) {
@Property(property = "output", comp = @Comp(eq = 1))
public static class RecipeBuilder extends AbstractRecipeBuilder<SimpleRecipe> {

@Override
protected int getMaxItemInput() {
return 1;
}

@Override
public String getErrorMsg() {
return "Error adding FutureMC Blast Furnace recipe";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public RecipeBuilder duration(int duration) {
return this;
}

@Override
protected int getMaxItemInput() {
return 1;
}

@Override
public String getErrorMsg() {
return "Error adding FutureMC Campfire recipe";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public void removeByOutput(IIngredient output) {
@Property(property = "output", comp = @Comp(eq = 1))
public static class RecipeBuilder extends AbstractRecipeBuilder<SimpleRecipe> {

@Override
protected int getMaxItemInput() {
return 1;
}

@Override
public String getErrorMsg() {
return "Error adding FutureMC Smoker recipe";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public void removeByOutput(IIngredient output) {
@Property(property = "output", comp = @Comp(eq = 1))
public static class RecipeBuilder extends AbstractRecipeBuilder<SimpleRecipe> {

@Override
protected int getMaxItemInput() {
return 1;
}

@Override
public String getErrorMsg() {
return "Error adding FutureMC Stonecutter recipe";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ public RecipeBuilder time(int time) {
return this;
}

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

@Override
public String getErrorMsg() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ public RecipeBuilder time(int time) {
return this;
}

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

@Override
public String getErrorMsg() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public RecipeBuilder cost(int cost) {
return this;
}

@Override
protected int getMaxItemInput() {
return 1;
}

@Override
public String getErrorMsg() {
return "Error adding Random Things Anvil recipe";
Expand Down