Skip to content

Examples

Piggo41 edited this page Oct 16, 2026 · 29 revisions

Example scripts

Home / Examples

The linked examples correspond to the API documented by this wiki. Copy selected loose scripts or complete manifested example folders into .minecraft/betamoon/scripts, and preserve required asset folders. Select free content IDs when examples overlap other mods.

The example README includes crafting recipes, interactive instructions and dependency details. Individual API pages link directly to relevant lessons.

Beginner

Beginner lessons introduce one concept at a time and establish the vocabulary used by later examples.

Lesson File Topic
01 01_beg_01_base.lua Script metadata and lifecycle hook signatures
02 01_beg_02_multifile_mod Minimal manifest, entrypoint, and private-module structure
03 01_beg_03_simple_block.lua Registering a block
04 01_beg_04_simple_item.lua Registering an item
05 01_beg_05_resource_references.lua Optional/required lookup, references, and stacks
06 01_beg_06_block_query.lua Finding registered blocks and reading result lists
07 01_beg_07_item_query.lua Finding items, tools, and armor
08 01_beg_08_simple_override.lua Changing one property of an existing resource
09 01_beg_09_textures.lua Custom block and item textures
10 01_beg_10_registered_texture.lua Reusable registered PNG for a block and item
11 01_beg_11_animated_texture.lua Animated version of a shared block and item texture
12 01_beg_12_food.lua Food properties
13 01_beg_13_drops.lua Custom block drops
14 01_beg_14_vanilla_recipes.lua Shaped, shapeless, and smelting recipes
15 01_beg_15_tool.lua Tool materials and tool types
16 01_beg_16_armor.lua Armor materials, pieces, and textures
17 01_beg_17_utilities.lua Stack and position utilities
18 01_beg_18_chat.lua Chat output and formatting
19 01_beg_19_projectile.lua Projectile ammunition and cooldowns
20 01_beg_20_ore_generation.lua Ore generation in new chunks
21a–21b 01_beg_21a_module_export.lua, 01_beg_21b_module_import.lua Sharing an exported table between scripts
22 01_beg_22_item_subtypes.lua Metadata subtypes and render variants
23 01_beg_23_builtin_model_item.lua Built-in slab model on an item
24 01_beg_24_biome_from_default.lua Adapting a vanilla biome
25 01_beg_25_first_event.lua Responding to one global game event
26 01_beg_26_first_block_interaction.lua Handling a block activation
27 01_beg_27_first_item_use.lua Handling a consumable item's right-click action
28 01_beg_28_click_sound.lua Registered WAV and local playback from item use
29 01_beg_29_custom_fuel.lua Registering an item as vanilla furnace fuel
30 01_beg_30_simple_feature_placement.lua Separating a reusable feature from its scheduled placement
31 01_beg_31_simple_tree_placement.lua Scheduling a vanilla-adapter tree with surface conditions

Intermediate

Intermediate lessons combine declarations with searches, callbacks, saved block state, physical behavior, and event-driven logic.

Lesson File Topic
01 02_int_01_recipe_query.lua Querying and temporarily changing recipes
02 02_int_02_overrides.lua Direct, conditional, prioritized, and bulk overrides
03 02_int_03_display_overrides.lua Extending a vanilla display tick with ctx:base()
04 02_int_04_hot_reload_lifecycle.lua Script generations and explicit cleanup
05 02_int_05_biome_from_scratch.lua Declaring a biome from scratch
06 02_int_06_events.lua Global events and typed event contexts
07 02_int_07_input_shortcuts.lua Practical keyboard, mouse, and screen events
08 02_int_08_block_interactions.lua Activation, saved state, mining permission, and queried drops
09 02_int_09_attached_blocks.lua Floor, wall, and ceiling support
10 02_int_10_block_lifecycle.lua Placement queries and lifecycle callbacks
11 02_int_11_item_interactions.lua Item use, consumption, cooldowns, and inventory callbacks
12 02_int_12_blockbench_model_item.lua Bedrock JSON model, texture, named parts, and item displays
13 02_int_13_targeted_item_actions.lua Direct block/entity targets and explicit ray tracing
14 02_int_14_tool_interactions.lua Wrench actions, orientation, and multiple tool classes
15 02_int_15_dynamic_tool_callbacks.lua Per-block harvesting and mining-speed queries
16 02_int_16_block_shapes.lua Collision, selection, drawing bounds, and climbing
17 02_int_17_facing_model_block.lua One built-in stair model rotated by placement state
18 02_int_18_launch_pad.lua Player filtering and motion-preserving launch behavior
19 02_int_19_special_blocks.lua Replaceable, translucent, luminous, and unbreakable blocks
20 02_int_20_custom_fluid.lua Paired fluid blocks, animated appearance, a bucket, and entity/camera policies
21 02_int_21_random_and_continuous_ticks.lua Default and vanilla random block ticks
22 02_int_22_scheduled_and_display_ticks.lua Scheduled gameplay ticks and client display ticks
23 02_int_23_redstone_switch.lua Directional digital redstone output
24 02_int_24_first_entity.lua Model-backed prop declaration and spawning from an item
25 02_int_25_custom_projectile.lua Model-backed projectile fired from an item with ammunition and cooldown
26 02_int_26_pickup_entity.lua Dropped-item pickup with a once-only collection callback
27 02_int_27_configurable_explosion.lua Selective explosion effects, attribution, and result snapshots
28 02_int_28_direct_feature_placement.lua Previewing and atomically placing a feature from an item callback
29 02_int_29_composite_and_ordered_features.lua Weighted/sequence features and explicit placement dependencies
30 02_int_30_named_actions_controller.lua Named actions, configurable controls, and staged player movement
31 02_int_31_custom_particles.lua PNG particles in a ring around a custom block; copy its custom_particles asset folder

Advanced

Advanced lessons build complete systems. Lessons 03, 08 through 11, and 18 through 22 are packaged mods that preserve private files and gameplay assets together.

Lesson File Topic
01 03_adv_01_animated_model_item.lua Animation JSON combined with Lua pose control
02 03_adv_02_redstone_timer.lua Input-edge observation and scheduled output pulses
03 03_adv_03_basic_storage Private data and layout modules combined into saved storage, a container, and a GUI
04 03_adv_04_custom_furnace.lua A complete smelting machine with a composed private fuel set
05 03_adv_05_tile_redstone_controller.lua Persistent tile data controlling redstone output
06 03_adv_06_visual_portal.lua Controllerless frame with item activation and pass-through animated panels
07 03_adv_07_gui_showcase.lua Container GUI elements, interactive controls, session state, and synchronized presentation
08 03_adv_08_animated_machine.lua Animated block variants, material slots, glow, and sound
09 03_adv_09_simple_alloy Simple named-slot recipe types, recipes, and a processing machine
10 03_adv_10_contextual_processor Heat/power conditions and commit-time context revalidation
11 03_adv_11_advanced_fabrication Pools, grids, custom matching, bindings, and atomic processing
12 03_adv_12_charcoal_kiln.lua Brick multiblock, fuel-free charcoal, flame progress and invalid-structure warning
13 03_adv_13_matcher_cookbook A context-driven custom allocation policy in a working machine
14 03_adv_14_entity_data.lua Model-backed entity with persistent interaction data
15 03_adv_15_native_living_ai.lua Living health, predefined wandering, targeting, and retaliation
16 03_adv_16_manual_multipart_ai.lua Manual Lua AI and optional named part hitboxes
17 03_adv_17_energy_network.lua GUI-guided nearest-first energy flow, bounded rates, endpoint consumers, battery storage, and adjacent cable grids
18 03_adv_18_wireless_trigger.lua Editable wireless channels, roles, state, and rising-edge pulses
19 03_adv_19_world_service_and_data.lua Persistent world service and bounded world data views
20 03_adv_20_local_structure Packaged local JSON structure with a rounded stepped foundation, deterministic loot, placement, and lookup
21 03_adv_21_regional_structures Regional assembly with bounded/authored foundations, selector-conforming roads, and non-loading lookup
22 03_adv_22_complete_worldgen_pack Modular worldgen pack whose fitted stone circle deliberately performs no terrain mutation
23 03_adv_23_sunken_cellar Minimal footprint-to-surface excavation for a negatively offset cellar
24 03_adv_24_excavated_foundation Exact clearance voxels, a named 3D excavation mask, and an authored foundation footprint

Trying the multiblocks

Visual Portal: craft obsidian with redstone for Visual Portal Frame blocks. Build the entire four-wide, five-high frame from them, leaving a two-wide, three-high opening. No special controller position or facing is needed. Corners are optional. Use flint and steel against an inner frame face. The animated surface is pass-through and never teleports.

Charcoal Kiln: craft a furnace surrounded by brick blocks, then use the exact kiln pattern. Insert any vanilla log to produce charcoal without fuel. The flame shows processing progress; hover the warning triangle for structure guidance. Both examples require the Java agent and a restart after edits.

Clone this wiki locally