
Falling Alchemy
Provides an alchemy system based on falling block physics interactions, supporting highly customizable recipe configurations.
Core Extension: Deep integration with CraftTweaker, supporting probability control, compound condition checks, and sound effect customization.
Demo
or https://www.bilibili.com/video/BV1aKJVzsEzo
Features
✅ Core Mechanics
- Custom falling blocks (sand/gravel/anvil, etc.)
- Detect specified items within radius and replace
- Support multi-output generation with quantity ratio control
⚙️ Advanced Configuration
- Recipe success rate (
0.0~1.0
) - Block retention chance (
0.0~1.0
) - Block displacement and additional product generation based on extra displacement
- Dynamic detection radius adjustment
- Custom failure/success sound effects
- NBT fuzzy matching (
fuzzyNBT
) - Recipe execution priority (
priority
)
🌦️ Condition System
- Biome restrictions
- Time range (MC time
0~24000
) - Weather states (clear/rain/thunderstorm)
- Altitude limitations
- Moon phase restrictions
Configuration Guide
Basic Syntax
import mods.fallingalchemy.FallingAlchemy;
import mods.fallingalchemy.ConsumedItem;
val builder = FallingAlchemy.addConversion(
fallingBlock as IItemStack, // Trigger block
consumedItems as ConsumedItem[], // Consumed items array
radius as double, // Detection radius (blocks)
outputs as IItemStack[], // Output list
successChance as double, // Success chance (optional, default 1.0)
keepBlockChance as double, // Block retention chance (optional, default 0.0)
priority as int, // Priority (optional, default 0)
displacement as double, // Minimum displacement requirement
additionalProducts as boolean, // Enable extra products based on displacement
successSound as string, // Success sound (optional)
successVolume as float, // Success volume (0.1-2.0)
successPitch as float, // Success pitch (0.5-2.0)
failureSound as string, // Failure sound (optional)
failureVolume as float, // Failure volume
failurePitch as float // Failure pitch
);
// Create consumed item object
val coalReq = FallingAlchemy.createConsumedItem(
<minecraft:coal_ore>.withTag({Unbreakable: 1 as byte}), // Item to match
3, // Required quantity (optional, default 1)
true, // Match NBT (optional, default false)
true // Fuzzy NBT matching (optional, default false)
);
// Add compound conditions
builder.addHeightCondition(60, 128)
.addMoonPhaseCondition(4);
builder.register(); // Register recipe
Parameter Descriptions
Parameter | Type | Description |
---|---|---|
fallingBlock |
IItemStack | Must be a block item (e.g., <minecraft:sand> ) |
consumedItems |
ConsumedItem[] | Consumed items array (use createConsumedItem) |
priority |
int | Recipe priority (higher values execute first) |
radius |
double | Detection radius (recommended 1-5 blocks) |
outputs |
IItemStack[] | Output list with multipliers (e.g., <minecraft:diamond>*2 ) |
successChance |
double | Execution probability (0.0~1.0) |
keepBlockChance |
double | Chance to retain trigger block (0.0~1.0) |
successSound |
string | Success sound resource path (e.g., minecraft:entity.experience_orb.pickup ) |
failureSound |
string | Failure sound resource path |
ConsumedItem Parameters:
IIngredient ingredient
: Item to consumeint requiredCount
: Required quantity (optional, default 1)bool matchNBT
: Strict NBT matching (optional, default false)bool fuzzyNBT
: When matchNBT=true, only validate existing tags (optional, default false)
Configuration Examples
Multi-Consumption Recipe
// Consume coal (NBT required) and gold ingot
val coal = FallingAlchemy.createConsumedItem(
<minecraft:coal_ore>.withTag({Unbreakable: 1 as byte}),
2, true, false
);
val gold = FallingAlchemy.createConsumedItem(
<ore:ingotGold>,
1, false, false
);
FallingAlchemy.addConversion(
<minecraft:anvil>,
[coal, gold], // Consumed items array
2.5,
[<minecraft:diamond>*3],
0.8,
0.3,
5 // High priority
).register();
Full-Featured Example
val builder = FallingAlchemy.addConversion(
<minecraft:sand>,
[FallingAlchemy.createConsumedItem(<minecraft:ender_pearl>, 1)],
3.0,
[<minecraft:ender_eye>],
0.75,
0.2,
10,
8,
true,
"minecraft:entity.endermen.teleport", 1.0, 1.2,
"minecraft:block.glass.break", 0.8, 0.9
);
builder.addHeightCondition(80, 255)
.addMoonPhaseCondition(0)
.addWeatherCondition(true, false)
.setSuccessSound("minecraft:block.enchantment_table.use", 0.5, 1.5)
.register();
Condition System
Condition Types
Method | Example Parameters | Description |
---|---|---|
addBiomeCondition |
"minecraft:jungle" |
Biome restriction |
addTimeCondition |
0, 12000 |
Time range (MC time) |
addWeatherCondition |
true, false |
Rain/thunderstorm check |
addHeightCondition |
60, 128 |
Y-axis altitude range |
addMoonPhaseCondition |
3 |
Moon phase (0-7) |
Special Notes:
- Weather logic: When
requireThundering=true
, rain check is automatically enabled - Single-value altitude:
addHeightCondition(100)
triggers at Y=100
Sound System
Sound Configuration Methods
// Method 1: Specify during addConversion
builder.setSuccessSound("sound_id", volume, pitch);
// Method 2: Set separately
builder.setFailureSound("minecraft:block.anvil.land", 1.0, 0.8);
Sound Parameters:
- Volume range:
0.1
~2.0
(default 1.0) - Pitch range:
0.5
~2.0
(default 1.0) - Resource format: Use Minecraft sound IDs (e.g.,
"minecraft:entity.lightning.thunder"
)
FAQ
❓ Recipe not triggering
- Confirm falling block registration
- Check detection radius coverage
- Verify condition requirements
❓ No sound playback
- Validate sound ID correctness (use F3+H to check)
- Ensure volume/pitch within valid ranges
❓ Multi-consumption mismatch
- Check NBT matching modes
- Ensure total consumed quantities are met
❓ Priority not working
- Check priority parameter (default 0)
- Higher values take precedence (e.g., 10 > 5)
License: MIT
Feedback: Submit Issue