Skip to content

fix double item remap in set_entity_data translation - #664

Open
DustinReynoldsPE wants to merge 1 commit into
PommeMC:masterfrom
DustinReynoldsPE:fix/entity-data-double-remap
Open

DustinReynoldsPE wants to merge 1 commit into
PommeMC:masterfrom
DustinReynoldsPE:fix/entity-data-double-remap

Conversation

@DustinReynoldsPE

Copy link
Copy Markdown

Fixes #663

Summary

translate_entity_data already remaps item-stack values while rewriting serializer ids, so remap_inbound's SetEntityData arm applied the wire-to-native item remap a second time. On a 26.3 wire an oak_log (163) arrived as waxed_weathered_cut_copper_slab: 163 -> 161 at the frame level, then 161 -> 159 through the typed pass. Item entities and any other metadata item stacks rendered as wrong items on every translated session except 765, where translate_item_765 deliberately leaves the id in wire space for this pass.

The fix gates the typed remap on game_ids.is_none_or(|g| g.v765.is_some()) so it only runs when the frame-level rewrite left the item id in wire space.

Test plan

  • entity_data_item_remaps_once_777 — 777 set_entity_data frame carrying oak_log (163) decodes to ItemKind::OakLog after translate_decode_and_remap; fails without the fix (decodes as waxed_weathered_cut_copper_slab), passes with it
  • entity_data_item_remaps_765 — 765 wire stack (765 item id 27) still decodes to GrassBlock, so the typed remap remains active where the frame rewrite doesn't cover it
  • In-game verification on a live 26.3 server (Pumpkin): dropped oak_log item entities rendered as copper slabs before, render correctly after

translate_entity_data already remaps item-stack values while rewriting
serializer ids, so remap_inbound's SetEntityData arm applied the wire-to-
native item remap a second time. On a 26.3 wire an oak_log (163) arrived
as waxed_weathered_cut_copper_slab: 163 -> 161 at the frame level, then
161 -> 159 through the typed pass. Item entities and any other metadata
item stacks rendered as wrong items on every non-765 translated session.

Gate the typed remap on the wire version whose frame rewrite leaves the
item id in wire space (1.21.5 / translate_item_765).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Item stacks in set_entity_data get double-remapped on translated sessions (dropped items render as wrong items)

1 participant