Commit Graph
63 Commits
Author SHA1 Message Date
Algent 37d5ea98f6 docs: define direct Java material access 2026-09-05 14:58:24 +02:00
Algent b7d28fb794 docs: define Java microblock creation contract 2026-09-05 14:28:06 +02:00
Algent 2bb5e7ffc9 feat: add Java material enumeration 2026-09-04 23:30:54 +02:00
Algent 5995e366b7 fix: preserve material property dispatch 2026-09-04 22:53:52 +02:00
Algent fd29e0a737 fix: preserve microblock state dispatch 2026-09-04 22:47:31 +02:00
Algent fa41ae0609 refactor: port micro occlusion client to Java 2026-09-04 00:32:48 +02:00
Algent f6d1568399 refactor: port micro occlusion logic to Java 2026-09-04 00:16:03 +02:00
Algent a50ce52cd3 refactor: port hollow microblock client to Java 2026-09-04 00:00:37 +02:00
Algent 940609bf46 refactor: port hollow microblock logic to Java 2026-09-03 23:31:25 +02:00
Algent 556fd519bb refactor: port post microblock client to Java
Retain Scala state and lifecycle bridges with ordered virtual dispatch.
2026-09-03 22:57:12 +02:00
Algent 1c7dd1424d refactor: port post microblock logic to Java
Retain Scala super dispatch and trait metadata for generated mixins.
2026-09-03 22:37:43 +02:00
Algent 7c4c87ec08 refactor: port edge microblock logic to Java
Retain Scala trait metadata and helper bridges for generated mixins.
2026-09-03 22:13:24 +02:00
Algent 33e0bc2ad3 refactor: port corner microblock logic to Java
Retain Scala trait declarations and helper bridges for inherited mixin registration and existing consumers.
2026-09-03 22:01:12 +02:00
Algent cfde82235a refactor: port face microblock logic to Java
Retain Scala trait declarations and helper bridges for inherited mixin registration and existing consumers.
2026-09-03 21:43:37 +02:00
Algent d89aaeacf3 refactor: port common microblock logic to Java
Retain Scala trait declarations and helper bridges for inherited mixin registration and existing consumers.
2026-09-03 21:14:54 +02:00
Algent 2f4972e6fd refactor: port microblock generator to Java 2026-09-02 11:25:04 +02:00
Algent 34aeb7c0d3 refactor: port micro occlusion to Java 2026-09-02 10:47:38 +02:00
Algent 33510e74bd refactor: port hollow microblock factory 2026-09-02 01:23:47 +02:00
Algent df212470e6 refactor: port edge and post factories 2026-09-02 01:00:12 +02:00
Algent d9ecf087ad refactor: port corner microblock factory 2026-09-02 00:33:54 +02:00
Algent 2f60e60193 refactor: port face microblock factory 2026-09-01 20:12:54 +02:00
Algent fa675676ae refactor: port microblock base to Java 2026-09-01 19:54:41 +02:00
Algent 7172af4573 refactor: port microblock classes to Java 2026-09-01 19:34:51 +02:00
Algent 6c54b740ac refactor: port microblock renderer to Java 2026-09-01 19:18:47 +02:00
Algent 0d03dea7b6 refactor: port saw item and renderer to Java 2026-09-01 19:01:26 +02:00
Algent 4761336d7b refactor: port Angelica compat to Java 2026-09-01 18:46:14 +02:00
Algent 80edf9bd01 refactor: port config content to Java 2026-09-01 14:13:05 +02:00
Algent d334d21653 refactor: port block micro material to Java 2026-09-01 13:50:41 +02:00
Algent 1939159564 refactor: port placement grids to Java 2026-09-01 10:25:36 +02:00
Algent c20b6bf9d9 refactor: port microblock placement to Java 2026-09-01 10:06:34 +02:00
Algent 2808742f26 refactor: port ItemMicroPart to Java 2026-09-01 08:35:56 +02:00
Algent f063cc94b4 refactor: port microblock proxy to java 2026-09-01 00:31:27 +02:00
Algent 86d8c14c4f refactor: port grass micro materials to java 2026-08-31 20:09:40 +02:00
Algent 8d4ad03223 refactor: port default content to java
Preserve the exact built-in factory, material, and remap registrations.
2026-08-31 19:45:20 +02:00
Algent 9a8bbfd7a7 refactor: port missing micro material
Preserve the singleton ABI, client stripping, and placeholder registration.
2026-08-31 19:12:26 +02:00
Algent 471c767d33 refactor: port microblock packet handlers
Preserve the registry channel, singleton ABI, client skip, and handshake payload.
2026-08-31 13:51:22 +02:00
Algent 1c91fbb4c9 refactor: port microblock event handler
Preserve the client-only ABI and dedicated-server side stripping.
2026-08-30 22:02:48 +02:00
Algent 1946ea4695 refactor: port microblock mod to java
Preserve the Scala FML instance and mutable Angelica compatibility hook.
2026-08-30 21:45:10 +02:00
Algent 984d3a2f61 refactor: port microblock recipes to java 2026-08-28 11:07:57 +03:00
Algent d224ce116d refactor: remove the package objects instead of porting them
A Scala package object compiles to a class literally named 'package', and that
is a Java keyword, so no Java source can declare or even name it. The
characterization had to reach both through Class.forName, which is the argument
in one line. There is no Java form to port to.

Each held exactly one member, a logger alias for its proxy, so the indirection
is inlined at its eight call sites: ConfigContent (7) and MultipartGenerator
(1). The functional characterization asserted beforehand that each alias
returned the very instance its proxy holds, so the substitution is an identity;
both classes are descriptor-identical afterwards.

Exactly four classes leave the jar and nothing else changes. No consumer
referenced them, and no Java consumer could have.

120 plain-JVM tests and 22 Forge server tests pass. PackageObjectCharacterization
went with its subject; ProxyLoggerFunctionalTest keeps the assertion worth
having, that both proxies publish a logger during preInit.
2026-08-15 20:04:55 +02:00
Algent a2797c986b refactor: port ControlKeyModifer and ControlKeyHandler to Java
isControlDown(EntityPlayer) and isClientPressing() keep their descriptors.
map() became a java.util.Map and isClientPressing_$eq became setClientPressing.

Dropped playerControlValue and ControlKeyValue. They existed only to give Scala
player.isControlDown sugar through an implicit conversion, and the reference
already shipped the explicit static 'for Java users'. MicroblockPlacement now
calls that static directly.

ControlKeyHandler was a Scala object extending KeyBinding, so the instance both
the key registry and the event bus needed was ControlKeyHandler$.MODULE$. It is
now an ordinary KeyBinding subclass with an INSTANCE constant, which also drops
the twelve static forwarders Scala generated for inherited KeyBinding members.

The misspelling in ControlKeyModifer is the published type name and is kept;
only the file name, which said ControlKeyModifier.scala, is corrected.

120 plain-JVM tests and 21 Forge server tests pass, none of them changed by the
port.
2026-08-15 19:45:53 +02:00
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