# Decompile: module JSON → .jc, raw factories
Turn an in-game export or a compiled module back into JustCode; `item_raw` / `text_raw` / `number_raw` / `var_raw` / `enum_raw`; getting custom items. Open when changing an existing in-game module or using heads / custom items.

`jmvcc decompile export.json -o main.jc` turns a module (an in-game export or `jmvcc compile` output, also a
http(s) link) into JustCode that compiles back to the same JSON, and prints the round-trip result. Exit code: 0 —
lossless, 2 — the round trip found differences (that data would be lost on upload), 1 — error. It never overwrites
a hand-written .jc (without -o: `<name>.jc`, or `<name>.decompiled.jc` if that exists; `--force` to overwrite).
Item constants go to `<name>.items.jc` (imported at the top: read main.jc, not the items file). To change an
old in-game module: decompile, edit main.jc, compile. Lines `// decompile: ...` mark what is not 1:1.
Factories for values that plain literals cannot write (they emit exactly this JSON):
```js
inline var ITEM_CUE = item_raw("H4sI…")          // item as the server stores it (base64 gzip NBT) or a JSON item string
player::message(text_raw("<red>hi", parsing = "minimessage"))   // text parsing: legacy (a plain string) plain minimessage json
code::wait(number_raw("%math(%length(l)-1)"))     // a number the server keeps as placeholder text
var_raw("x", "game") = 1                          // variable with an explicit scope, no declaration needed
player::play_sound(sound("block.note_block.harp", 1, 2, variation = "", source = "RECORD"))
player::play_sound(sound = s, source = enum_raw("RECORD"))   // an argument missing from the registry: only a *_raw value
@description("&6Opens the menu", "&7selection: 1 player")   // description / icon / hidden in the in-game function menu
@icon(ITEM_BOOK)
@hidden
function menu() { ... }
// edition 2 file: native parameters from the game menu
function top(id: text, count: number = 10, extra = empty_slot(), ref out, mode: enum("1", "0"), at: location[] = []) {
  param_info("id", description = "Top id", slot = 10)                         // menu text / cell of a parameter
  param_info("extra", raw = json_raw("{\"type\":\"parameter\",...}"))        // a parameter the signature cannot say
}
```
Decompiled code uses the same sugar where it gives the same JSON: `var a, b, c`, `x = m["k"]`, `l[0][1] = v`,
`m[k] += 1`. Write new code with normal literals (`item("stone", "&bName")`, `"text"`, `x * 2`, declared variables); the raw
forms are for decompiled code (a player head or a custom item from the game exists only as item_raw).
To get such an item: `jmvcc client items` (backpack and the open menu) gives ready `inline var ITEM_… = item_raw(…)`
lines; never invent the base64. Heads from /hdb: with the mod find them yourself (open `/hdb search <word>`, look at
them with `jmvcc client render`, take the line from `client items --slots <n>`; topic rpc-bridge «Heads from /hdb»);
without the mod ask the player to put them in the backpack. For a head as a BLOCK (decor) you need only its skin
value: `client items` prints it under the item lines (`world::set_player_head(loc, value, "VALUE")`, builder
`b.set(..., { head: value })`).
The annotations are for new code too (→ topic functions-editions). Native parameters from the game are declared in the signature
(edition 2, above); only when that does not rebuild the same JSON decompile keeps
`function_info(description = [...], icon = ..., hidden = true, parameters = json_raw(...))` as the first line of its body.
