-
Notifications
You must be signed in to change notification settings - Fork 0
Interaction Format
Interactions are JSON files. Two schema versions are supported:
-
schema_version: 2— the current, strictly-valid-JSON format documented below. Parsed by a Mojang-serializationCodec, so shape errors are reported with a path and reason. -
legacy (no
schema_version, or1) — the original lenient format. Still loads, but is deprecated and logs a warning on load. See the*.jsonsamples without a_v2suffix inconfigExamples/interactions.
A legacy file and its v2 translation behave identically in-game. The v2 format additionally unlocks features that legacy files cannot express (guaranteed drops, multiple rolls, Fortune, potion effects, extended conditions, interaction sound/particles, typed NBT predicates), and gives far clearer error messages. New to the mod? Read getting-started.md first.
-
config/punchthemall/interactions/**/*.json— always loaded (editable by pack makers, hot-reload with/reload). -
data/<namespace>/pta/interaction/**/*.json— loaded only whenLoader.load_from_datapacks = trueinpunchthemall/pta-common.toml. Layered on top of config; a datapack interaction overrides a config one with the same id, and datapack files are synchronised to clients by vanilla.
Anywhere an item/block/fluid is selected, use match: a single string or a list. A leading #
means a tag; otherwise it is a registry id.
"match": "minecraft:stick"
"match": ["minecraft:stick", "#forge:tools/hammers"]A validated alternative to raw SNBT whitelist/blacklist, usable on hand and target:
-
path— dotted path into the tag; a segment ending in[]iterates a list. -
int_range—[min, max]; the predicate holds if a reachable numeric leaf is in range. Omit to test only for presence. -
where— an SNBT string filtering which list elements qualify.
{ "path": "Enchantments[].lvl", "int_range": [2, 7], "where": "{id:\"minecraft:unbreaking\"}" }All predicates in a list must hold (AND). They combine with the SNBT nbt whitelist/blacklist.
Absent tags don't match. A predicate on a key that isn't present fails. For example, a brand-new tool has no
Damagetag until it takes damage, so{ "path": "Damage", "int_range": [0, 500] }won't match it. This matches how the SNBT whitelist behaves.
Everything is visible in the Interaction category:
-
guaranteeddrops appear as extra output slots (tooltip: Guaranteed). -
weighteddrops show their chance and count range. -
nbt_predicatesare listed in the tooltip of the hand / target slot. - Hovering the arrow shows a summary:
rolls, Fortune bonus,effects, allconditions(time/weather/Y/light/sneaking/food/XP), and whether the interaction plays a sound / particles.
The interaction id is shown in the click-type tooltip, which is handy when reporting an issue.
count (rewards) and amount (costs) accept three shapes, unified to a [min, max] range:
- an integer:
3 { "count": 3 }-
{ "min": 1, "max": 3 }(maxdefaults tomin)
Effective floor is 0 for reward pools and 1 for player costs.
NBT is written as an explicit SNBT string ("{Damage:0}"), so files stay valid JSON. The
RangeTag convention ({Damage:{RangeTag:[0,500]}}) still works inside these strings.
-
Only
typeis required. Every other section is optional; omit what you don't need. -
typevalues:left_click,right_click,shift_left_click,shift_right_click. -
Empty hand vs. any item. Omit
hand, or usehandwith nomatch, to require an empty hand. Addmatchto require specific items/tags. -
consumeonly spends the item on success.durabilitydamages a damageable item;shrinkremoves one from the stack;noneleaves it untouched.chanceis the probability of spending it. -
Rolls default to 1. Without a
rewardsblock, nothing is dropped. Withweightedonly, you get exactly one weighted pick (the classic behaviour).guaranteeditems are always given. -
Fortune reads the enchantment from the held item, so it only helps interactions that use a
hand item; the bonus is
round(level × factor)extra items per weighted pick. -
Transformations happen at most once per click, after a successful drop, subject to
chanceand theallow_transformationsconfig gate. -
particlestakes a block id (block-break particles), not a particle-type id. -
Biomes/dimensions are matched by exact id (e.g.
minecraft:desert,minecraft:overworld). Biome tags are not supported here yet. -
effectscan be harmful. They are whatever you declare (e.g.minecraft:poison), applied to the player on success. -
Global config can still block an interaction even if the file is valid — see
configuration.md. Turn on
Debug.log_skipped_interactionsto find out why. - Multiplayer: gameplay uses the server's interactions; the JEI list is synchronised from the server, so a dedicated server is authoritative. See interactions.md.
| legacy | v2 |
|---|---|
item / items / tag / tags
|
match (with # for tags) |
block / blocks / fluid / fluids (in block) |
target.match + target.kind
|
block section |
target |
pool (chance = weight) |
rewards.weighted (weight) |
damage / hunger
|
costs.damage / costs.hunger (amount) |
biome |
conditions.biomes |
damageable: true |
consume.mode = "durability" |
consumable: true |
consume.mode = "shrink" |
| pseudo-JSON NBT object | SNBT string |
copy_state_value |
copy_state_value (unchanged) |
We would like to thank our community for their support and contributions to PunchThemAll. Your feedback helps us improve the mod and create a better experience for all users.
PunchThemAll is free and open source under the MIT License. See the LICENSE file for details.
{ "schema_version": 2, "enabled": true, // default true "type": "shift_left_click", // right_click | shift_right_click | left_click | shift_left_click "hand": { "hand": "main", // any | main | off (default any) "match": "#minecraft:shovels", // omit for "empty hand" semantics "consume": { "mode": "durability", "chance": 1.0 }, // mode: durability | shrink | none "nbt": { // SNBT strings (valid JSON strings) "whitelist": "{Damage:{RangeTag:[0,500]}}", "blacklist": "{Enchantments:[{id:\"minecraft:silk_touch\"}]}" }, "nbt_predicates": [ // typed predicates (see below) { "path": "Damage", "int_range": [0, 500] } ] }, "target": { "kind": "block", // block | fluid | air | any (default block) "match": "minecraft:gravel", "state": { // block/fluid state properties "whitelist": { "lit": "true" }, "blacklist": { "waterlogged": "true" } }, "nbt": { // block-entity SNBT strings "whitelist": "{Items:[]}" }, "nbt_predicates": [ // typed block-entity predicates { "path": "Items[].Count", "int_range": [1, 64] } ] }, "transformation": { "chance": 0.7, "into": { "kind": "block", "id": "minecraft:sand", "state": { "facing": "copy_state_value" } }, "nbt": "{}", // SNBT string "sound": "minecraft:block.gravel.break", "particles": "minecraft:sand" // a block id used for block particles }, "rewards": { "rolls": 1, // number of weighted picks (default 1) "guaranteed": [ // always dropped, in addition to the rolls { "match": "minecraft:flint", "count": 1 } ], "weighted": [ // weighted drop pool { "match": "minecraft:clay_ball", "weight": 10, "count": { "min": 1, "max": 3 } }, { "match": "minecraft:air", "weight": 90 } // count defaults to 1 ], "fortune": { "enchant": "minecraft:fortune", "factor": 1.0 } // +round(level*factor) per weighted pick }, "costs": { "damage": { "chance": 1.0, "amount": 1 }, // amount: int | {min,max} | {count} "hunger": { "chance": 0.5, "amount": { "min": 2, "max": 8 } } }, "effects": [ // potion effects applied to the player on success { "id": "minecraft:haste", "duration": 200, "amplifier": 0, "chance": 0.3 } ], "sound": "minecraft:block.gravel.hit", // feedback played on the interaction itself "particles": "minecraft:gravel", // a block id used for interaction particles "conditions": { "biomes": { // dimension or biome ids (exact match) "whitelist": ["minecraft:overworld"], "blacklist": [] }, "time": "day", // any | day | night "weather": ["clear", "rain"], // clear | rain | thunder (any if omitted) "y_range": [-64, 128], "light": { "min": 0, "max": 7 }, // block light level 0-15 "requires_sneaking": true, "player_state": { "min_food": 6, "min_xp_levels": 1 } } }