# Edition layers: generic game logic, per-edition adapters, per-version wire

Status: accepted direction, started 2026-11-25. Slices land as stacked pull requests, one each.

Progress:

- Slice 1, the player layer: merged in [#3737](https://github.com/JSPrismarine/JSPrismarine/pull/3737).
- Slice 2, the edition folders: merged in [#3738](https://github.com/JSPrismarine/JSPrismarine/pull/3738).
  The handler contexts went to `player/context/` rather than an edition, since the intent handlers
  use them, and `BlockTarget` and `contentUseOnBlock` to `input/handlers/`. `applyClientMovement` and `replaceOtherLogins`, which both editions call,
  came out of their Bedrock handlers into `player/`.
- Slice 3.1, movement: merged in [#3754](https://github.com/JSPrismarine/JSPrismarine/pull/3754). A move, a jump, a sprint, a sneak, a flight, a bed and the held
  buttons are intents. Bedrock's `PlayerAuthInput` and `PlayerAction` decode into them, and so do
  Java's move packets, `Player Command` and `Player Input`. Java sends no jump, so a Java move that
  leaves the ground going up is one, as vanilla's `handleMovePlayer` decides. Bedrock's input mode
  stays Bedrock's, since only Bedrock has touch, mouse and gamepad modes.
- Slice 3.2, blocks: merged in [#3837](https://github.com/JSPrismarine/JSPrismarine/pull/3837). Mining was already the `mineBlock` intent, so what was left is
  a block pick, an entity pick and a lectern page turn. Each is an intent, decoded from Bedrock's
  `BlockPickRequest`, `ActorPickRequest` and `LecternUpdate` and from Java's `Pick Item From Block`
  and `Pick Item From Entity`. Java turns a lectern's page with a container button, which waits for
  the screens slice. Picking still only logs, as it did. A sign edit arrives as Bedrock's
  `BlockActorData`, which no handler reads yet, and Java's `sign_update`
  ([#3775](https://github.com/JSPrismarine/JSPrismarine/issues/3775)), so it is a feature to build
  rather than a handler to move.
- Slice 3.3, item use: merged in [#3845](https://github.com/JSPrismarine/JSPrismarine/pull/3845). `InventoryTransaction`'s bodies are intents: a use on a block,
  a use at nothing, a hit, a use on an actor and a release, beside the client-timed break that is
  `mineBlock`'s `finish`. Java decodes `Use Item`, `Attack`, `Interact` and `Player Action`'s
  release into the same ones. The Bedrock handler keeps what only Bedrock has: checking the
  transaction against the docs, the hand slot it names, the mismatch report and the legacy
  two-action drop. `ItemStackRequest`, which moves stacks between Bedrock's windows, is not in this
  slice: Java moves them with `Container Click`, by slot and button, so the two need a shared
  model of a stack move before either decodes into it, and that is a slice of its own after the
  screens.
- Slice 3.4, screens: merged in [#3851](https://github.com/JSPrismarine/JSPrismarine/pull/3851). An anvil's wear, a crafter's slot toggle, a lab table action
  and a recipe book's settings are intents. Bedrock's `AnvilDamage`, `PlayerToggleCrafterSlotRequest`,
  `LabTable`, `SetPlayerFurnaceOptions` and `SetPlayerInventoryOptions` decode into them, and Java's
  `Change Recipe Book Settings` into the recipe book's. Java toggles a crafter's slot, turns a
  lectern's page and picks a villager's trade by container id, inside a screen the server has
  opened. The server opens no screen for a Java client yet, so those wait until one does, with
  `Container Click`. The trade and workstation rules, `tradeScreen` and `workstation`, are game
  logic that only `ItemStackRequest` uses, so they move with it.
- Slice 3.5, forms, books and commands: merged in [#3854](https://github.com/JSPrismarine/JSPrismarine/pull/3854). A form's answer, a book edit and a command
  block's or a command block minecart's edit are intents. Bedrock's `BookEdit` and
  `CommandBlockUpdate` decode into them, and `ModalFormResponse` hands its answer to
  `answerForm` once it has checked the answer is JSON, which disconnects a client when it is not,
  as BDS does. Java's `Edit Book`, `Set Command Block` and `Set Command Minecart` decode into the
  same intents. A Java screen sends no command block name or tick delay, so an edit that leaves a
  field out keeps the block's own. `CommandRequest` decodes into `runCommand` too, carrying the
  request its reply echoes, and the presenter's `showCommandOutcome` sends the reply. The
  data-driven screens are Bedrock's own UI, kept in the Bedrock session's screen state, and stay
  too. Structure blocks move with what remains, slice 3.6. The `network/` aliases are gone.
- Slice 3.6, what remains: merged in [#3870](https://github.com/JSPrismarine/JSPrismarine/pull/3870). A structure block's settings and its save, load, scan or
  query are intents, which Bedrock's `StructureBlockUpdate` and `StructureTemplateDataRequest` and
  Java's `Set Structure Block` decode into. What is left in `editions/bedrock/handler/` is
  Bedrock's own, and stays:
  - The connection and the join: login, the handshake, network settings, the packs, the client
    cache, sub-chunks, the loading screen, latency, disconnects and violation warnings.
  - Packets only a Bedrock client sends about itself or its own features: the skin, the emote
    list, client options, diagnostics, aim assist, the old `MovePlayer`, and a player location a
    client has no business sending.
  - Education Edition and Marketplace features: multiplayer settings, photos, receipts, NPCs and
    world templates (`SimpleEvent`).
  - Requests a Java client makes some other way or not at all, which wait for the feature behind
    them: map data and locked copies (Java is sent a map's data unasked), riding links, the
    lodestone database and a difficulty change from the settings menu.
  - The handlers that wrap Bedrock's protocol around an intent: `PlayerAuthInput`,
    `InventoryTransaction` and `ModalFormResponse`, and `ItemStackRequest`, which
    waits for its own slice beside Java's `Container Click`.
  - `PlayerAction` became a decoder later, and `PlayerAuthInput` decodes its block actions
    through the same function.
- Slice 4.1, the player's own state: merged in [#3871](https://github.com/JSPrismarine/JSPrismarine/pull/3871). `showAttributes`, `showMotion`,
  `showActorData`, `showRespawned` and `showGameRules` are presenter calls, and `showDeath`
  carries where the player comes back, so Bedrock's presenter sends the death screen's `Respawn`
  and `DeathInfo` itself. Two of `PlayerSession`'s six edition checks are gone, the attributes' and
  the death screen's.
- Slice 4.2, the player's own inventory: merged in [#3875](https://github.com/JSPrismarine/JSPrismarine/pull/3875). `showInventory` and `showOwnSlot` are
  `BedrockPresenter`'s to send now, read from the session's inventory with the stack ids Bedrock
  names stacks by, and `openOwnInventory` opens the player's inventory screen under a window the
  session records. `ShownContainer` names the cursor too, which Java does not show. Two more of
  `PlayerSession`'s edition checks are gone, the inventory's and the slot's, and its
  `sendHandItem` and `sendArmorFor` with them.
- Slice 4.3, block containers and trades: merged in [#3876](https://github.com/JSPrismarine/JSPrismarine/pull/3876). `openContainer`, `showTradeOffers`,
  `showContainerData` and `showContainerSlots` are presenter calls. The session keeps the window
  table, the open container and which of its properties the client already has, and the
  presenter sends the packets. `sendContainerSlot`, which only Bedrock's handlers call, is
  `editions/bedrock/containerSlot.ts` now. A Java client is opened no screen yet
  ([#3769](https://github.com/JSPrismarine/JSPrismarine/issues/3769)).
- Slice 4.4, in three parts. The world change and the respawn exchange: merged in
  [#3897](https://github.com/JSPrismarine/JSPrismarine/pull/3897). `showWorldChange` sends the
  change and returns the loading screen the session waits on, which Java has none of, and
  `showRespawnPoint` sends Bedrock's `Respawn` states. The session asks `placesItselfOnRespawn`
  where it checked the edition. Against the `change-dimension` captures, a Bedrock change no
  longer sends `StopSound` or `PlayStatus`
  ([#3882](https://github.com/JSPrismarine/JSPrismarine/issues/3882)). The chunk path: merged in
  [#3899](https://github.com/JSPrismarine/JSPrismarine/pull/3899). `BedrockChunkWire` sends a
  Bedrock client's publisher updates, chunks, radius, sub chunks and cache blobs, and the session
  sends both editions' chunks through one path. The creative menu and the recipes: merged in
  [#3902](https://github.com/JSPrismarine/JSPrismarine/pull/3902).
  `sendCreativeContents` and `sendCraftingData` are functions of `editions/bedrock/joinContent`,
  which only the join burst calls.
- The last of slice 4, the packets `PlayerSession` still built itself: merged in
  [#3906](https://github.com/JSPrismarine/JSPrismarine/pull/3906). The join's
  spawn status, the End's credits and `AvailableCommands` are `showSpawned`, `showCredits` and
  `showCommands`, and the session still decides which commands a player is offered. The login
  handler writes its own `PlayStatus`. The session's move batching had no caller left, since the
  replicator batches every actor's moves, and is gone. The session builds no Bedrock packet now.
  A Java client is rolled the credits by `Game Event` 4, and its `Client Command` 0 decodes into
  their finish while they are pending
  ([#3903](https://github.com/JSPrismarine/JSPrismarine/issues/3903)). Its command tree went out
  with [#3773](https://github.com/JSPrismarine/JSPrismarine/issues/3773).
- Slice 5, screens and stack moves, part 1: merged in
  [#3932](https://github.com/JSPrismarine/JSPrismarine/pull/3932). A Java client is opened a storage
  block's screen: `Open Screen` with vanilla's menu and title, and the block's slots above its own
  inventory. Chests, barrels, ender chests, shulker boxes, hoppers, dispensers and droppers open;
  furnaces, brewing stands, workstations and trades do not yet. `Close Container` decodes into
  `closeContainer`. A `Click Container` is answered with the window as the server holds it, so
  the client puts back what it predicted, until clicks decode into stack moves
  ([#3769](https://github.com/JSPrismarine/JSPrismarine/issues/3769)).
- Slice 5.2, the stack move model: merged in
  [#3933](https://github.com/JSPrismarine/JSPrismarine/pull/3933). `inventory/stackMoves.ts` moves a count of a
  stack between two slots, swaps two and takes a count off one, generic over how a caller names
  its slots, with the rules `ItemStackRequestHandler` had: when two stacks merge, when they trade
  places, which keeps the stack's network id, and that a furnace's result takes nothing. Bedrock's
  take, place, swap, drop and destroy run through it, unchanged. Java's clicks decode into it next.
- Slice 5.3, Java's clicks, part 1: merged in
  [#3939](https://github.com/JSPrismarine/JSPrismarine/pull/3939). `Click Container` decodes into the
  `clickContainer` intent, which `containerClicks` carries out as vanilla's menu does, over the
  moves of `stackMoves`: a left or right click picks up, puts down, splits, merges or trades a
  stack, a click outside the window throws, a shift-click moves to the other part of the window,
  a number key swaps with a hotbar slot or the off hand, Q throws, a double-click gathers and a
  creative middle click copies. It applies in the player's own inventory window, and an armor
  slot takes only its own piece. A block's window, a drag and the crafting grid apply nothing
  yet, and every click is shown back as the server holds the window, with `Set Cursor Item`.
- Slice 5.3, Java's clicks, part 2: merged in
  [#3943](https://github.com/JSPrismarine/JSPrismarine/pull/3943). A click in a storage block's screen, a chest's,
  a barrel's, an ender chest's, a shulker box's, a hopper's, a dispenser's or a dropper's, applies
  over `storageWindow`, which numbers the block's slots above the player's own as vanilla's menus
  do, shift-clicks between the two, and keeps a shulker box out of a shulker box. What it moves
  in the block is kept there, and every other player with the block open is shown the slots that
  changed through their own presenter. `otherViewersOf` finds them for Bedrock's
  `ItemStackRequest` too.
- Slice 5.4, screens of their own, part 1: merged in
  [#3947](https://github.com/JSPrismarine/JSPrismarine/pull/3947). A furnace, a blast furnace and a smoker
  open for a Java client under their menus and titles, and `Set Container Property` shows the
  fuel's burn and the cook under the Java menu's ids, with the cook's total, which the station
  does not report: vanilla's default for the station, as a Bedrock client assumes it. A click in
  their screens moves nothing yet, since taking a smelt's result pays its experience out.
- Slice 5.4, part 2: merged in [#3950](https://github.com/JSPrismarine/JSPrismarine/pull/3950). A click in a cooking station's screen applies over
  `furnaceWindow`, numbered as vanilla's furnace menu: a shift-click puts what the station cooks
  in its input and what burns in its fuel, the fuel slot takes only fuel and an empty bucket, and
  the result takes nothing. Taking from the result pays out the experience of what it cooked, as
  Bedrock's `ItemStackRequest` does.
- Slice 5.4, part 3: merged in [#3957](https://github.com/JSPrismarine/JSPrismarine/pull/3957). A Java player crafts in the inventory's 2x2 grid. A click on
  the grid moves stacks in the player's crafting input, the inventory window shows the grid and the
  stack it makes, and taking that stack crafts it as vanilla's result slot does: onto the cursor,
  into the inventory with a shift-click while a whole result fits, into the world with Q, or into
  an empty hotbar slot with a number key. `gridCraft` matches the grid and spends a craft, over the
  result stacks Bedrock's `ItemStackRequest` builds (`craftedStacks`).
- Slice 5.4, part 4: merged in [#3961](https://github.com/JSPrismarine/JSPrismarine/pull/3961). A crafting table opens for a Java client under the crafting
  menu, its window numbered as vanilla's: the result, the 3x3 grid and then the player's own
  slots. A click on the grid moves stacks in the player's crafting input, a shift-click puts a
  stack in the grid first, the result and the grid are shown back after each click, and taking
  the result crafts as in the inventory, with the craft event naming the table.
- Slice 5.3, Java's clicks, part 3: merged in
  [#3963](https://github.com/JSPrismarine/JSPrismarine/pull/3963). A drag across slots applies as vanilla's
  `quickCraft` does: its start names whether the stack spreads evenly, one item each or, for a
  player with infinite materials, a full stack each, each slot it passes is kept while the stack
  has an item for it, and its end spreads the stack over them. A drag over one slot is a click on
  it, and any other click while one is under way only ends it. `ClickContainerHandler` keeps each
  player's drag between clicks, per window.
- Slice 5.5, the brewing stand: merged in [#3964](https://github.com/JSPrismarine/JSPrismarine/pull/3964). A brewing stand brews for both editions
  (`world/brewing.ts`): blaze powder burns for the brews its `minecraft:brewing_fuel` gives, a
  brew counts down 400 ticks, and its last tick turns every bottle the ingredient brews and uses
  one ingredient up. A Java client opens it under `minecraft:brewing_stand` and
  `container.brewing`, `Set Container Property` shows the brew and the fuel under the Java menu's
  ids, and a click applies over `brewingWindow`, numbered as vanilla's brewing stand menu: a
  bottle slot takes one brewing input, the ingredient slot a reagent and the fuel slot a brewing
  fuel. A shift-click repeats while it moves the same item, as vanilla's does, which fills the
  three bottle slots in one click. A Bedrock client is shown the same progress under the ids the
  pinned servers send, which the `open-brewing-stand` exchange captured; the order they arrive in
  differs from BDS's ([#3958](https://github.com/JSPrismarine/JSPrismarine/issues/3958)). An
  ingredient leaves no crafting remainder yet
  ([#3960](https://github.com/JSPrismarine/JSPrismarine/issues/3960)).
- Slice 5.6, pick block: under review. A block pick puts the block's item in the hand for both
  editions, as vanilla's `tryPickItem` does: a stack of it in the hotbar is selected, one elsewhere
  in the inventory trades places with a suitable hotbar slot's, and a player in creative is given
  one there. `item/blockItems.ts` names the item a block is picked as, which is the block's own
  for most blocks and the standing one's for a torch, a sign, a banner, a head or a coral fan on a
  wall. `showHeldSlot` tells the client its hand, with `Set Held Slot` or `PlayerHotbar`. A pick
  in creative that asks for the block's data copies a container's slots onto the stack; the rest
  of the block entity's data, such as a sign's text, is not copied yet
  ([#4037](https://github.com/JSPrismarine/JSPrismarine/issues/4037)).
- Slice 5.7, the enchanting table: merged in
  [#3973](https://github.com/JSPrismarine/JSPrismarine/pull/3973). A Java client opens it under
  `minecraft:enchantment` and `container.enchant`, and a click applies over `enchantingWindow`,
  numbered as vanilla's enchantment menu: the item slot holds one item, the lapis slot only lapis,
  and a shift-click puts lapis in its slot and one item in an empty item slot. The three rows go
  through the presenter's `showEnchantOffers`, which a Java client is sent as the menu's ten
  container properties and a Bedrock client as `PlayerEnchantOptions`. A row's button, decoded
  from `Click Container Button` into the `pressContainerButton` intent, enchants the item and
  spends its lapis and levels as vanilla's `clickMenuButton` does. The table plays no sound for a
  Java client yet ([#3972](https://github.com/JSPrismarine/JSPrismarine/issues/3972)).
- Slice 5.8, the anvil: merged in
  [#3981](https://github.com/JSPrismarine/JSPrismarine/pull/3981). A Java client opens it under `minecraft:anvil` and
  `container.repair`, and a click applies over `anvilWindow`, numbered as vanilla's anvil menu:
  either input takes any stack, and a shift-click moves a player's stack into the inputs.
  `Rename Item` decodes into the `renameItem` intent, which keeps the typed name on the window.
  After each click and each name, the result and its cost go through the presenter's
  `showAnvilResult`, and taking the result spends the inputs and the levels as vanilla's
  `onTake` does. The anvil does not wear down yet
  ([#3980](https://github.com/JSPrismarine/JSPrismarine/issues/3980)).
- Slice 5.9, trading: under review. A Java client opens a trader's screen under
  `minecraft:merchant` and the trader's Java title, and is sent `Merchant Offers`: each offer at
  its base price, with a special price that brings the price the client works out to the one the
  player pays now, and the trader's level and experience. `Select Trade` decodes into the
  `selectTrade` intent, which moves the payment for the picked offer in from the inventory as
  vanilla's `tryMoveItems` does, and a click applies over `merchantWindow`, numbered as vanilla's
  merchant menu. Taking the result trades through `takeMerchantOffer`, which Bedrock's
  `ItemStackRequest` takes through too.
- Slice 5.10, the grindstone and the loom: under review. Both open for a Java client, the
  grindstone under `minecraft:grindstone` and `container.grindstone_title` and the loom under
  `minecraft:loom` and `container.loom`, and a click applies over `grindstoneWindow` and
  `loomWindow`, numbered as vanilla's menus. Their rules are `enchantment/grindstone.ts` and
  `crafting/loom.ts`, which Bedrock's `ItemStackRequest` takes its `CraftRepairAndDisenchant` and
  `CraftLoom` actions through too. A Java client picks a loom pattern with `Click Container
  Button`, which decodes into `pressContainerButton`, and a Bedrock client names it by its short
  code. The result slot is shown through `showContainerSlots`, and a Java slot carries a banner's
  `minecraft:banner_patterns`.
- Slice 5.11, the crafter: in progress. A Java client opens a crafter under `minecraft:crafter_3x3`
  and `container.crafter`, and `Change Container Slot State` decodes into the `toggleCrafterSlot`
  intent Bedrock's `PlayerToggleCrafterSlotRequest` already did. Its handler turns an empty slot off
  or on in the crafter's record, which keeps it under Bedrock's `disabled_slots` short, so every
  Bedrock client holding the chunk is sent the crafter's `BlockActorData`, as the pinned servers
  send it in the `toggle-crafter-slot` exchange. Every player with the crafter open is shown the
  slot as the screen's property of that slot, which a Java client is sent as `Set Container
  Property` and a Bedrock client is not. A click applies over `crafterWindow`, numbered as
  vanilla's crafter menu, and a slot that is off takes nothing from a Java click. A Bedrock
  `ItemStackRequest` may put a stack in it, as the pinned servers take one in the
  `crafter-disabled-slot` exchange. A crafter does not craft yet, so its result slot stays empty
  ([#4079](https://github.com/JSPrismarine/JSPrismarine/issues/4079)). A
  screen that closes and puts its stacks back into the inventory names each slot they went into
  through the presenter's `showPutBack`, which a Java client is sent as `Set Player Inventory Slot`.
- Bundles, the pick: under review. `Bundle Item Selected` decodes into the `selectBundleItem`
  intent, which puts the picked place in the bundle's contents on the bundle's stack in the open
  window, as vanilla's `toggleSelectedItem` does. `item/bundleContents.ts` reads a bundle's
  contents off its `minecraft:bundle_contents` component and names the stack a right click takes
  out: the picked one, or the newest. The pick lasts on a stack in the player's own slots and in a
  screen's inputs; a block's slots are read from its record each time, so a pick there is lost.
  Bedrock has no packet for a pick.
- Bundles, clicks and contents: under review. A left or right click with a bundle on a stack, or
  with a stack on a bundle, moves stacks in or out of the bundle as vanilla's `BundleItem`
  overrides do (`inventory/bundleClicks.ts`), by the weights `BundleEdit` keeps, and plays the
  bundle's sounds. A Java slot carries a bundle's stacks as `minecraft:bundle_contents`, both ways.
  Still missing ([#4013](https://github.com/JSPrismarine/JSPrismarine/issues/4013)): holding use
  with a bundle in the air to drop what it holds, which needs an item use that ticks; and a Bedrock
  client's bundle, which keeps its stacks in a dynamic container named by the bundle's id. The
  server sends no such container, and `ItemStackRequestHandler` refuses a move that names one.
- The beacon: under review. A Java client opens it under `minecraft:beacon` and
  `container.beacon`, and a click applies over `beaconWindow`, numbered as vanilla's beacon menu:
  the payment slot holds one item of `minecraft:beacon_payment_items`. The screen's levels and
  effects go through `showContainerData`, which a Java client is sent as the menu's three data
  slots. `Set Beacon` decodes into the `setBeaconEffects` intent, and Bedrock's `BEACON_PAYMENT`
  request action pays through the same rules in `world/beacon.ts`, inside the request so its
  answer names the spent payment: the pyramid has to offer the choice, as vanilla's
  `validateEffects` asks, one payment item is spent and the block entity keeps the effects as
  Bedrock ids. Every 80 ticks an active beacon gives its effects to the players in its reach.
  The beacon plays no activation or deactivation sound and raises no `construct_beacon`
  advancement yet ([#4081](https://github.com/JSPrismarine/JSPrismarine/issues/4081)).
- Slice 5.12, stack requests: in progress. Bedrock's `ItemStackRequest` decodes into the
  `moveStacks` intent, one per packet, which carries each request's moves in order
  (`inventory/stackRequest.ts`): take, place, swap, drop, destroy, a creative pick, a craft and the
  slots it consumes, an enchanting row, a trade, an anvil's, a grindstone's or a loom's result and
  a beacon's choice. Each move names its slots in the server's stores (the player's containers, the crafting
  grid, a workstation's inputs or the block's slots) with the container and slot the client used,
  which the answer repeats. `MoveStacksHandler` applies each request all or nothing over
  `stackMoves`, the workstation takes and `takeMerchantOffer`, and the presenter's
  `answerStackRequests` answers with one `ItemStackResponse`. The Bedrock handler keeps what is
  Bedrock's: the request ids a client makes up, the container names, the creative and recipe net
  ids it was sent, a trade's and an enchanting row's net id and the beacon's effect ids; Bedrock's
  presenter keeps the stack ids. An action it cannot read becomes a refusal at the point it
  stands, so the moves before it are rolled back as they were. The workstation takes moved to
  `inventory/workstationTakes.ts` and Bedrock's names for those slots to
  `editions/bedrock/workstationContainers.ts`; `tradeScreen` is gone. Other players at the same
  block are shown what a request changed through their own presenter, as a Java click's viewers
  are, so a Java player sees a Bedrock player's moves in a chest. The `beacon-payment` exchange
  showed that the pinned servers take a beacon's payment only when the same request destroys it,
  and refuse a choice that spends nothing with `ITEM_NOT_CONSUMED` and one that consumes it with
  `ACTION_REQUEST_NOT_ALLOWED`; the server had spent the payment itself, as Dragonfly does, and now
  answers as the captures do. Which items a slot takes is shared with `containerClicks`
  ([#4082](https://github.com/JSPrismarine/JSPrismarine/issues/4082)): `MoveStacksHandler` asks
  the windows a Java click is carried out in, through `slotCapacity` in
  `inventory/screenWindows.ts`, and refuses a move that would put more in a slot than its window
  lets a click put there with `CANNOT_PLACE_ITEM`, as the pinned servers answer in the slot
  exchanges: a furnace's fuel slot, a beacon's payment slot, an enchanting table's two slots, a
  brewing stand's bottle and fuel slots, an armor slot and a shulker box in a shulker box. A
  request that names more than the slot holds, such as two iron ingots for a beacon's payment,
  is refused whole, where a Java click puts in what fits. The pinned servers take some moves a
  Java window refuses, and a Bedrock request is taken there too: a stack in a cooking station's
  result slot, anything in a brewing stand's ingredient slot and a stack in a crafter's slot that
  is off. They refuse a glass bottle in a brewing stand's bottle slot, which a Java click puts
  there, and so does a Bedrock request. The same exchanges showed that a Bedrock client numbers a
  brewing stand's ingredient 0 and its bottles 1 to 3, and names a crafter's slots under
  `LEVEL_ENTITY_CONTAINER`, which `containerSlots` now follows. A Bedrock craft still matches the recipe its client names by net id,
  where a Java click matches the grid through `gridCraft`.
- Slice 5.13, the workstations: in progress. A Java client opens a stonecutter under
  `minecraft:stonecutter` and `container.stonecutter`, and a smithing table under
  `minecraft:smithing` and `container.upgrade`. Each window is numbered as vanilla's menu numbers
  it, from one table of layouts (`inventory/workstationWindow.ts`): the inputs, the result, then
  the player's slots. A click on an input applies over the window's own rules
  (`stonecutterWindow`, `smithingWindow`), and a click on the result takes it as vanilla's result
  slot does, through the takes in `inventory/workstationTakes.ts`: the stonecutter cuts one input
  by the picked recipe and the smithing table spends one of each input. Both editions match the
  two stations' slots as one recipe input (`crafting/stationCrafts.ts`), so a Bedrock client's
  `ItemStackRequest` crafts from the same input. `Click Container Button` at a stonecutter picks a
  recipe by its place in the input's list, which is the order `Update Recipes` sends the
  stonecutter recipes in, and the pick goes out as the menu's data slot. A cartography table opens
  under `minecraft:cartography_table` and `container.cartography_table` over `cartographyWindow`,
  and its take clones a map onto an empty map, zooms one out with paper or locks one with a glass
  pane, as vanilla's `setupResultSlot` and `MapItem.onCraftedPostProcess` do. Bedrock's request at a
  cartography table is still refused: its shape is not known from a capture of the pinned servers
  ([#3698](https://github.com/JSPrismarine/JSPrismarine/issues/3698)).
- Sign edits: under review. Bedrock's `BlockActorData` is a decoder now, and Java's `Update Sign`
  decodes into the same `editSign` intent. A Java client sends the one face it edited, so a face
  the intent leaves out keeps its text, and its lines lose their formatting codes as vanilla's
  `handleSignUpdate` strips them. A Java client is not yet opened the sign editor
  ([#3775](https://github.com/JSPrismarine/JSPrismarine/issues/3775)).
- The difficulty: under review. Bedrock's `SetDifficulty` is a decoder now, and Java's
  `Change Difficulty` decodes into the same `setDifficulty` intent. Its handler sets the difficulty
  for everyone when the player may run `/difficulty`, as Java's `handleChangeDifficulty` asks for
  the game master permission, and shows anyone else the server's own back. A Java client's lock
  on the difficulty is not read yet, since the world keeps no lock
  ([#3813](https://github.com/JSPrismarine/JSPrismarine/issues/3813)).

## Problem

`packages/prismarine/src/network/` holds the transport and the wire, and also most of what a
player is and does: the session, which chunks a client has, which entities it sees, keep-alives,
admission, boss bars, trades, maps. About 50 Bedrock packet handlers under `network/handler/` run
game logic themselves rather than handing it on. A behavior written there exists for Bedrock only,
and the Java Edition support ([the Java plan](https://jsprismarine.dev/plans/java-multiprotocol.md)) has to write it again or go
without.

[ADR 0027](https://jsprismarine.dev/adr/0027-player-inputs-are-decoded-into-intents.md) started the split for inputs:
an edition decodes a packet into an intent, and one intent handler runs it for both. Outbound,
[ADR 0026](https://jsprismarine.dev/adr/0026-java-is-a-second-protocol-family-over-one-world.md)'s `SessionPresenter` is
the contract both editions implement. This plan finishes the split and moves the code to match.

## The three layers

1. **Generic.** What a player asks for is an intent, run by one handler for both editions
   (`input/`). What a player is shown is a `SessionPresenter` call. The session, its chunks, its
   entities, its keep-alive, admission and arrival are game logic with no edition in them
   (`player/`).
2. **Per edition.** An edition decodes its packets into intents, implements the presenter, and
   owns its join exchange (`editions/bedrock/`, `editions/java/`). An edition's code holds no game
   rule: when it decides something about the world, the decision moves to the generic layer.
3. **Per version.** Inside an edition, a version is a wire concern: Bedrock's per-protocol codecs
   and wire gates ([ADR 0003](https://jsprismarine.dev/adr/0003-declarative-wire-layouts.md)), Java's per-release packet
   tables and handler lookup. A decoder or a presenter that differs by version asks the version's
   table or gate; it is never copied per version.

`network/` keeps what is network: transports, codecs, the dispatcher, the connection, batching,
compression, encryption and packet traces.

## Target layout

| Now                                                                                                                                        | Moves to                            |
| ------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------- |
| `PlayerSession`, `ChunkView`, `ChunkSender`, `EntityTracker`, `KeepAlive`, `playerAdmission`, `playerArrival`, `BossBar`, `carriedMaps`, `sessionPlayers`, `createConnectedPlayer` | `player/`                           |
| `presenter/SessionPresenter` and the `shown*` shapes                                                                                       | `player/presenter/`                 |
| `InputQueue`                                                                                                                               | `input/`                            |
| `decoder/`, the Bedrock packet handlers in `handler/`, `BedrockPresenter`, the join burst, `startGameData`, `contentPayloads`, `joinPacketCache` and the other Bedrock packet builders | `editions/bedrock/`                 |
| `network/java/`                                                                                                                            | `editions/java/`                    |
| Game logic inside a Bedrock handler                                                                                                        | an intent and its handler, `input/` |

A moved or replaced module's old public subpath is removed, not kept as a deprecated alias or a
shim, and its changeset names the replacement. Removing a subpath that a release published is a
breaking change, with the bump [the versioning policy](https://jsprismarine.dev/guide/versioning.md) gives it. Slice 3.5
removed the `network/` aliases slices 1 and 2 had left.

## Slices

1. **Player layer.** Move the edition-neutral modules in the first row of the table, and their
   tests, to `player/`, and `InputQueue` to `input/`. Mechanical: no behavior changes.
2. **Edition folders.** Move `network/java/` to `editions/java/`, and the Bedrock decoders,
   presenter, join burst and packet builders to `editions/bedrock/`. Mechanical.
3. **Bedrock handlers into intents**, one area per slice. Java decodes into the same intents where
   it has the packet.
   1. Movement: `PlayerAuthInput`, `MovePlayer`.
   2. Blocks: `PlayerAction`, `BlockPickRequest`, block entity updates.
   3. Inventory: `InventoryTransaction`, `ItemStackRequest`, `MobEquipment`.
   4. Screens: anvil, lab table, crafter, furnace options, trading.
   5. Forms, books and commands: `ModalFormResponse`, `BookEdit`, `CommandRequest`, command and
      structure blocks.
   6. What remains in `handler/`.
4. **Outbound.** `PlayerSession` still sends Bedrock packets itself in many places, which a Java
   connection drops. Each becomes a `SessionPresenter` call, so the session holds no edition.
   `BedrockPresenter` is built with a small `BedrockSessionState`, the session state Bedrock's
   packets carry beside what the contract hands it, so the shown types stay plain.
   1. The player's own state: attributes, motion, actor data, the death screen, coming back
      alive and game rules.
   2. The player's own inventory: its contents, one of its slots, the held item and the armor,
      and the screen the player opens on it. Bedrock names every stack by a network id it
      assigns on the inventory, which `BedrockSessionState` grows to reach.
   3. Block containers and trades: the screen a block or a trader opens, its offers, its
      properties and its slots.
   4. The world change, the respawn exchange and Bedrock's chunk path, which becomes a
      `ChunkWire` beside Java's, and the creative inventory and the crafting data, which only
      Bedrock's join sends and which move with the join burst.
5. **Screens and stack moves.** Java's screens open as Bedrock's do, and a stack move is one model
   that Bedrock's `ItemStackRequest` and Java's `Click Container` both decode into: Bedrock names
   each move, and Java names a slot and a button, which the server works out the moves of as
   vanilla's `AbstractContainerMenu.doClick` does.
   1. Storage screens open for a Java client, and its clicks are answered with the window as the
      server holds it.
   2. The stack move model, with Bedrock's take, place, swap, drop and destroy decoding into it.
   3. Java's clicks decode into it: pick up, quick move, swap, throw, drag and pick up all.
   4. The screens with properties and slots of their own: furnaces, brewing stands, workstations
      and trades.

## Where new code goes

- A rule of the game: `player/`, `world/`, `entity/` or `input/handlers/`, never an edition folder.
- Something a client sends: a decoder in its edition that produces an intent.
- Something a client is shown: a `SessionPresenter` method, implemented by each edition.
- Something only one version of one edition has: a gate or a version table entry in that
  edition's wire, never a branch in game logic.
