diff --git a/examples/postInit/custom/events.groovy b/examples/postInit/custom/events.groovy new file mode 100644 index 000000000..efeb3f362 --- /dev/null +++ b/examples/postInit/custom/events.groovy @@ -0,0 +1,16 @@ + +import net.minecraftforge.event.entity.living.EnderTeleportEvent +import net.minecraftforge.event.world.BlockEvent +import net.minecraft.util.text.TextComponentString + + +// Use eventManager.listen and listen to the desired event. +/*eventManager.listen(BlockEvent.BreakEvent) { + it.setCanceled(true) // Many events can be canceled. + it.player.sendMessage(new TextComponentString("${it.getState().getBlock().getLocalizedName()} Block was prevent from being broken")) +}*/ + +// The outer parentheses and inner curly braces are optional. +eventManager.listen(EnderTeleportEvent) { event -> + event.setAttackDamage 19.5f +} diff --git a/examples/postInit/custom/vanilla.groovy b/examples/postInit/custom/vanilla.groovy deleted file mode 100644 index 6d442f2ab..000000000 --- a/examples/postInit/custom/vanilla.groovy +++ /dev/null @@ -1,255 +0,0 @@ - -// Imports must happen above all other code. - -import net.minecraftforge.event.entity.living.EnderTeleportEvent -import net.minecraftforge.event.world.BlockEvent -import net.minecraft.util.text.TextComponentString - -for (var stack in mods.minecraft.allItems[5..12]) { - log.info stack -} - -// Crafting recipes are typically created via recipe builder, but also have shorthand versions for some common uses. -// Here are a series of examples, with the shorthand and corresponding recipe builder: - -//crafting.addShaped(item('minecraft:gold_block'), [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[null, null, null],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) -mods.minecraft.crafting.shapedBuilder() - .output(item('minecraft:gold_block')) - .shape([[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[null, null, null],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) - .register() - -//crafting.addShaped('gold_v_to_clay', item('minecraft:clay'), [[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[null,item('minecraft:gold_ingot'),null]]) -minecraft.crafting.shapedBuilder() - .name('gold_v_to_clay') - .output(item('minecraft:clay')) - .shape([[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[null,item('minecraft:stone_pickaxe').transformDamage(2).whenAnyDamage(),null]]) - .register() - -//crafting.addShaped(resource('example:resource_location'), item('minecraft:clay'), [[item('minecraft:cobblestone')],[item('minecraft:nether_star')],[item('minecraft:cobblestone')]]) -crafting.shapedBuilder() - .name(resource('example:resource_location')) - .output(item('minecraft:clay')) - .shape([[item('minecraft:cobblestone')],[item('minecraft:nether_star')],[item('minecraft:cobblestone')]]) - .register() - -//crafting.addShapeless(item('minecraft:clay'), [item('minecraft:cobblestone'),item('minecraft:nether_star'),item('minecraft:gold_ingot')]) -crafting.shapelessBuilder() - .output(item('minecraft:clay')) - .input([item('minecraft:cobblestone'),item('minecraft:nether_star'),item('minecraft:gold_ingot')]) - .register() - -//crafting.addShapeless('precious_to_clay', item('minecraft:clay'), [item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]) -crafting.shapelessBuilder() - .name('precious_to_clay') - .output(item('minecraft:clay')) - .input([item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]) - .register() - -//crafting.addShapeless(resource('example:resource_location2'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) -crafting.shapelessBuilder() - .name(resource('example:resource_location2')) - .output(item('minecraft:clay')) - .input([item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) - .register() - -//crafting.replaceShapeless(item('minecraft:ender_eye'), [item('minecraft:ender_pearl'),item('minecraft:nether_star')]) -crafting.shapelessBuilder() - .output(item('minecraft:ender_eye')) - .input([item('minecraft:ender_pearl'),item('minecraft:nether_star')]) - .replace() - .register() - -//crafting.replaceShapeless('minecraft:pink_dye_from_pink_tulp', item('minecraft:clay'), [item('minecraft:nether_star')]) -crafting.shapelessBuilder() - .name('minecraft:pink_dye_from_pink_tulp') - .output(item('minecraft:clay')) - .input([item('minecraft:nether_star')]) - .replaceByName() - .register() - -//crafting.replaceShapeless(resource('minecraft:pink_dye_from_peony'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) -crafting.shapelessBuilder() - .name(resource('minecraft:pink_dye_from_peony')) - .output(item('minecraft:clay')) - .input([item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) - .replaceByName() - .register() - -//crafting.replaceShaped(item('minecraft:chest'), [[ore('logWood'),ore('logWood'),ore('logWood')],[ore('logWood'),null,ore('logWood')],[ore('logWood'),ore('logWood'),ore('logWood')]]) -crafting.shapedBuilder() - .output(item('minecraft:chest')) - .shape([[ore('logWood'),ore('logWood'),ore('logWood')],[ore('logWood'),null,ore('logWood')],[ore('logWood'),ore('logWood'),ore('logWood')]]) - .replace() - .register() - -//crafting.replaceShaped('gold_to_diamonds', item('minecraft:diamond') * 8, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) -crafting.shapedBuilder() - .name('gold_to_diamonds') - .output(item('minecraft:diamond') * 8) - .shape([[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) - .replaceByName() - .register() - -//crafting.replaceShaped(resource('minecraft:sea_lantern'), item('minecraft:clay'), [[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]) -crafting.shapedBuilder() - .name(resource('minecraft:sea_lantern')) - .output(item('minecraft:clay')) - .shape([[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]) - .replaceByName() - .register() - -// recipeFunction example - -crafting.shapelessBuilder() - .output(item('minecraft:wooden_shovel')) - .input(ore('logWood').reuse(),item('minecraft:wooden_shovel:*').mark('tool')) // We mark shovel with 'tool' - .recipeFunction { output, inputs, info -> - def item = inputs['tool'] // Using the getAt operator - // inputs.findMarked('tool') can also be used - - output.withDamage(item.getItemDamage() - 1) // Decrease damage by 1 - } - .register() - - -// The recipe builder also has some additional features, including -// The abilty to input a string and a set of keys, significantly improving readability. - -crafting.shapedBuilder() - .name('nether_star_from_clay_and_tnt') - .output(item('minecraft:nether_star')) - .row('TXT') - .row('X X') // The key space (' ') is set to Ingredient.EMPTY (and cannot be changed) - .row('!X!') // WARNING: All rows must be the same length. - .key('T', item('minecraft:tnt')) // Keys are case sensitive - .key('X', item('minecraft:clay').reuse()) // Reuse returns the item instead of consuming it - .key('!', item('minecraft:tnt').transform({ _ -> item('minecraft:diamond') })) // Transforms the item into a diamond - .register() - -// A map of keys can also be passed in. The map can contain any IIngredient, including those with transforms or otherwise -def presetKeys = [ - X: item('minecraft:clay'), - T: item('minecraft:tnt'), - D: item('minecraft:diamond'), - S: ore('netherStar').reuse(), - '!': item('minecraft:tnt').transform(item('minecraft:diamond')), - G: ore('ingotGold'), - W: fluid('water') * 1000, // Any tank that contains >= 1000 mb and can be reduced by 1000. - '0': item('minecraft:diamond_sword').withNbt([display:[Name:'Sword with Specific NBT data']]) -] - -crafting.shapedBuilder() - .output(item('minecraft:clay_ball') * 3) - .shape('S S', // Shape allows a series of either comma separated strings or an array of strings - ' G ', - 'SWS') - .key(presetKeys) - .register() - -crafting.shapedBuilder() - .name('nether_star_duplication_with_tnt') - .output(item('minecraft:nether_star')) - .row('!!!') - .row('!S!') - .row('!!!') - .key(presetKeys) - .register() - -crafting.shapedBuilder() - .output(item('minecraft:clay')) - .row(' ') - .row(' 0 ') // Requires the item be in exactly the center of the 3x3 grid. - .row(' ') - .key(presetKeys) - .register() - - -crafting.remove('minecraft:mossy_stonebrick') // Remove the entry with the recipe ID -crafting.remove(resource('minecraft:stonebrick')) -crafting.removeByOutput(item('minecraft:gold_ingot')) // Remove all recipes with the output -//crafting.removeByInput(item('minecraft:iron_ingot')) // Remove all recipes containing the ingredient as an input -//crafting.removeAll() - - -// Furnace -//furnace.add(ore('ingotIron'), item('minecraft:diamond')) // exp has a default value of 0.1 -furnace.add(item('minecraft:nether_star'), item('minecraft:clay') * 64, 13) - -furnace.recipeBuilder() - .input(ore('ingotGold')) - .output(item('minecraft:nether_star')) - .exp(0.5) // Optional float, xp gained per recipe completion. Default 0.1f - .register() - -furnace.removeByInput(item('minecraft:clay')) -furnace.removeByOutput(item('minecraft:brick')) -//furnace.removeAll() - - -// OreDictionary (OreDict) -oredict.add('ingotGold', item('minecraft:nether_star')) -oredict.add('netherStar', item('minecraft:gold_ingot')) -oredict.remove('netherStar', item('minecraft:nether_star')) - -//oredict.clear('plankWood') // Note that any recipes using this oredict will silently die -//oredict.removeAll('ingotIron') -//oredict.removeAll() - - -// Starting inventory -player.testingStartingItems = false // Enable this to have the items be given every time you join the world. Use in testing only. -player.replaceDefaultInventory = true // Enable this to replace any existing items with GroovyScript's starting inventory items. -player.setStartingItems(true, // Boolean determines if items are added to specific slots, with true meaning the items are slot specific. - item('minecraft:clay').withNbt([display:[Name:'Hotbar']]), null, null, null, null, null, null, null, null, - item('minecraft:clay').withNbt([display:[Name:'Top row of inventory']]), null, null, null, null, null, null, null, null, - item('minecraft:clay').withNbt([display:[Name:'Middle row of inventory']]), null, null, null, null, null, null, null, null, - item('minecraft:clay').withNbt([display:[Name:'Bottom row of inventory']]), null, null, null, null, null, null, null, null, - item('minecraft:diamond_boots'), item('minecraft:diamond_leggings'), item('minecraft:diamond_chestplate'), item('minecraft:diamond_helmet'), - item('minecraft:clay').withNbt([display:[Name:'Offhand']]) -) - -// Items can also be added to specific slots individually -//player.addStartingItem(item('minecraft:diamond_boots'), 36) // Note that this will error if the slot has already been set to an item -// 0-8 is hotbar, 9-17 is top row, 18-26 is middle row, 26-35 is bottom row, 36 is boots, 37 is leggings, 38 is chestplate, 39 is helmet, and 40 is offhand. - -// Or added to any slot in the inventory -player.addStartingItem(item('minecraft:clay_ball')) -player.addStartingItem(item('minecraft:gold_ingot')) -player.addStartingItem(item('minecraft:diamond')) -player.addStartingItem(item('minecraft:nether_star')) -player.addStartingItem(item('minecraft:water_bucket')) - -// Text formatting bracket handler -// Colors: BLACK (0), DARK_BLUE (1), DARK_GREEN (2), DARK_AQUA (3), DARK_RED (4), DARK_PURPLE (5), GOLD (6), GRAY (7), DARK_GRAY (8),BLUE (9), GREEN (10), AQUA (11), RED (12), LIGHT_PURPLE (13), YELLOW (14), WHITE (15) -// Emphasis: OBFUSCATED, BOLD, STRIKETHROUGH, UNDERLINE, ITALIC -// Clears formatting: RESET (-1) - -// Note: only one text format can be set at a time. To have multiple, use a different way. -rarity.set(textformat('AQUA'), item('minecraft:diamond')) -// And item mixin -item('minecraft:clay').setRarity(textformat('BOLD')) - -// Removes text formatting from the name. -rarity.set(textformat('RESET'), item('minecraft:enchanted_book')) -item('minecraft:golden_apple').setRarity(textformat('-1')) - - -// Use eventManager.listen and listen to the desired event. -/*eventManager.listen(BlockEvent.BreakEvent) { - it.setCanceled(true) // Many events can be canceled. - it.player.sendMessage(new TextComponentString("${it.getState().getBlock().getLocalizedName()} Block was prevent from being broken")) -}*/ - -// The outer parentheses and inner curly braces are optional. -eventManager.listen(EnderTeleportEvent) { event -> - event.setAttackDamage 19.5f -} - -command.registerCommand('groovy_test') { server, sender, args -> - sender.sendMessage('Hello from GroovyScript') -} - -// Default GameRules -gameRule.add('doDaylightCycle', 'false') -gameRule.add(['mobGriefing': 'false', 'keepInventory': 'true']) -gameRule.setWarnNewGameRule(true) diff --git a/examples/postInit/minecraft.groovy b/examples/postInit/minecraft.groovy new file mode 100644 index 000000000..b61c1e19d --- /dev/null +++ b/examples/postInit/minecraft.groovy @@ -0,0 +1,216 @@ + +// Auto generated groovyscript example file +// MODS_LOADED: minecraft + +log.info 'mod \'minecraft\' detected, running script' + +// Custom Commands: +// Create custom commands, either generally or specifically for the client. + +mods.minecraft.command.registerCommand('groovy_test', { server, sender, args -> sender.sendMessage('Hello from GroovyScript')}) + +// Crafting Table: +// A normal crafting recipe that takes place in the Vanilla Crafting Table, converting up to 9 items in a shapeless or +// specific shaped arrangement into an output itemstack. + +mods.minecraft.crafting.remove(resource('minecraft:stonebrick')) +mods.minecraft.crafting.remove('minecraft:mossy_stonebrick') +mods.minecraft.crafting.removeByOutput(item('minecraft:gold_ingot')) +// mods.minecraft.crafting.removeAll() + +mods.minecraft.crafting.shapedBuilder() + .output(item('minecraft:nether_star')) + .row('TXT') + .row('X X') + .row('!X!') + .key('T', item('minecraft:tnt')) + .key('X', item('minecraft:clay').reuse()) + .key('!', item('minecraft:tnt').transform({ _ -> item('minecraft:diamond') })) + .register() + +mods.minecraft.crafting.shapedBuilder() + .output(item('minecraft:clay_ball') * 3) + .shape('S S', + ' G ', + 'SWS') + .key([S: ore('netherStar').reuse(), G: ore('ingotGold'), W: fluid('water') * 1000]) + .register() + +mods.minecraft.crafting.shapedBuilder() + .name('nether_star_duplication_with_tnt') + .output(item('minecraft:nether_star')) + .row('!!!') + .row('!S!') + .row('!!!') + .key([S: ore('netherStar').reuse(), '!': item('minecraft:tnt').transform(item('minecraft:diamond'))]) + .register() + +mods.minecraft.crafting.shapedBuilder() + .output(item('minecraft:clay')) + .row(' B') + .key('B', item('minecraft:glass_bottle')) + .register() + +mods.minecraft.crafting.shapedBuilder() + .output(item('minecraft:clay')) + .row(' ') + .row(' 0 ') + .row(' ') + .key('0', item('minecraft:diamond_sword').withNbt([display:[Name:'Sword with Specific NBT data']])) + .register() + +mods.minecraft.crafting.shapedBuilder() + .output(item('minecraft:gold_block')) + .shape([[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], + [null, null, null], + [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) + .register() + +mods.minecraft.crafting.shapedBuilder() + .name('gold_v_to_clay') + .output(item('minecraft:clay')) + .shape([[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')], + [null,item('minecraft:stone_pickaxe').transformDamage(2).whenAnyDamage(),null]]) + .register() + +mods.minecraft.crafting.shapedBuilder() + .name(resource('example:resource_location')) + .output(item('minecraft:clay')) + .shape([[item('minecraft:cobblestone')], + [item('minecraft:nether_star')], + [item('minecraft:cobblestone')]]) + .register() + +mods.minecraft.crafting.shapedBuilder() + .output(item('minecraft:chest')) + .shape([[ore('logWood'),ore('logWood'),ore('logWood')], + [ore('logWood'),null,ore('logWood')], + [ore('logWood'),ore('logWood'),ore('logWood')]]) + .replace() + .register() + +mods.minecraft.crafting.shapedBuilder() + .name('gold_to_diamonds') + .output(item('minecraft:diamond') * 8) + .shape([[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')], + [item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) + .replaceByName() + .register() + +mods.minecraft.crafting.shapedBuilder() + .name(resource('minecraft:sea_lantern')) + .output(item('minecraft:clay')) + .shape([[item('minecraft:glowstone')], + [item('minecraft:glowstone')], + [item('minecraft:glowstone')]]) + .replaceByName() + .register() + +mods.minecraft.crafting.shapelessBuilder() + .output(item('minecraft:clay')) + .input([item('minecraft:cobblestone'),item('minecraft:nether_star'),item('minecraft:gold_ingot')]) + .register() + +mods.minecraft.crafting.shapelessBuilder() + .name('precious_to_clay') + .output(item('minecraft:clay')) + .input([item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]) + .register() + +mods.minecraft.crafting.shapelessBuilder() + .name(resource('example:resource_location2')) + .output(item('minecraft:clay')) + .input([item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) + .register() + +mods.minecraft.crafting.shapelessBuilder() + .output(item('minecraft:ender_eye')) + .input([item('minecraft:ender_pearl'),item('minecraft:nether_star')]) + .replace() + .register() + +mods.minecraft.crafting.shapelessBuilder() + .name('minecraft:pink_dye_from_pink_tulp') + .output(item('minecraft:clay')) + .input([item('minecraft:nether_star')]) + .replaceByName() + .register() + +mods.minecraft.crafting.shapelessBuilder() + .name(resource('minecraft:pink_dye_from_peony')) + .output(item('minecraft:clay')) + .input([item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) + .replaceByName() + .register() + + +// mods.minecraft.crafting.addShaped(item('minecraft:gold_block'), [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[null, null, null],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) +// mods.minecraft.crafting.addShaped(resource('example:resource_location'), item('minecraft:clay'), [[item('minecraft:cobblestone')],[item('minecraft:nether_star')],[item('minecraft:cobblestone')]]) +// mods.minecraft.crafting.addShaped('gold_v_to_clay', item('minecraft:clay'), [[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[null,item('minecraft:gold_ingot'),null]]) +// mods.minecraft.crafting.addShapeless(item('minecraft:clay'), [item('minecraft:cobblestone'),item('minecraft:nether_star'),item('minecraft:gold_ingot')]) +// mods.minecraft.crafting.addShapeless(resource('example:resource_location2'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) +// mods.minecraft.crafting.addShapeless('precious_to_clay', item('minecraft:clay'), [item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]) +// mods.minecraft.crafting.replaceShaped(item('minecraft:chest'), [[ore('logWood'),ore('logWood'),ore('logWood')],[ore('logWood'),null,ore('logWood')],[ore('logWood'),ore('logWood'),ore('logWood')]]) +// mods.minecraft.crafting.replaceShaped(resource('minecraft:sea_lantern'), item('minecraft:clay'), [[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]) +// mods.minecraft.crafting.replaceShaped('gold_to_diamonds', item('minecraft:diamond') * 8, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) +// mods.minecraft.crafting.replaceShapeless(item('minecraft:ender_eye'), [item('minecraft:ender_pearl'),item('minecraft:nether_star')]) +// mods.minecraft.crafting.replaceShapeless(resource('minecraft:pink_dye_from_peony'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) +// mods.minecraft.crafting.replaceShapeless('minecraft:pink_dye_from_pink_tulp', item('minecraft:clay'), [item('minecraft:nether_star')]) + +// Furnace: +// Converts an input item into an output itemstack after a set amount of time, with the ability to give experience and +// using fuel to run. + +mods.minecraft.furnace.removeByInput(item('minecraft:clay')) +mods.minecraft.furnace.removeByOutput(item('minecraft:brick')) +// mods.minecraft.furnace.removeAll() + +mods.minecraft.furnace.recipeBuilder() + .input(ore('ingotGold')) + .output(item('minecraft:nether_star')) + .exp(0.5) + .register() + + +// mods.minecraft.furnace.add(ore('ingotIron'), item('minecraft:diamond')) +mods.minecraft.furnace.add(item('minecraft:nether_star'), item('minecraft:clay') * 64, 13) + +// Default GameRules: +// Create or assign a default value to GameRules. + +mods.minecraft.game_rule.add(['mobGriefing': 'false', 'keepInventory': 'true']) +mods.minecraft.game_rule.add('doDaylightCycle', 'false') + +mods.minecraft.game_rule.setWarnNewGameRule(true) + +// Ore Dictionary: +// Manipulate the Ore Dictionary and what itemstacks are part of what oredicts. + +// mods.minecraft.ore_dict.clear('plankWood') +mods.minecraft.ore_dict.remove('netherStar', item('minecraft:nether_star')) +// mods.minecraft.ore_dict.removeAll('ingotIron') +// mods.minecraft.ore_dict.removeAll() + +mods.minecraft.ore_dict.add('ingotGold', item('minecraft:nether_star')) +mods.minecraft.ore_dict.add('netherStar', item('minecraft:gold_ingot')) + +// Starting Inventory: +// Sets the starting inventory of the player, including armor slots and offhand. + +mods.minecraft.player.addStartingItem(item('minecraft:diamond')) +mods.minecraft.player.addStartingItem(item('minecraft:clay_ball')) +mods.minecraft.player.addStartingItem(item('minecraft:gold_ingot')) +mods.minecraft.player.addStartingItem(item('minecraft:nether_star')) +mods.minecraft.player.addStartingItem(item('minecraft:water_bucket')) +mods.minecraft.player.setStartingItems(true, item('minecraft:clay').withNbt([display:[Name:'Hotbar']]), null, null, null, null, null, null, null, null, item('minecraft:clay').withNbt([display:[Name:'Top row of inventory']]), null, null, null, null, null, null, null, null, item('minecraft:clay').withNbt([display:[Name:'Middle row of inventory']]), null, null, null, null, null, null, null, null, item('minecraft:clay').withNbt([display:[Name:'Bottom row of inventory']]), null, null, null, null, null, null, null, null, item('minecraft:diamond_boots'), item('minecraft:diamond_leggings'), item('minecraft:diamond_chestplate'), item('minecraft:diamond_helmet'), item('minecraft:clay').withNbt([display:[Name:'Offhand']])) + +mods.minecraft.player.setReplaceDefaultInventory(true) +mods.minecraft.player.setTestStartingItems(true) + +// Rarity: +// Control the rarity of the item, which typically is the name color, to any standard Rarity or any TextFormatting code. + +mods.minecraft.rarity.set(textformat('AQUA'), item('minecraft:diamond')) +mods.minecraft.rarity.set(textformat('RESET'), item('minecraft:enchanted_book')) + diff --git a/src/main/java/com/cleanroommc/groovyscript/command/GSCommand.java b/src/main/java/com/cleanroommc/groovyscript/command/GSCommand.java index 6a69ffaa8..079106247 100644 --- a/src/main/java/com/cleanroommc/groovyscript/command/GSCommand.java +++ b/src/main/java/com/cleanroommc/groovyscript/command/GSCommand.java @@ -61,7 +61,7 @@ public GSCommand() { addSubcommand(new InfoSelfCommand()); addSubcommand(new SimpleCommand("applyDefaultGameRules", (server, sender, args) -> { - VanillaModule.gameRule.setDefaultGameRules(Objects.requireNonNull(server.getServer()).getEntityWorld().getGameRules()); + VanillaModule.gameRule.applyDefaultGameRules(Objects.requireNonNull(server.getServer()).getWorld(0).getGameRules()); sender.sendMessage(new TextComponentString("Applied the default GameRules to the current world.")); })); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java index 2ed232b79..649b96c32 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/MinecraftModContainer.java @@ -25,6 +25,7 @@ public final class MinecraftModContainer extends GroovyContainer }); Set aliasSet = new ObjectOpenHashSet<>(); aliasSet.add("mc"); + aliasSet.add("vanilla"); aliasSet.add(modId); this.aliases = Collections.unmodifiableSet(aliasSet); ModSupport.INSTANCE.registerContainer(this); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Command.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Command.java index 356874bba..62a1004a0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Command.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Command.java @@ -4,6 +4,9 @@ import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IScriptReloadable; +import com.cleanroommc.groovyscript.api.documentation.annotations.Example; +import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; +import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.command.SimpleCommand; import com.cleanroommc.groovyscript.core.mixin.CommandHandlerAccessor; import com.cleanroommc.groovyscript.registry.AbstractReloadableStorage; @@ -20,6 +23,7 @@ import java.util.Set; import java.util.function.Consumer; +@RegistryDescription(category = RegistryDescription.Category.ENTRIES) public class Command extends NamedRegistry implements IScriptReloadable { private final List serverCommands = new ArrayList<>(); @@ -27,6 +31,7 @@ public class Command extends NamedRegistry implements IScriptReloadable { private final AbstractReloadableStorage clientReloadableCommands = new AbstractReloadableStorage<>(); private boolean serverStarted = false; + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.command.registerCommand0") public void registerCommand(ICommand command) { if (GroovyScript.getSandbox().isRunning() && GroovyScript.getSandbox().getCurrentLoader().isReloadable()) { this.serverReloadableCommands.addScripted(command); @@ -38,6 +43,7 @@ public void registerCommand(ICommand command) { } } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.command.registerClientCommand0") public void registerClientCommand(ICommand command) { if (FMLCommonHandler.instance().getSide().isServer()) return; @@ -46,22 +52,27 @@ public void registerClientCommand(ICommand command) { } } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.command.registerCommand1") public void registerCommand(String name, String usage, SimpleCommand.ICommand command) { registerCommand(new SimpleCommand(name, usage, command)); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.command.registerCommand2", example = @Example("'groovy_test', { server, sender, args -> sender.sendMessage('Hello from GroovyScript')}")) public void registerCommand(String name, SimpleCommand.ICommand command) { registerCommand(new SimpleCommand(name, "/" + name, command)); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.command.registerClientCommand1") public void registerClientCommand(String name, String usage, SimpleCommand.ICommand command) { registerClientCommand(new SimpleCommand(name, usage, command)); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.command.registerClientCommand2") public void registerClientCommand(String name, SimpleCommand.ICommand command) { registerClientCommand(new SimpleCommand(name, "/" + name, command)); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.command.registerCommand") public boolean registerCommand(CommandHandler handler, ICommand command) { if (handler.getCommands().containsKey(command.getName())) { GroovyLog.get().error("Error registering command '/{}', because a command with that name already exists", command.getName()); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Crafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Crafting.java index c2f6b5964..3ec077aa8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Crafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Crafting.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; import com.cleanroommc.groovyscript.registry.ReloadableRegistryManager; @@ -15,6 +16,14 @@ import java.util.ArrayList; import java.util.List; +@RegistryDescription(admonition = { + @Admonition(type = Admonition.Type.TIP, value = "groovyscript.wiki.minecraft.crafting.note0"), + @Admonition(type = Admonition.Type.NOTE, value = "groovyscript.wiki.minecraft.crafting.note1"), + @Admonition(type = Admonition.Type.TIP, value = "groovyscript.wiki.minecraft.crafting.note2"), +}, override = @MethodOverride(method = { + @MethodDescription(method = "remove(Lnet/minecraft/util/ResourceLocation;)V", example = @Example("resource('minecraft:stonebrick')")), + @MethodDescription(method = "remove(Ljava/lang/String;)V", example = @Example("'minecraft:mossy_stonebrick'")), +})) public class Crafting extends ForgeRegistryWrapper { private static final Char2ObjectOpenHashMap fallbackChars = new Char2ObjectOpenHashMap<>(); @@ -28,10 +37,12 @@ public static IIngredient getFallback(char c) { return fallbackChars.get(c); } + @MethodDescription(type = MethodDescription.Type.VALUE) public void setFallback(char key, IIngredient ingredient) { fallbackChars.put(key, ingredient); } + @MethodDescription(type = MethodDescription.Type.VALUE) public void setFallback(String key, IIngredient ingredient) { if (key == null || key.length() != 1) { GroovyLog.get().error("Fallback key must be a single character"); @@ -40,6 +51,7 @@ public void setFallback(String key, IIngredient ingredient) { fallbackChars.put(key.charAt(0), ingredient); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShaped0", example = @Example(value = "item('minecraft:gold_block'), [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[null, null, null],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]", commented = true)) public void addShaped(ItemStack output, List> input) { shapedBuilder() .matrix(input) @@ -47,6 +59,7 @@ public void addShaped(ItemStack output, List> input) { .register(); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShaped1", example = @Example(value = "'gold_v_to_clay', item('minecraft:clay'), [[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[null,item('minecraft:gold_ingot'),null]]", commented = true)) public void addShaped(String name, ItemStack output, List> input) { shapedBuilder() .matrix(input) @@ -55,6 +68,7 @@ public void addShaped(String name, ItemStack output, List> inp .register(); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShaped1", example = @Example(value = "resource('example:resource_location'), item('minecraft:clay'), [[item('minecraft:cobblestone')],[item('minecraft:nether_star')],[item('minecraft:cobblestone')]]", commented = true)) public void addShaped(ResourceLocation name, ItemStack output, List> input) { shapedBuilder() .matrix(input) @@ -63,6 +77,7 @@ public void addShaped(ResourceLocation name, ItemStack output, List input) { shapelessBuilder() .input(input) @@ -70,6 +85,7 @@ public void addShapeless(ItemStack output, List input) { .register(); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShapeless1", example = @Example(value = "'precious_to_clay', item('minecraft:clay'), [item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]", commented = true)) public void addShapeless(String name, ItemStack output, List input) { shapelessBuilder() .input(input) @@ -78,6 +94,7 @@ public void addShapeless(String name, ItemStack output, List input) .register(); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShapeless1", example = @Example(value = "resource('example:resource_location2'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]", commented = true)) public void addShapeless(ResourceLocation name, ItemStack output, List input) { shapelessBuilder() .input(input) @@ -86,6 +103,7 @@ public void addShapeless(ResourceLocation name, ItemStack output, List input) { shapelessBuilder() .input(input) @@ -94,6 +112,7 @@ public void replaceShapeless(ItemStack output, List input) { .register(); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShapeless1", example = @Example(value = "'minecraft:pink_dye_from_pink_tulp', item('minecraft:clay'), [item('minecraft:nether_star')]", commented = true)) public void replaceShapeless(String name, ItemStack output, List input) { shapelessBuilder() .input(input) @@ -103,6 +122,7 @@ public void replaceShapeless(String name, ItemStack output, List in .register(); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShapeless1", example = @Example(value = "resource('minecraft:pink_dye_from_peony'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]", commented = true)) public void replaceShapeless(ResourceLocation name, ItemStack output, List input) { shapelessBuilder() .input(input) @@ -112,6 +132,7 @@ public void replaceShapeless(ResourceLocation name, ItemStack output, List> input) { shapedBuilder() .matrix(input) @@ -120,6 +141,7 @@ public void replaceShaped(ItemStack output, List> input) { .register(); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShaped1", example = @Example(value = "'gold_to_diamonds', item('minecraft:diamond') * 8, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]", commented = true)) public void replaceShaped(String name, ItemStack output, List> input) { shapedBuilder() .matrix(input) @@ -129,6 +151,7 @@ public void replaceShaped(String name, ItemStack output, List> .register(); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShaped1", example = @Example(value = "resource('minecraft:sea_lantern'), item('minecraft:clay'), [[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]", commented = true)) public void replaceShaped(ResourceLocation name, ItemStack output, List> input) { shapedBuilder() .matrix(input) @@ -138,6 +161,7 @@ public void replaceShaped(ResourceLocation name, ItemStack output, List item('minecraft:diamond') }))"), + @Example(".output(item('minecraft:clay_ball') * 3).shape('S S', ' G ', 'SWS').key([S: ore('netherStar').reuse(), G: ore('ingotGold'), W: fluid('water') * 1000])"), + @Example(".name('nether_star_duplication_with_tnt').output(item('minecraft:nether_star')).row('!!!').row('!S!').row('!!!').key([S: ore('netherStar').reuse(), '!': item('minecraft:tnt').transform(item('minecraft:diamond'))])"), + @Example(".output(item('minecraft:clay')).row(' B').key('B', item('minecraft:glass_bottle'))"), + @Example(".output(item('minecraft:clay')).row(' ').row(' 0 ').row(' ').key('0', item('minecraft:diamond_sword').withNbt([display:[Name:'Sword with Specific NBT data']]))"), + @Example(".output(item('minecraft:gold_block')).shape([[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[null, null, null],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]])"), + @Example(".name('gold_v_to_clay').output(item('minecraft:clay')).shape([[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[null,item('minecraft:stone_pickaxe').transformDamage(2).whenAnyDamage(),null]])"), + @Example(".name(resource('example:resource_location')).output(item('minecraft:clay')).shape([[item('minecraft:cobblestone')],[item('minecraft:nether_star')],[item('minecraft:cobblestone')]])"), + @Example(".output(item('minecraft:chest')).shape([[ore('logWood'),ore('logWood'),ore('logWood')],[ore('logWood'),null,ore('logWood')],[ore('logWood'),ore('logWood'),ore('logWood')]]).replace()"), + @Example(".name('gold_to_diamonds').output(item('minecraft:diamond') * 8).shape([[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]).replaceByName()"), + @Example(".name(resource('minecraft:sea_lantern')).output(item('minecraft:clay')).shape([[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]).replaceByName()"), + }) public CraftingRecipeBuilder.Shaped shapedBuilder() { return new CraftingRecipeBuilder.Shaped(); } + @RecipeBuilderDescription(example = { + @Example(".output(item('minecraft:clay')).input([item('minecraft:cobblestone'),item('minecraft:nether_star'),item('minecraft:gold_ingot')])"), + @Example(".name('precious_to_clay').output(item('minecraft:clay')).input([item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')])"), + @Example(".name(resource('example:resource_location2')).output(item('minecraft:clay')).input([item('minecraft:cobblestone'), item('minecraft:gold_ingot')])"), + @Example(".output(item('minecraft:ender_eye')).input([item('minecraft:ender_pearl'),item('minecraft:nether_star')]).replace()"), + @Example(".name('minecraft:pink_dye_from_pink_tulp').output(item('minecraft:clay')).input([item('minecraft:nether_star')]).replaceByName()"), + @Example(".name(resource('minecraft:pink_dye_from_peony')).output(item('minecraft:clay')).input([item('minecraft:cobblestone'), item('minecraft:gold_ingot')]).replaceByName()"), + }) public CraftingRecipeBuilder.Shapeless shapelessBuilder() { return new CraftingRecipeBuilder.Shapeless(); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Furnace.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Furnace.java index 347f5d925..f452d288d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Furnace.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Furnace.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; import com.cleanroommc.groovyscript.helper.SimpleObjectStream; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; @@ -15,16 +16,20 @@ import java.util.List; import java.util.Map; +@RegistryDescription public class Furnace extends VirtualizedRegistry { + @RecipeBuilderDescription(example = @Example(".input(ore('ingotGold')).output(item('minecraft:nether_star')).exp(0.5)")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.furnace.add0", example = @Example(value = "ore('ingotIron'), item('minecraft:diamond')", commented = true)) public void add(IIngredient input, ItemStack output) { add(input, output, 0.1f); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.furnace.add1", example = @Example("item('minecraft:nether_star'), item('minecraft:clay') * 64, 13")) public void add(IIngredient input, ItemStack output, float exp) { if (GroovyLog.msg("Error adding Minecraft Furnace recipe") .add(IngredientHelper.isEmpty(input), () -> "Input must not be empty") @@ -64,6 +69,7 @@ private ItemStack findTrueInput(ItemStack input) { return trueInput; } + @MethodDescription(example = @Example("item('minecraft:clay')")) public boolean removeByInput(ItemStack input) { return removeByInput(input, true); } @@ -112,6 +118,7 @@ public boolean removeByInput(ItemStack input, boolean log, boolean isScripted) { return false; } + @MethodDescription(example = @Example("item('minecraft:brick')")) public boolean removeByOutput(IIngredient output) { return removeByOutput(output, true); } @@ -158,6 +165,7 @@ public boolean removeByOutput(IIngredient output, boolean log, boolean isScripte return true; } + @MethodDescription(type = MethodDescription.Type.QUERY) public SimpleObjectStream streamRecipes() { List recipes = new ArrayList<>(); for (Map.Entry entry : FurnaceRecipes.instance().getSmeltingList().entrySet()) { @@ -167,6 +175,7 @@ public SimpleObjectStream streamRecipes() { return new SimpleObjectStream<>(recipes, false).setRemover(recipe -> remove(recipe, true)); } + @MethodDescription(priority = 2000, example = @Example(commented = true)) public void removeAll() { FurnaceRecipes.instance().getSmeltingList().entrySet().removeIf(entry -> { float exp = FurnaceRecipes.instance().getSmeltingExperience(entry.getValue()); @@ -183,24 +192,14 @@ public void onReload() { getBackupRecipes().forEach(recipe -> FurnaceRecipes.instance().addSmeltingRecipe(recipe.input, recipe.output, recipe.exp)); } + @Property(property = "input", comp = @Comp(eq = 1)) + @Property(property = "output", comp = @Comp(eq = 1)) public static class RecipeBuilder extends AbstractRecipeBuilder { - private IIngredient input; - private ItemStack output; + @Property(comp = @Comp(gte = 0)) private float exp = 0.1f; - @Override - public RecipeBuilder input(IIngredient input) { - this.input = input; - return this; - } - - @Override - public RecipeBuilder output(ItemStack output) { - this.output = output; - return this; - } - + @RecipeBuilderMethodDescription public RecipeBuilder exp(float exp) { this.exp = exp; return this; @@ -213,19 +212,20 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { - msg.add(IngredientHelper.isEmpty(input), () -> "Input must not be empty"); - msg.add(IngredientHelper.isEmpty(output), () -> "Output must not be empty"); + validateItems(msg, 1, 1, 1, 1); + validateFluids(msg); if (exp < 0) { exp = 0.1f; } } @Override + @RecipeBuilderRegistrationMethod public @Nullable Recipe register() { if (!validate()) return null; Recipe recipe = null; - for (ItemStack itemStack : input.getMatchingStacks()) { - recipe = new Recipe(itemStack, output, exp); + for (ItemStack itemStack : input.get(0).getMatchingStacks()) { + recipe = new Recipe(itemStack, output.get(0), exp); VanillaModule.furnace.add(recipe); } return recipe; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/GameRule.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/GameRule.java index 3b02fe6c2..982380b2b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/GameRule.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/GameRule.java @@ -3,13 +3,17 @@ import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IScriptReloadable; +import com.cleanroommc.groovyscript.api.documentation.annotations.Admonition; +import com.cleanroommc.groovyscript.api.documentation.annotations.Example; import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; +import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.registry.NamedRegistry; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.minecraft.world.GameRules; import java.util.Map; +@RegistryDescription(category = RegistryDescription.Category.ENTRIES, admonition= @Admonition(value = "groovyscript.wiki.minecraft.game_rule.note", type = Admonition.Type.WARNING)) public class GameRule extends NamedRegistry implements IScriptReloadable { private static final String LOG_MESSAGE = "Could not find an already existing rule with the name {}. This may be intentional! If it is, you can disable this via `gameRule.setWarnNewGameRule(false)`"; @@ -17,7 +21,7 @@ public class GameRule extends NamedRegistry implements IScriptReloadable { private boolean warnNewGameRule; @GroovyBlacklist - public void setDefaultGameRules(GameRules gameRules) { + public void applyDefaultGameRules(GameRules gameRules) { defaultGameRules.forEach((k, v) -> { if (warnNewGameRule && !gameRules.hasRule(k)) GroovyLog.get().warn(LOG_MESSAGE, k); GroovyLog.get().debug("Setting the GameRule '{}' to the value '{}'", k, v); @@ -26,17 +30,17 @@ public void setDefaultGameRules(GameRules gameRules) { GroovyLog.get().debug("Set or created {} GameRules", defaultGameRules.size()); } - @MethodDescription + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'doDaylightCycle', 'false'")) public void add(String gameRule, String value) { defaultGameRules.put(gameRule, value); } - @MethodDescription + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.game_rule.addMap", example = @Example("['mobGriefing': 'false', 'keepInventory': 'true']")) public void add(Map gameRules) { defaultGameRules.putAll(gameRules); } - @MethodDescription + @MethodDescription(type = MethodDescription.Type.VALUE, example = @Example("true")) public void setWarnNewGameRule(boolean value) { warnNewGameRule = value; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/OreDict.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/OreDict.java index fbb045e28..189f5cbea 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/OreDict.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/OreDict.java @@ -2,6 +2,9 @@ import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.documentation.annotations.Example; +import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; +import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.core.mixin.OreDictionaryAccessor; import com.cleanroommc.groovyscript.helper.Alias; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; @@ -16,6 +19,7 @@ import java.util.ArrayList; import java.util.List; +@RegistryDescription(category = RegistryDescription.Category.ENTRIES) public class OreDict extends VirtualizedRegistry { public OreDict() { @@ -30,14 +34,20 @@ public void onReload() { restoreFromBackup().forEach(entry -> OreDictionary.registerOre(entry.name, entry.stack)); } + @MethodDescription(type = MethodDescription.Type.ADDITION) public void add(String name, Item item) { add(name, new ItemStack(item)); } + @MethodDescription(type = MethodDescription.Type.ADDITION) public void add(String name, Block block) { add(name, new ItemStack(block)); } + @MethodDescription(type = MethodDescription.Type.ADDITION, example = { + @Example("'ingotGold', item('minecraft:nether_star')"), + @Example("'netherStar', item('minecraft:gold_ingot')") + }) public void add(String name, ItemStack stack) { if (GroovyLog.msg("Error adding ore dictionary entry") .add(StringUtils.isEmpty(name), () -> "Name must not be empty") @@ -55,6 +65,7 @@ public void add(OreDictEntry entry) { OreDictionary.registerOre(entry.name, entry.stack); } + @MethodDescription(type = MethodDescription.Type.QUERY) public List getItems(String name) { return new ArrayList<>(OreDictionary.getOres(name, false)); } @@ -64,6 +75,7 @@ public List getAt(String name) { return getItems(name); } + @MethodDescription(type = MethodDescription.Type.QUERY) public boolean exists(String name) { return OreDictionary.doesOreNameExist(name); } @@ -73,6 +85,7 @@ public boolean isCase(String name) { return OreDictionary.doesOreNameExist(name); } + @MethodDescription(example = @Example("'netherStar', item('minecraft:nether_star')")) public boolean remove(String name, ItemStack stack) { if (GroovyLog.msg("Error removing ore dictionary entry") .add(StringUtils.isEmpty(name), () -> "Name must not be empty") @@ -111,10 +124,12 @@ private boolean remove(String oreDict, ItemStack ore, boolean scripted) { return false; } + @MethodDescription(example = @Example(value = "'plankWood'", commented = true)) public boolean clear(String name) { return removeAll(name); } + @MethodDescription(example = @Example(value = "'ingotIron'", commented = true), description = "groovyscript.wiki.minecraft.ore_dict.clear") public boolean removeAll(String name) { List list = getItems(name); if (GroovyLog.msg("Error removing from OreDictionary entry") @@ -127,6 +142,7 @@ public boolean removeAll(String name) { return true; } + @MethodDescription(priority = 2000, example = @Example(commented = true)) public void removeAll() { for (String name : OreDictionary.getOreNames()) { for (ItemStack stack : getItems(name)) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Player.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Player.java index 4b7d89f60..e8dcc1ecd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Player.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Player.java @@ -3,6 +3,10 @@ import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IScriptReloadable; +import com.cleanroommc.groovyscript.api.documentation.annotations.Admonition; +import com.cleanroommc.groovyscript.api.documentation.annotations.Example; +import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; +import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.registry.NamedRegistry; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import net.minecraft.entity.player.InventoryPlayer; @@ -11,16 +15,17 @@ import java.util.*; import java.util.stream.Collectors; +@RegistryDescription(category = RegistryDescription.Category.ENTRIES, admonition = { + @Admonition(type = Admonition.Type.WARNING, value = "groovyscript.wiki.minecraft.player.note0"), + @Admonition(type = Admonition.Type.TIP, value = "groovyscript.wiki.minecraft.player.note1") +}) public class Player extends NamedRegistry implements IScriptReloadable { public static final String GIVEN_ITEMS = "GroovyScript:GivenItems"; - - public boolean testingStartingItems; - public boolean replaceDefaultInventory; - private final List givenItemsAnySlot = new ArrayList<>(); - private final Map givenItemsSlots = new Int2ObjectOpenHashMap<>(); + private boolean testingStartingItems; + private boolean replaceDefaultInventory; @GroovyBlacklist public void addToInventory(InventoryPlayer playerInv) { @@ -42,10 +47,18 @@ public void addToInventory(InventoryPlayer playerInv) { givenItemsAnySlot.stream().map(ItemStack::copy).forEach(playerInv::addItemStackToInventory); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.player.addStartingItem0", example = { + @Example("item('minecraft:clay_ball')"), + @Example("item('minecraft:gold_ingot')"), + @Example("item('minecraft:diamond')"), + @Example("item('minecraft:nether_star')"), + @Example("item('minecraft:water_bucket')"), + }) public void addStartingItem(ItemStack item) { this.addStartingItem(item, -1); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.player.addStartingItem1") public void addStartingItem(ItemStack item, int slot) { if (slot > 41) { GroovyLog.msg("Warning: assigning items to a player's inventory slot greater than 41 may cause some items to not be received by the player.") @@ -65,6 +78,7 @@ public void addStartingItem(ItemStack item, int slot) { } } + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("true, item('minecraft:clay').withNbt([display:[Name:'Hotbar']]), null, null, null, null, null, null, null, null, item('minecraft:clay').withNbt([display:[Name:'Top row of inventory']]), null, null, null, null, null, null, null, null, item('minecraft:clay').withNbt([display:[Name:'Middle row of inventory']]), null, null, null, null, null, null, null, null, item('minecraft:clay').withNbt([display:[Name:'Bottom row of inventory']]), null, null, null, null, null, null, null, null, item('minecraft:diamond_boots'), item('minecraft:diamond_leggings'), item('minecraft:diamond_chestplate'), item('minecraft:diamond_helmet'), item('minecraft:clay').withNbt([display:[Name:'Offhand']])")) public void setStartingItems(boolean isSlotSpecific, ItemStack... items) { if (items.length > 41) { GroovyLog.msg("Warning: assigning items to a player's inventory slot greater than 41 may cause some items to not be received by the player.") @@ -82,6 +96,7 @@ public void setStartingItems(boolean isSlotSpecific, ItemStack... items) { } } + @MethodDescription(type = MethodDescription.Type.ADDITION) public void setStartingItems(boolean isSlotSpecific, List items) { if (items.size() > 41) { GroovyLog.msg("Warning: assigning items to a player's inventory slot greater than 41 may cause some items to not be received by the player.") @@ -99,6 +114,21 @@ public void setStartingItems(boolean isSlotSpecific, List items) { } } + @MethodDescription(type = MethodDescription.Type.VALUE, example = @Example("true")) + public void setTestStartingItems(boolean value) { + testingStartingItems = value; + } + + @MethodDescription(type = MethodDescription.Type.VALUE, example = @Example("true")) + public void setReplaceDefaultInventory(boolean value) { + replaceDefaultInventory = value; + } + + @GroovyBlacklist + public boolean isTestingStartingItems() { + return testingStartingItems; + } + @Override @GroovyBlacklist public void onReload() { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Rarity.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Rarity.java index 56bb83e74..0674539c5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Rarity.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Rarity.java @@ -2,6 +2,10 @@ import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.documentation.annotations.Admonition; +import com.cleanroommc.groovyscript.api.documentation.annotations.Example; +import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; +import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.registry.NamedRegistry; import com.cleanroommc.groovyscript.sandbox.ClosureHelper; import com.cleanroommc.groovyscript.sandbox.expand.LambdaClosure; @@ -17,6 +21,7 @@ import java.util.List; import java.util.function.Predicate; +@RegistryDescription(category = RegistryDescription.Category.ENTRIES, admonition = @Admonition(value = "groovyscript.wiki.minecraft.rarity.note", type = Admonition.Type.INFO)) public class Rarity extends NamedRegistry { private final List, IRarity>> rarities = new ArrayList<>(); @@ -30,26 +35,34 @@ public IRarity check(ItemStack testStack) { return testStack.getItem().getRarity(testStack); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.rarity.set0", example = { + @Example("textformat('RESET'), item('minecraft:enchanted_book')"), @Example("textformat('AQUA'), item('minecraft:diamond')") + }) public void set(TextFormatting color, ItemStack stack) { set(color, getAppropriateRarityName(color), stack); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.rarity.set1") public void set(TextFormatting color, String rarityName, ItemStack stack) { set(new RarityImpl(color, rarityName), stack); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.rarity.set2") public void set(IRarity rarity, ItemStack stack) { set(rarity, new LambdaClosure<>(this, arr -> ((Predicate) (Object) stack).test((ItemStack) arr[0]))); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.rarity.set0") public void set(TextFormatting color, Closure predicate) { set(color, getAppropriateRarityName(color), predicate); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.rarity.set1") public void set(TextFormatting color, String rarityName, Closure predicate) { set(new RarityImpl(color, rarityName), predicate); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.rarity.set2") public void set(IRarity rarity, Closure predicate) { if (GroovyLog.msg("Error setting Item Rarity") .add(rarity == null, () -> "Rarity must not be null") diff --git a/src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java b/src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java index 89b4815b1..0f002928e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java +++ b/src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java @@ -33,6 +33,7 @@ import net.minecraftforge.client.event.GuiOpenEvent; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.client.event.TextureStitchEvent; +import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.config.Config; import net.minecraftforge.common.config.ConfigManager; import net.minecraftforge.event.RegistryEvent; @@ -81,7 +82,9 @@ public static void registerTextures(TextureStitchEvent.Post event) { @SubscribeEvent public static void createSpawnPosition(WorldEvent.CreateSpawnPosition event) { - VanillaModule.gameRule.setDefaultGameRules(event.getWorld().getGameRules()); + // only want to execute this for the overworld + var target = DimensionManager.getWorld(0); + if (event.getWorld() == target) VanillaModule.gameRule.applyDefaultGameRules(event.getWorld().getGameRules()); } @SubscribeEvent @@ -110,7 +113,7 @@ public static void playerLogin(PlayerEvent.PlayerLoggedInEvent event) { if (tag.hasKey(EntityPlayer.PERSISTED_NBT_TAG)) { data = tag.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); } - if (VanillaModule.player.testingStartingItems || !data.getBoolean(Player.GIVEN_ITEMS)) { + if (VanillaModule.player.isTestingStartingItems() || !data.getBoolean(Player.GIVEN_ITEMS)) { VanillaModule.player.addToInventory(event.player.inventory); data.setBoolean(Player.GIVEN_ITEMS, true); tag.setTag(EntityPlayer.PERSISTED_NBT_TAG, data); diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/ForgeRegistryWrapper.java b/src/main/java/com/cleanroommc/groovyscript/registry/ForgeRegistryWrapper.java index b3c0ddc39..3fa6b1def 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/ForgeRegistryWrapper.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/ForgeRegistryWrapper.java @@ -53,22 +53,26 @@ public final void onReload() { @Override public void afterScriptLoad() {} + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.forgewrapper.add") public void add(T entry) { if (entry != null) { ReloadableRegistryManager.addRegistryEntry(this.registry, entry); } } + @MethodDescription(description = "groovyscript.wiki.forgewrapper.removeResource") public void remove(ResourceLocation loc) { Objects.requireNonNull(loc); ReloadableRegistryManager.removeRegistryEntry(this.registry, loc); } + @MethodDescription(description = "groovyscript.wiki.forgewrapper.removeString") public void remove(String loc) { Objects.requireNonNull(loc); ReloadableRegistryManager.removeRegistryEntry(this.registry, loc); } + @MethodDescription(description = "groovyscript.wiki.forgewrapper.remove") public boolean remove(T recipe) { if (recipe == null) return false; remove(recipe.getRegistryName()); diff --git a/src/main/resources/assets/groovyscript/lang/en_us.lang b/src/main/resources/assets/groovyscript/lang/en_us.lang index 1cfc05db5..a26101856 100644 --- a/src/main/resources/assets/groovyscript/lang/en_us.lang +++ b/src/main/resources/assets/groovyscript/lang/en_us.lang @@ -96,11 +96,16 @@ groovyscript.wiki.recipe_builder.description=Create the Recipe Builder groovyscript.wiki.recipe_builder.register=First validates the builder, outputting errors to the log file if the validation failed, then registers the builder. groovyscript.wiki.recipe_builder.register_return=First validates the builder, returning `null` and outputting errors to the log file if the validation failed, then registers the builder and returns the registered object. (returns `null` or `%s`). +groovyscript.wiki.forgewrapper.add=Adds the recipe +groovyscript.wiki.forgewrapper.remove=Removes the recipe +groovyscript.wiki.forgewrapper.removeResource=Removes the recipe with the given Resource Location +groovyscript.wiki.forgewrapper.removeString=Removes the recipe with the given String as its Resource Location + groovyscript.wiki.craftingrecipe.matrix.required=either the key-based matrix or the ingredient-based matrix can be defined, not both groovyscript.wiki.craftingrecipe.output.value=Sets the item output groovyscript.wiki.craftingrecipe.recipeFunction.value=Sets an operation that modifies the input items or output item groovyscript.wiki.craftingrecipe.recipeAction.value=Sets an operation that happens when the recipe is crafted -groovyscript.wiki.craftingrecipe.replace.value=Sets if the recipe is removed. A value of 1 removes by the output, and a value of 2 removes by the resource location +groovyscript.wiki.craftingrecipe.replace.value=Sets if the recipe is removed. The `replace` method removes by the output itemstack, and the `replaceByName` method removes by the Resource Location groovyscript.wiki.craftingrecipe.mirrored.value=Sets if the recipe is horizontally mirrored groovyscript.wiki.craftingrecipe.keyBasedMatrix.value=Sets the items required in each slot of the grid as char groovyscript.wiki.craftingrecipe.keyMap.value=Sets the item the given char corresponds to @@ -125,6 +130,73 @@ groovyscript.wiki.not=not %s groovyscript.wiki.unique=%s groovyscript.wiki.and=and + +# Vanilla Minecraft +groovyscript.wiki.minecraft.crafting.title=Crafting Table +groovyscript.wiki.minecraft.crafting.description=A normal crafting recipe that takes place in the Vanilla Crafting Table, converting up to 9 items in a shapeless or specific shaped arrangement into an output itemstack. +groovyscript.wiki.minecraft.crafting.note0=While shorthand methods to create recipes have been supplied, it is far easier to use the recipe builder. +groovyscript.wiki.minecraft.crafting.note1=Fallback keys are global and apply to all classes using the matrix feature of `AbstractCraftingRecipeBuilder`. +groovyscript.wiki.minecraft.crafting.note2=You can view recipe names in JEI/HEI by hovering over the output with `F3+h` mode enabled. +groovyscript.wiki.minecraft.crafting.setFallback=Set the fallback character for matrices. This fallback is used when the recipe is created via matrix and the given key is not included as a key in the specific recipe builder +groovyscript.wiki.minecraft.crafting.addShaped0=Adds a shaped recipe in the format `output`, `input` +groovyscript.wiki.minecraft.crafting.addShaped1=Adds a shaped recipe in the format `name`, `output`, `input` +groovyscript.wiki.minecraft.crafting.addShapeless0=Adds a shapeless recipe in the format `output`, `input` +groovyscript.wiki.minecraft.crafting.addShapeless1=Adds a shapeless recipe in the format `name`, `output`, `input` +groovyscript.wiki.minecraft.crafting.replaceShaped0=Adds a shaped recipe in the format `output`, `input` and removes the recipe matching the given output +groovyscript.wiki.minecraft.crafting.replaceShaped1=Adds a shaped recipe in the format `name`, `output`, `input` and removes the recipe matching the given name +groovyscript.wiki.minecraft.crafting.replaceShapeless0=Adds a shapeless recipe in the format `output`, `input` and removes the recipe matching the given output +groovyscript.wiki.minecraft.crafting.replaceShapeless1=Adds a shapeless recipe in the format `name`, `output`, `input` and removes the recipe matching the given name + +groovyscript.wiki.minecraft.furnace.title=Furnace +groovyscript.wiki.minecraft.furnace.description=Converts an input item into an output itemstack after a set amount of time, with the ability to give experience and using fuel to run. +groovyscript.wiki.minecraft.furnace.add0=Adds a recipe in the format `input`, `output` +groovyscript.wiki.minecraft.furnace.add1=Adds a recipe in the format `input`, `output`, `experience` +groovyscript.wiki.minecraft.furnace.exp.value=Sets the experience rewarded for smelting the given input + +groovyscript.wiki.minecraft.ore_dict.title=Ore Dictionary +groovyscript.wiki.minecraft.ore_dict.description=Manipulate the Ore Dictionary and what itemstacks are part of what oredicts. +groovyscript.wiki.minecraft.ore_dict.add=Adds the given itemstack to the given oredict +groovyscript.wiki.minecraft.ore_dict.remove=Removes the given itemstack from the given oredict +groovyscript.wiki.minecraft.ore_dict.clear=Removes all itemstacks from the given oredict +groovyscript.wiki.minecraft.ore_dict.exists=Returns true if the given oredict exists, although this does not check if the oredict contains entries +groovyscript.wiki.minecraft.ore_dict.getItems=Returns a list of all itemstacks in the given oredict +groovyscript.wiki.minecraft.ore_dict.removeAll=Removes all itemstacks from all oredicts + +groovyscript.wiki.minecraft.player.title=Starting Inventory +groovyscript.wiki.minecraft.player.description=Sets the starting inventory of the player, including armor slots and offhand. +groovyscript.wiki.minecraft.player.note0=No more than a total of 41 items can be inserted into the inventory. +groovyscript.wiki.minecraft.player.note1=When testing the Starting Inventory items, use `setTestStartingItems(true)` to allow testing every time a player logs in instead of just the first. +groovyscript.wiki.minecraft.player.addStartingItem0=Adds the given itemstack to the inventory list +groovyscript.wiki.minecraft.player.addStartingItem1=Adds the given itemstack to a specific slot in the inventory list in the format `itemstack`, `slot` +groovyscript.wiki.minecraft.player.setStartingItems=Removes all previously added inputs and sets the starting inventory in the format `isSlotSpecific`, `items` +groovyscript.wiki.minecraft.player.setTestStartingItems=Sets if items given when joining the world regardless of if the flag has already been set +groovyscript.wiki.minecraft.player.setReplaceDefaultInventory=Sets if the player inventory is cleared prior to giving the player these items + +groovyscript.wiki.minecraft.rarity.title=Rarity +groovyscript.wiki.minecraft.rarity.description=Control the rarity of the item, which typically is the name color, to any standard Rarity or any TextFormatting code. +groovyscript.wiki.minecraft.rarity.note=The default rarities are Common (White), Uncommon (Yellow), Rare (Aqua), and Epic (Light Purple) +groovyscript.wiki.minecraft.rarity.set0=Sets the color of the given itemstack in the format `color`, `item` +groovyscript.wiki.minecraft.rarity.set1=Sets the color of the given itemstack in the format `color`, `rarityName`, `item` +groovyscript.wiki.minecraft.rarity.set2=Sets the color of the given itemstack in the format `rarity`, `item` + +groovyscript.wiki.minecraft.command.title=Custom Commands +groovyscript.wiki.minecraft.command.description=Create custom commands, either generally or specifically for the client. +groovyscript.wiki.minecraft.command.registerClientCommand0=Registers the given command to the client +groovyscript.wiki.minecraft.command.registerClientCommand1=Registers the given command to the client in the format `name`, `usage`, `command`, with `command` being a Closure taking 3 parameters, `MinecraftServer server`, `ICommandSender sender`, and `String... args` +groovyscript.wiki.minecraft.command.registerClientCommand2=Registers the given command to the client in the format `name`, `command`, with `command` being a Closure taking 3 parameters, `MinecraftServer server`, `ICommandSender sender`, and `String... args` +groovyscript.wiki.minecraft.command.registerCommand0=Registers the given command +groovyscript.wiki.minecraft.command.registerCommand1=Registers the given command in the format `name`, `usage`, `command`, with `command` being a Closure taking 3 parameters, `MinecraftServer server`, `ICommandSender sender`, and `String... args` +groovyscript.wiki.minecraft.command.registerCommand2=Registers the given command in the format `name`, `command`, with `command` being a Closure taking 3 parameters, `MinecraftServer server`, `ICommandSender sender`, and `String... args` +groovyscript.wiki.minecraft.command.registerCommand=Registers the given command to the given command handler, in the format `handler`, `command` + +groovyscript.wiki.minecraft.game_rule.title=Default GameRules +groovyscript.wiki.minecraft.game_rule.description=Create or assign a default value to GameRules. +groovyscript.wiki.minecraft.game_rule.note=GameRules are case-sensitive! Enable logging of new GameRules via `setWarnNewGameRule` to ensure you are modifying an existing GameRule and not creating a new and unused one! +groovyscript.wiki.minecraft.game_rule.setWarnNewGameRule=Sets if creating new GameRules logs a warning. Enable it if you need to check spelling/capitalization. Disabled by default +groovyscript.wiki.minecraft.game_rule.add=Adds a new entry in the format `name`, `value`, with `value` being a String that can represent a number (`-1`, `5`) or boolean (`true`, `false`) +groovyscript.wiki.minecraft.game_rule.addMap=Adds a map of GameRule name to values + + # Actually Additions groovyscript.wiki.actuallyadditions.atomic_reconstructor.title=Atomic Reconstructor groovyscript.wiki.actuallyadditions.atomic_reconstructor.description=The Atomic Reconstructor is a block which uses energy to convert a block or item in front of it into other items.