refactor: port MicroMaterialRegistry to Java

Replaces MicroMaterialRegistry.scala with a Java registry, its companion
singleton and the two nested interfaces. Both nested interfaces are
descriptor-identical to the reference and MODULE$ keeps every instance
method ProjRed links against. Ten jars reference this type and three more
reach it reflectively, so the surface was checked member by member rather
than by descriptor count.

getIdMap keeps its scala.Tuple2 array because extrautilities links against
it, so the registry still stores tuples internally. readIDMap moves from
scala.collection.Seq to java.util.List, which no jar references; the one
in-repo caller moved from mkString to String.join. That clears one of the
five Scala-typed descriptors the inventory identified.

Three removals, all verified unreferenced: the mangled public accessors
Scala emitted so its closure classes could reach private state,
IMicroMaterial$class, and the MissingMicroMaterial forwarders for the two
members it does not override. The last of those was caught by the
characterization failing to compile, not by inspection.

IMicroMaterial's loadIcons, canRenderInPass and isSolid become real Java
defaults, so implementors can inherit rather than restate them. Eleven
anonfun classes are gone.

Validated with 73 plain-JVM tests passing against both the Scala baseline
and the port, a clean build, and the Java 8 Forge dedicated-server suite,
which exercises setupIDMap and calcMaxCuttingStrength during real startup.
This commit is contained in:
Algent committed 2026-08-14 22:08:30 +02:00
1 parent dc758d4310
commit edd6136354
6 files changed
+463 -261

No files matched your search

@@ -123,12 +123,14 @@ class MicroMaterialRegistryCharacterizationTest {
*/
@Test
void materialInterfaceSuppliesRenderPassAndSolidity() {
assertTrue(MissingMicroMaterial.canRenderInPass(0));
assertFalse(MissingMicroMaterial.canRenderInPass(1));
assertFalse(MissingMicroMaterial.canRenderInPass(-1));
IMicroMaterial missing = MissingMicroMaterial$.MODULE$;
assertFalse(MissingMicroMaterial.isTransparent());
assertTrue(MissingMicroMaterial.isSolid());
assertTrue(missing.canRenderInPass(0));
assertFalse(missing.canRenderInPass(1));
assertFalse(missing.canRenderInPass(-1));
assertFalse(missing.isTransparent());
assertTrue(missing.isSolid());
}
private static MCDataInput input(byte[] bytes) {