diff --git a/JAVA_MIGRATION.md b/JAVA_MIGRATION.md index 5ccc83a..62e6b89 100644 --- a/JAVA_MIGRATION.md +++ b/JAVA_MIGRATION.md @@ -23,15 +23,15 @@ No trustworthy tool will produce a maintainable Java port automatically. A decom ## Current status -The binary and source-level consumer audits are complete. Phase 0 still lacks exact description-packet fixtures and a -pre-optimization profile. The low-coupling Phase 3 queue is complete; before entering measured hot-path or generated -tile work, the immediate milestone is the audit-derived compatibility gate below. +The binary and source-level consumer audits are complete. Phase 0 still lacks a pre-optimization profile. The +low-coupling Phase 3 queue is complete; before entering measured hot-path work, the immediate milestone is the +remaining generated-tile portion of the audit-derived compatibility gate below. That audit found and this branch has now repaired one existing regression: Schematica 1.12.6 reflects the original private `MultiPartRegistry$` field `codechicken$multipart$MultiPartRegistry$$typeMap` and casts it to a Scala mutable map. The companion again exposes that exact private field as a live view of the canonical Java `HashMap`, and a test performs -Schematica's reflective lookup. The remaining source-only member guards and `TileMultipart` ordering/move lifecycle -are also frozen; compact mixed-part NBT and description-packet fixtures are next. +Schematica's reflective lookup. The remaining source-only member guards, `TileMultipart` ordering/move lifecycle, and +compact mixed-part NBT/description packet are also frozen; generated-trait and pass-through fixtures are next. Phase 1 has not properly started: GTNHLib is present but was added at `api` scope to satisfy a test compile rather than because a migration change needed it, and no Forge mod dependency was declared. Revisit that entry only when a @@ -305,8 +305,8 @@ Do this before another source conversion: `registerMaterial` lookup. - [x] Freeze `TileMultipart` order and lifecycle observations: `parts`/`id` NBT, `partList`/`jPartList`, `partMap`, slot rebinding, add/remove/replace callback order, moving the live tile, and `onMoved`. -- [ ] Add compact mixed-part NBT and description-packet fixtures. Use representative fake parts in the existing test - harness; do not add all downstream mods as test dependencies. +- [x] Add compact mixed-part NBT and description-packet fixtures. The existing torch/button parts provide the needed + distinct IDs, order, slots and payload without adding downstream mods or a test-only part registry. - [ ] Freeze one generated Scala trait, one Java trait, and representative pass-through interfaces before changing built-in tile traits or either generator. @@ -394,7 +394,7 @@ The work should move from low to high risk while keeping a buildable mixed-langu Extensive tests are both possible and recommended here. Their purpose is not to prove that the current Scala behavior is ideal; it is to make its observable behavior explicit before translation, so every later difference is intentional. The repository now has a Java-8-compatible JUnit Jupiter suite and a small Forge integration runner. The current -baseline is 130 plain-JVM tests and 24 Forge server tests. Minecraft 1.7.10 does not provide the modern GameTest +baseline is 130 plain-JVM tests and 25 Forge server tests. Minecraft 1.7.10 does not provide the modern GameTest framework, so game-dependent coverage continues through the existing narrow Forge harness rather than a second test framework. @@ -620,4 +620,7 @@ generated-trait compatibility work. Scala-runtime removal remains a later projec - Reproduced MatterManipulator's live-tile relocation shape. Removing the tile first calls `onWorldSeparate` for each part in list order; after reinsertion, `onMoved` calls each part's `onMoved` and default `onWorldJoin`, again in list order. The original generated tile, part instances, order, slot map and tile references survive. -- The expanded baseline is 130 plain-JVM tests and 24 Forge server tests, all passing. +- Froze the complete logical chunk-description payload around the same torch/button pair: packet type, chunk + coordinates, tile count, nibble-relative X/Z, full Y, part count, sorted runtime part IDs, part order and both meta + bytes. CodeChickenLib's deferred Deflater transport step is deliberately outside this FMP fixture. +- The expanded baseline is 130 plain-JVM tests and 25 Forge server tests, all passing. diff --git a/JAVA_MIGRATION_CONSUMER_AUDIT.md b/JAVA_MIGRATION_CONSUMER_AUDIT.md index 028a587..476cf8f 100644 --- a/JAVA_MIGRATION_CONSUMER_AUDIT.md +++ b/JAVA_MIGRATION_CONSUMER_AUDIT.md @@ -445,8 +445,9 @@ The Java port may add faster indexed storage, but all published views, serializa packet consumers must observe one consistent order. Current-branch verification: `MultipartHelperFunctionalTest` freezes ordered two-part NBT reconstruction and slot -rebinding. `TileMultipartLifecycleFunctionalTest` freezes add/remove callbacks and the MatterManipulator-shaped live -move, including ordered `onWorldSeparate` before ordered `onMoved`/`onWorldJoin`, without replacing the generated tile. +rebinding plus the exact logical chunk-description framing and part payload. `TileMultipartLifecycleFunctionalTest` +freezes add/remove callbacks and the MatterManipulator-shaped live move, including ordered `onWorldSeparate` before +ordered `onMoved`/`onWorldJoin`, without replacing the generated tile. ### Material IDs and packets @@ -495,7 +496,8 @@ behavior: 3. Keep the completed `TileMultipart` list/map/slot and live-move characterization green before optimizing storage or iteration. 4. Characterize pass-through interfaces and ProjectRed's external Scala trait before changing either generator. -5. Add mixed NBT/packet fixtures before converting microblocks and Minecraft part implementations. +5. Keep the completed compact mixed NBT/chunk-description fixture green; add subsystem-specific payload cases when + converting microblocks or Minecraft part implementations. 6. Treat Scala runtime removal as downstream coordination work after the Java port, not as a requirement of it. With these gates, the source audit is actionable: the port can simplify internals freely where no listed observation diff --git a/JAVA_MIGRATION_HANDOFF.md b/JAVA_MIGRATION_HANDOFF.md index 7852819..d5457f3 100644 --- a/JAVA_MIGRATION_HANDOFF.md +++ b/JAVA_MIGRATION_HANDOFF.md @@ -57,7 +57,7 @@ awk -F'"' '/singletonList(tile).iterator()); + ByteBuf buffer = packet.getByteBuf(); + byte[] actual = new byte[buffer.writerIndex()]; + buffer.getBytes(0, actual); + + // type | chunk x/z | tile count | local x/y/z | part count | torch id/meta | button id/meta + assertArrayEquals( + new byte[] { 2, 0, 0, 0, 1, 0, 0, 0, 2, 0, 1, 2, 0, 0, 0, (byte) 200, 3, 2, 3, 5, 0, 1 }, + actual); + } + /** The id guard runs before anything else, so a foreign tag must not disturb the loading world. */ @Test void leavesTheLoadingWorldAloneForATagItDoesNotOwn() { @@ -125,6 +148,10 @@ class MultipartHelperFunctionalTest { return world; } + private static TileMultipart mixedTile() { + return MultipartHelper.createTileFromParts(Arrays.asList(new TorchPart(5), new ButtonPart(1))); + } + /** Matches only its own tile class, so registering it cannot affect any real chunk load. */ private static final class MarkerTile extends TileEntity { }