Commit Graph
22 Commits
Author SHA1 Message Date
Algent 9db07f8c7c refactor: port the marker interfaces to Java
TSlottedPart, IRandomDisplayTick, INeighborTileChange, TRandomUpdateTick,
ISidedHollowConnect and IMicroMaterialRender.

All six are member- and descriptor-identical to the reference. The seven
implementors and mixin tiles were diffed too and are unchanged member for
member. Five were already pure abstract interfaces in bytecode, so their
conversion has no bytecode consequence; exactly one class leaves the jar,
TRandomUpdateTick$class.

onWorldJoin cannot become a default: TMultiPart declares it, and a superclass
method beats an interface default, so the auto-registration would silently
never run. It stays abstract and implementors call TickScheduler.loadRandomTick
themselves, as RedstoneTorchPart already did.

No bridge was written for TRandomUpdateTick$class. No jar in the pack
references TRandomUpdateTick in any form, and the frozen baseline holds exactly
the eight helpers the inventory lists.

99 plain-JVM tests and 5 Forge server tests pass.
2026-08-15 15:32:45 +02:00
Algent cacc9a30a8 refactor: port TileMultipart to Java
Converts the central tile class and its companion object. TileMultipartClient
moves to its own Scala file unchanged: it is registered with the ASM
generator through registerTrait, so converting it is Phase 5
registerJavaTrait work rather than part of this step.

Every public member of the reference survives except protected$worldObj,
the accessor Scala emitted so the dropItems closure could reach the
protected field; no jar references it, and TileMultipartClient lost
nothing including its generated super accessor for markRender. All five
Scala-typed descriptors are preserved: partList and its setter, operate,
getOrConvertTile2's Tuple2, loadParts, and the Tuple2 rayTraceAll stores
into ExtendedMOP.data.

partList stays an immutable Scala List republished on each mutation, which
matches the reference semantics exactly and takes no performance decision;
that belongs to Phase 4 with profiling. Internal callers still go through
operate rather than a private loop, so a trait overriding it still sees
every call.

Recompiled Scala consumers need four adjustments, all source-only:
partList.apply(i) for indexing, renderID_$eq for assignment, an explicit
cast on getOrConvertTile2._2, and an explicit AbstractFunction1 for
operate since 2.11 will not adapt a lambda to Function1[_, BoxedUnit].
Eleven, one, two and one in-repo call sites respectively.

31 anonfun classes collapse to one Java anonymous class.

Validated with 90 plain-JVM tests, a clean build, and the Java 8 Forge
dedicated-server suite, which is the load-bearing check here because the
ASM generator builds composite tiles on top of this class.
2026-08-15 11:15:03 +02:00
Algent edd6136354 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.
2026-08-14 22:08:30 +02:00
Algent 52ff8ff460 refactor: port Saw to Java
Extracts the Saw trait out of ItemSaw.scala into a Java interface and
retains the Saw$class bridge for ProjRed. ItemSaw itself stays Scala. The
interface is descriptor-identical to the reference, the bridge adds only a
private constructor, and the emitted class-file set for this area is
unchanged.

Item does not declare getMaxCuttingStrength, so it becomes a real default
method. One consequence is worth noting: ItemSaw previously carried a
Scala trait forwarder for it and now inherits the default instead, so it
no longer declares that method. Three jars reference the ItemSaw type but
none reference its members, and an invokevirtual would still resolve
through the interface default. This is the first port that changed the
declared members of a class it did not touch.

Unlike TFacePart$class and TEdgePart$class, which hold constants and
ignore overrides, this bridge dispatches getCuttingStrength back through
the interface so an implementor's override is honoured. Both behaviors are
preserved as found and asserted separately.

First port outside codechicken.multipart.

Validated with 65 plain-JVM tests, a clean build, and the Java 8 Forge
dedicated-server suite.
2026-08-14 21:44:01 +02:00
Algent 7843f13792 refactor: port TIconHitEffects to Java
Replaces TIconHitEffects.scala with Java implementations of IconHitEffects,
JIconHitEffects, TIconHitEffects and both $class bridges. The two
interfaces are descriptor-identical to the reference; the statics class
and both bridges add only a private constructor. A frozen Scala consumer
compiled against the reference jar still links through all five statics.

The default-versus-abstract rule discriminates within this one file.
JIconHitEffects.getBreakingIcon becomes a real default because TMultiPart
does not declare it, so Java implementors can now inherit it.
TIconHitEffects.addHitEffects and addDestroyEffects stay abstract because
TMultiPart does declare them and a default would silently lose.
MicroblockClient, the one in-repo case, now declares that pair explicitly.

Removes IconHitEffects$ and its MODULE$ field. No jar in the pack
references it, in bytecode or by name; consumers use either the static
forwarders on IconHitEffects or the two $class bridges. This is the first
public class dropped rather than a method, and it contrasts with
NormalOcclusionTest$, which is referenced and was kept.

Evaluation order inside addDestroyEffects is preserved rather than hoisting
the tile read, since the characterization pins which work happens before a
null tile fails.

Validated with 49 plain-JVM tests, a clean build, and the Java 8 Forge
dedicated-server suite.
2026-08-14 21:16:28 +02:00
Algent a1bf3c8c86 refactor: port TNormalOcclusion to Java
Replaces TNormalOcclusion.scala with Java implementations of the six types
it held: NormalOcclusionTest, NormalOcclusionTest$, JNormalOcclusion,
TNormalOcclusion, TNormalOcclusion$class and NormallyOccludedPart. The
singleton and both interfaces are descriptor-identical to the reference;
the other three add only private members. A frozen Scala consumer compiled
against the reference jar still links through forwarder, $class, singleton
and super accessor.

Scala emits trait super accessors as ACC_SYNTHETIC, which javac hides
entirely, so an abstract synthetic method cannot be implemented by any
Java class or by Scala recompiled against a Java interface.
codechicken$multipart$TNormalOcclusion$$super$occlusionTest is therefore a
non-synthetic default returning true, the identity for the && chain the
bridge builds. Method resolution ignores the flag, so existing call sites
are unaffected.

Both in-repo mixins needed work, in different ways. HollowMicroblock had
no occlusionTest override and now declares one. PostMicroblock already had
one ending in super.occlusionTest, which used to route through the trait
and would now reach Microblock directly, silently dropping the box test;
the same expression was substituted at that call site.

Two further source-only divergences, both recorded: apply sugar on
NormalOcclusionTest no longer compiles for Scala callers, and
NormallyOccludedPart loses the scala.runtime.Null$ getType variant that
Scala inferred for a null literal. No jar in the pack references either.

Validated with 38 plain-JVM tests, a clean build, and the Java 8 Forge
dedicated-server suite.
2026-08-14 20:30:11 +02:00
Algent cd6420f7f2 refactor: port TCuboidPart to Java
Replaces TCuboidPart.scala with Java implementations of TCuboidPart,
JCuboidPart and the TCuboidPart$class bridge. The canonical behavior now
lives in three statics on JCuboidPart; the deprecated bridge delegates to
them, since old Scala forwarders call the statics directly and delegating
to the instance methods would recurse.

Every reference descriptor is preserved, verified by diffing javap -s
output against the reference dev jar. ForgeRelocationFMP, OpenComputers,
ProjRed and ProjectBlue all call these four statics, and a frozen Scala
2.11.5 consumer compiled against the reference jar loads and runs against
the port.

Scala trait linearization cannot be reproduced by a Java interface: a
superclass method beats an interface default on the JVM, so a recompiled
Scala class mixing TCuboidPart into a TMultiPart subclass silently gets
TMultiPart's empty implementations. Declaring the methods default would
not help, so they stay abstract, matching the reference bytecode. Existing
binaries are unaffected. Microblock, the one in-repo case, now extends
TMultiPart with TCuboidPart and forwards explicitly. See
JAVA_MIGRATION_DIVERGENCES.md.

The three files live under src/main/scala because compileJava runs before
compileScala and they still reference TMultiPart.

Validated with 33 plain-JVM tests, a clean build, and the Java 8 Forge
dedicated-server suite.
2026-08-14 20:12:22 +02:00
FourIsTheNumber d2ce5b7362 Add postea transformer for microblock items (#48) 2026-07-04 20:02:17 -04:00
Caedis 09e2b847fc fix(microblock): prevent microblocks becoming blood rune slabs (#47) 2026-06-21 09:20:32 +02:00
Alexdoru f3a0ab0568 Delete DepLoader and declare depency properly (#31) 2025-08-01 00:42:50 +02:00
Caedis a0af5e19cf Force render return type to Unit (#30) 2025-07-02 01:16:53 +00:00
David Lindström 05eb683a33 Forward material to shader (#27) 2025-05-27 23:22:56 +02:00
Martin Robertz bc3542efd2 fix Instance() 2024-12-31 15:41:21 +01:00
Jason Mitchell 2abb775696 Thread saftey (#24)
* Update BS

* Thread Safety
2024-05-26 12:41:45 +02:00
glowredman 76a1df6eff Add version to @Mod annotations (#23) 2024-02-12 23:35:09 +01:00
bombcar 794c3ca030 fix the rest 2024-01-02 13:07:44 -06:00
bombcar ee37e779fd partial maintain state 2024-01-02 13:02:02 -06:00
bombcar 5039fb8984 update to support 1.2.0 CCL - needs work to be more performant 2024-01-02 11:38:11 -06:00
Jason Mitchell 6b18eca613 [ci skip] spotlessApply with the new settings 2023-01-29 10:24:12 -08:00
Raven Szewczyk 12bc43c8d4 Remove logging of all microblock materials: -400kiB of logs on GTNH 2022-09-26 19:07:40 +01:00
boubou_19 2e762a04c1 disabled recipe addition when NHCore is present 2022-01-08 14:59:58 +01:00
Johann Bernhardt 5a4b21349e Moved resources and sources 2021-11-19 22:54:13 +01:00