# Gameplay across Java releases

Plan, 2026-12-02. The server reads Java Edition's data and copies Java Edition's code, and both
change between releases. [Java data pack version support](https://jsprismarine.dev/plans/java-datapack-version-support.md) made
the data side hold two releases at once: a default and one preview, each with its own generated
data, and grammar gates in the loaders. [Java transcriptions](https://jsprismarine.dev/plans/java-transcriptions.md) made the code
side notice a change: every copied method names its Java source, and a fingerprint check lists what
a new jar changed. This plan covers what those two leave out:

- running copied code as either release, so the preview plays as the preview and not as the default
  with the preview's data;
- proving both releases through the parity suite, not only the default;
- following Mojang without a maintainer watching, so a new pre-release is pinned and brought up as
  far as tools can take it, and a shipped release becomes the default through a pull request
  that was opened for it.

The target is 26.4. When this was written the default was 26.3, the preview 26.4 Pre-Release 1,
and Mojang had published Pre-Release 3 the day before. The values below are as they were on this
date and stay unmarked, as the repository rules say for dated plans.

## Progress

Branch `docs/multi-version-gameplay-plan`, 2026-12-02.

| Slice | State |
| --- | --- |
| 1. Tracker, regeneration command and workflow (the proof of concept) | Done in this branch. |
| 2. Behavior gates for copied code | Done, stacked on slice 1 ([#4089](https://github.com/JSPrismarine/JSPrismarine/issues/4089)). |
| 3. The 26.4 changes behind gates | Done for every row but the Java client protocol ([#4090](https://github.com/JSPrismarine/JSPrismarine/issues/4090)); see section 5. |
| 4. Parity on the preview | Open. |
| 5. The preview's Java client protocol | Open. |
| 6. A flip with nothing typed by hand | Done in this branch ([#4093](https://github.com/JSPrismarine/JSPrismarine/issues/4093)). |
| 7. Retiring the previous default | Open. |
| 8. Snapshots by format | Open. |
| 9. The Bedrock pair at the flip | Open. |

Slices 2 to 9 are issues [#4089](https://github.com/JSPrismarine/JSPrismarine/issues/4089) to [#4096](https://github.com/JSPrismarine/JSPrismarine/issues/4096), listed in section 6.

## 1. Where this starts

| Kind of difference | Example in 26.4 | Mechanism today | Runs as the preview? |
| --- | --- | --- | --- |
| Datapack grammar | `upscale` density functions, a material rule that places no block | `SINCE_` constants on the data pack format major, `readsSince` in `@jsprismarine/worldgen` (now in `@jsprismarine/packs`) | Yes |
| Registry contents | New feature types, `domain_warp` | Per-release `registries.json`, the reviewed `unhandled` lists | Yes |
| Generated tables | Block states, items, entity attributes, goals | Per-release directories under `mapping`, `items`, `bedrock-data/src/jsp/java/` | Yes |
| Worldgen code | `Mth.sin` rounding in carvers, the `noise_biomes` chunk status | `SINCE_` constants on the format major, threaded as a `format` argument | Yes |
| Other copied code | 184 members, from `AbstractArrow.tick` to villager beds | `@javaSource` fingerprints; a changed member is a `deferred` row in `behavior-gaps.json` | No |
| Java client protocol | Packet ids, layouts, registries | `packages/protocol/src/java/versions/<R>/`, generated for releases only | No |
| Version tracking | Pre-Release 2 and 3 | A maintainer notices and follows the java-bringup skill | Not applicable |

The first four rows already behave as the target release. The last three are this plan.

The 184 deferred `java.transcriptions` rows say what the preview gets wrong. By the package whose
copy each row points at: 75 in `prismarine`, 55 in `block-behaviors`, 20 in `protocol`, 11 in
`entity-goals`, 6 in `entity-brains`, and one each in `structures` and `advancements`. None of these
packages can see which release a server runs: the target reaches `Level`, the worldgen catalog and
the pack loader, and stops there.

Three things are also typed by hand and change at every flip:

- `DEFAULT_JAVA_DATA_TARGET` in `@jsprismarine/packs` restated the default's release id, format
  and data version, which `sources.json` and the jar's `version.json` own. Slice 6 generates it.
- Until this branch, the parity families `datapack.26.3` and `datapack.26.4-pre-1` and their test
  files named the release, so every re-pin renamed them. Slice 1 keys them by role.
- The pair of a promoted release with a Bedrock protocol follows `bds.defaultProtocolVersion`,
  which moves on Bedrock's schedule, not Java's.

## 2. Two numbers for two kinds of gate

A grammar gate and a behavior gate answer different questions, so they compare different numbers.

**A grammar gate** asks which spelling a datapack file uses. Mojang moves the data pack format
major exactly when a grammar breaks, so these gates compare the format major, as they do now.

**A behavior gate** asks which version of a Java method a copy follows. Mojang changes code in
snapshots that leave the major alone: 26.4 Snapshot 10 and Pre-Release 1 share format major 128
(128.0 and 128.1), and a pre-release can change code without touching the format at all. So
behavior gates compare the **data version**, which grows with every published version, snapshot
and pre-release included (5130 and 5131 for those two). A made-up example:

```ts
/**
 * Arrows stop in a waterlogged block one tick earlier, from Pre-Release 1 on.
 * @javaSource AbstractArrow.tick
 */
const SINCE_ARROW_STOPS_IN_WATERLOGGED = 5131;

if (readsSince(world.javaDataVersion?.(), SINCE_ARROW_STOPS_IN_WATERLOGGED)) { ... }
```

The constant is named for the change, lives in the package that owns the copy, and holds the data
version of the first **pinned** version the change was measured in. The transcription check
compares pinned jars, not every snapshot, so that is the version the repository knows has it; a
release the server can't run never meets the gate. The two worldgen gates on code rather than
grammar, `SINCE_ROUNDED_MTH_TRIG` and `SINCE_NOISE_BIOMES_STATUS`, moved to 5130, 26.4 Snapshot
10's data version, in slice 2.

### How gameplay code sees the release

Behavior code reaches the release through the world it runs in, not through a module-level
constant, so one process can host a server per release in tests. Slice 2 built it from what
already existed rather than a new object:

- `readsSince(value, since)` in `@jsprismarine/packs/javaDataTarget`, beside `JavaDataTarget`, is
  the one gate helper for both kinds. Undefined reads as the oldest release, as format gates
  already did. `packs` depends only on `@jsprismarine/errors`, so any package can import it.
- Prismarine's world adapter reports the content's release as `level.javaDataVersion`, and
  `Level.getJavaTarget()` hands out the target itself.
- The world interfaces content packages already read gain one optional member each:
  `GoalWorld.javaDataVersion()` in `entity-goals` and `WorldActions.javaDataVersion()` in
  `block-behaviors`. Prismarine fills both from the adapter. A test double without it runs the
  oldest release.
- The worldgen registries carry `dataVersion` beside `format`, through the generation pool's
  registry bundle, so a worker runs the same release as the server.
- A pure function that copies Java takes the data version as a parameter, the way the carvers took
  `format`, so a test runs it as both releases and asserts the two results.

The example gate is `Mth.sin` and `Mth.cos`, which 26.4 changed from a truncating to a rounding
table lookup. They were copied four times (worldgen, the dragon's flight, block placement and the
explorer map preview), each as 26.3's. They are now one module, `@jsprismarine/math/javaMth`,
whose `mthTrig(dataVersion)` returns the release's lookup, and every caller asks its world for the
data version. Both members are restamped for the preview, which closed their two deferred rows.

### Closing a deferred row

A row closes in one of two ways, and the skill's step 6 already describes both:

- The copy still matches the new bytecode. Restamp with `java:sources --update --reviewed`.
- The behavior changed. Add the gate and its two-sided test, then restamp.

Either way the row is gone. 26.4 is ready to become the default when its rows reach zero, because
the flip turns every remaining row into a failure.

## 3. Proving both releases

The parity families that compare behavior (`entities.behavior`, `blocks.behavior`,
`gameplay.datapack`, `gameplay.mechanics`, `items.behavior`, the worldgen families) run on the
default only. Slice 4 runs them once more on the preview, in the merge group and the nightly run,
never on a pull request:

- The parity runner takes the release from `JSP_JAVA_RELEASE`, falling back to the default, and
  passes it to every server and loader it starts as `content-java-version`.
- A row that fails only on the preview is recorded in `behavior-gaps.json` as `deferred`, with the
  preview's id as its reference, as the transcription rows are. The dashboard shows one column per
  release.
- The family set is the same for both releases. A row that needs a reference only the default has,
  such as worldgen vectors for 26.3 only ([#3284](https://github.com/JSPrismarine/JSPrismarine/issues/3284)),
  reports "not measured" on the preview.

This doubles the cost of those families in the merge group. The CI speed plan's counts move by one
job; the job runs the same files with another environment variable.

## 4. Following Mojang

### The tracker

`pnpm --filter @jsprismarine/bedrock-data run java:track` reads piston-meta's version manifest and
the pins, and names one change. The rules, in `utils/java/tracking.ts`:

| piston-meta shows | Pinned | Decision |
| --- | --- | --- |
| A release newer than the default | Anything | **promote** it to the default, retiring the preview of its cycle |
| A pre-release or release candidate newer than the preview, same cycle | A preview | **repin** the preview to the newest one |
| Only snapshots newer than the preview, same cycle | A preview | Nothing; see slice 8 |
| A version of a later cycle | A preview | Nothing; the slot is taken until the preview ships |
| Any version newer than the default | No preview | **start-preview** with the newest |

piston-meta files pre-releases and release candidates as `snapshot`, so the kind is read from the
id's spelling, with the existing `compareJavaReleases` order.

With `--apply` it measures the new jars (sha1 and size against piston-meta, sha256 on download),
rewrites `javaServer` in `sources.json`, moves the retired preview's release directories to the new
id with `git mv` so the regenerated files show as a diff, drops the retired id's fingerprints,
deferred rows and pack hash, relinks the guide's delta note, and writes a Changeset. On 2026-12-02
it decided `repin: 26.4-pre-1 -> 26.4-pre-3`, and `--apply` in a scratch worktree produced a
manifest that `loadJavaServerData` accepts.

A promotion keeps the previous default pinned with `bedrockProtocol` set to the Bedrock default,
since retiring it means removing data, tests and gates (slice 7).

### The workflow

`.github/workflows/java-track.yml` runs daily and on dispatch. When the tracker decides something
and no pull request for that version is open, it runs:

1. `java:track --apply`;
2. `fetch:sources` and `datagen:java` for the base release and the new one;
3. `java:diff <base> <new> --out docs/research/java-<new>-delta.md`;
4. `java:regenerate --java <new>`, the skill's derived-data step as one command;
5. `java:transcriptions`, `java:sources --update` and the gap update, which turn each changed
   member into a `deferred` row;
6. `generate` after a promotion, `docs:facts` and `format`;
7. `bringup:java --quick`, whose report goes into the pull request body.

It opens a draft pull request on `java-track/<new>` with a checklist of what is left: gates for the
delta note's grammar changes, reviews of the changed transcriptions, issue references on new gap
rows, and, after a promotion, retiring the old default.

A pull request opened with `GITHUB_TOKEN` starts no workflows. The workflow checks out, pushes and
opens the pull request with the `MACHINE_USER` token, as `release.yml` and `addons-listings.yml`
do, so CI runs on it.

### What "switching automatically" means

When 26.4 ships, the workflow opens the promotion the same day. Whether that pull request merges
the same day depends on what it inherits. Every preview row still `deferred` becomes a failure once
26.4 is the default, so the switch is mechanical only when the preview was kept at zero deferred
rows during the pre-releases. Slices 2 and 3 are the work that makes the switch mechanical, and the
tracker keeps the preview current so that work is done against the newest pre-release.

Auto-merge stays off. A promotion changes what every server without `content-java-version` runs,
and the merge is the review of that.

## 5. Slices

Each slice merges on its own with CI green.

1. **Tracker, regeneration command and workflow.** `java:track`, `java:regenerate`, the
   `java-track` workflow, and the `datapack.default` and `datapack.preview` families keyed by role.
   The skill names the commands. Done in this branch.
2. **Behavior gates for copied code.** `readsSince` in `@jsprismarine/packs`, the release's data
   version on the world interfaces and the worldgen registries, the two worldgen code gates moved
   to data versions, and `Mth.sin` and `Mth.cos` gated end to end as the example, with two-sided
   tests. Done.
3. **The 26.4 changes behind gates.** Done against 26.4 Pre-Release 1. Of 182 deferred rows,
   168 closed: 153 were refactors that leave the copy as it is, two needed gates (the mushroom's
   support and the dragon's climb), seven moved to another member, and six change code the server
   does not copy, which [#4114](https://github.com/JSPrismarine/JSPrismarine/issues/4114) tracks.
   The 14 left are Java client packets and sounds, which wait for slice 5. The golden gained
   per-release `moves` so a moved member can be stamped for the preview without breaking the
   default. [The review](https://jsprismarine.dev/research/java-26.4-pre-1-transcription-review.md) lists every verdict.
4. **Parity on the preview.** `JSP_JAVA_RELEASE` in the parity runner, a merge-group and nightly
   job that runs the behavior families on the preview, deferred rows per release, a dashboard
   column per release.
5. **The preview's Java client protocol.** `dump:java-protocol` writes a snapshot's directory and
   leaves it out of `javaReleases.ts`, so a Java client on 26.4 cannot join a server running the
   preview. Accept the preview's protocol when `content-java-version` names it.
6. **A flip with nothing typed by hand.** `dump:java-target` writes `DEFAULT_JAVA_DATA_TARGET` from
   the default's `version.json`, `java:regenerate` runs it for the default, and a test fails when
   it names another release than `sources.json`. The deprecated `DATA_PACK_FORMAT` and
   `DATA_PACK_RELEASE` restated the same numbers and are removed. `JAVA_RELEASE` in
   `@jsprismarine/management-protocol` was already generated. Done in this branch.
7. **Retiring the previous default.** A `java:retire <release>` command that removes a release's
   entry, directories, fingerprints and gap rows, and lists the gates whose constant is at or below
   the oldest pinned release's data version or format, so their old branch can go. The promotion's
   checklist runs it.
8. **Snapshots by format.** The skill re-pins a snapshot only when its data pack format major
   moved, which needs the jar. The workflow fetches the newest snapshot, reads its `version.json`,
   and re-pins when the major moved; otherwise it comments the minor change on the tracking issue.
9. **The Bedrock pair at the flip.** Mojang ships a game drop to both editions. A promotion should
   pair the new default with the Bedrock protocol of the same drop, which may still be the
   Bedrock preview. The tracker reads the pair of the retiring preview and either carries it over
   as `bedrockProtocol` or waits for `capture.yml` to flip the Bedrock default.

## 6. Issues

| Slice | Issue |
| --- | --- |
| 2 | [#4089](https://github.com/JSPrismarine/JSPrismarine/issues/4089) |
| 3 | [#4090](https://github.com/JSPrismarine/JSPrismarine/issues/4090) |
| 4 | [#4091](https://github.com/JSPrismarine/JSPrismarine/issues/4091) |
| 5 | [#4092](https://github.com/JSPrismarine/JSPrismarine/issues/4092) |
| 6 (done) | [#4093](https://github.com/JSPrismarine/JSPrismarine/issues/4093) |
| 7 | [#4094](https://github.com/JSPrismarine/JSPrismarine/issues/4094) |
| 8 | [#4095](https://github.com/JSPrismarine/JSPrismarine/issues/4095) |
| 9 | [#4096](https://github.com/JSPrismarine/JSPrismarine/issues/4096) |

## 7. Decisions for the maintainer

1. **Behavior gates compare the data version.** The alternative, the format major, cannot tell
   two pre-releases of one cycle apart, and code changes most in pre-releases. Recommended.
2. **One process, many releases.** Behavior code reads the release from its level, never from a
   module constant, so tests can run both releases side by side. Costs a parameter on pure
   functions. Recommended.
3. **Keep the previous default after a promotion until slice 7 retires it.** The tracker never
   deletes data. The alternative, deleting in the promotion, makes the tracker's pull request carry
   a large removal nobody asked it to review. Recommended.
4. **No auto-merge.** The tracker opens drafts; a maintainer merges. Revisit once slices 2 to 4
   keep the preview at zero deferred rows for a full cycle.

## 8. Risks

- **A pre-release with many changes and a short cycle.** Gates are written by hand. If Mojang
  publishes the release a week after a pre-release that changed 50 members, the promotion waits on
  those reviews. The tracker can't speed up the reviews, but it puts the list in front of a
  maintainer the day the pre-release ships.
- **Regeneration that fails in CI.** A generator that breaks on the new jar stops the workflow
  before it opens a pull request, so nobody sees the half-done state, only a failed run in the
  Actions tab. A later slice can open the pull request with what succeeded.
- **The draft's diff is large.** Re-pinning rewrites the preview's tables and goldens. The
  `git mv` before regeneration keeps the diff to what changed rather than every file twice.
- **Dated notes still name old ids.** The tracker leaves `docs/research/` and `docs/plans/` alone,
  as the repository rules want for dated records, and only relinks the guide.

## Sources

- [Java data pack version support](https://jsprismarine.dev/plans/java-datapack-version-support.md), [Java transcriptions](https://jsprismarine.dev/plans/java-transcriptions.md),
  [the java-bringup skill](https://github.com/JSPrismarine/JSPrismarine/blob/master/.agents/skills/java-bringup/SKILL.md).
- piston-meta's [version manifest](https://piston-meta.mojang.com/mc/game/version_manifest_v2.json),
  read 2026-12-02: latest release 26.3, latest snapshot 26.4-pre-3.
- `packages/parity/goldens/behavior-gaps.json`, counted 2026-12-02.
