Commit Graph
53 Commits
Author SHA1 Message Date
Algent fdfd7763dd refactor: port multipart packet handlers 2026-09-01 00:50:14 +02:00
Algent f063cc94b4 refactor: port microblock proxy to java 2026-09-01 00:31:27 +02:00
Algent 0f84ff203e refactor: port multipart proxy to java 2026-09-01 00:08:20 +02:00
Algent b0b7005a5b docs: plan API deprecation and upstream consumer cleanup
Add Phase 9 and Phase 10 to the migration plan.

Phase 9 is a deprecation pass, not a redesign. The published API is already
largely Java-shaped; nine public entries still carry Scala types, two of which
already have a Java sibling. It also covers a second problem: private[multipart]
compiles to public, so seventeen implementation hooks are advertised as API.

Phase 10 covers upstream consumer cleanup, where consumer-side reflection and
Scala-trait registration constrain FMP internals. It is unsequenced and parts of
it can land before this port merges. ProjectRed's is not one of them, so its two
blockers are recorded as Phase 7 prerequisites.

Phase 8 now notes that removing Scala from FMP has no pack-level payoff.
2026-08-31 22:18:35 +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 386c3b2cef refactor: port multipart save/load 2026-08-31 14:36:02 +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 4cd63eb3c8 refactor: port multipart event handler
Preserve event-bus identity and the annotated singleton surface.
2026-08-30 21:24:49 +02:00
Algent 3e6a7ce6f3 refactor: port multipart mod to java
Preserve the Scala FML instance and packet-channel identity.
2026-08-30 16:23:14 +02:00
Algent b2bdf569e8 refactor: port multipart compatibility to java
Preserve the Scala Function4 singleton ABI and MCPC failure fallback.
2026-08-30 15:40:47 +02:00
Algent 970e888b7f refactor: port client tile traits to java
Preserve the exact generated client interfaces, render-cache behavior, and ordered display ticks.

Teach Java mixin generation to linearize a registered parent and exclude transient runtime caches from copying.
2026-08-30 15:25:15 +02:00
Algent 4e8d238b57 refactor: port inventory tile trait to java
Keep TIInventoryTile as AE2's public rebuild API and JInventoryTile as the registered mixin input, preserving both generated interfaces and flattened sided-slot behavior.
2026-08-30 13:56:05 +02:00
Algent bf8c9c24b8 refactor: port fluid handler trait to java
Preserve the exact generated interface and ordered fluid behavior.

Isolate FluidStack.amount access outside the transformed class. The transformer treats every field read as trait-owned state.
2026-08-30 13:33:05 +02:00
Algent 370b35328f perf: remove multipart read-path wrappers 2026-08-28 17:02:02 +03:00
Algent e2822d3938 refactor: port redstone tile trait to java 2026-08-28 16:16:31 +03:00
Algent 39e0858006 refactor: port slotted tile trait to java 2026-08-28 11:42:06 +03:00
Algent 6c370c8734 refactor: port partial occlusion tile trait to java 2026-08-28 11:27:29 +03:00
Algent 984d3a2f61 refactor: port microblock recipes to java 2026-08-28 11:07:57 +03:00
Algent 1cb2cc4cc6 refactor: port redstone interaction unit to java 2026-08-28 10:48:19 +03:00
Algent 54d6df002e test: add focused performance baseline 2026-08-27 20:51:57 +03:00
Algent 2aa9928ad0 test: freeze generated trait and pass-through behavior 2026-08-27 20:25:38 +03:00
Algent 57b314dd4e test: freeze multipart NBT and description packets 2026-08-27 18:11:28 +03:00
Algent 6410cc0028 test: characterize multipart ordering and move lifecycle 2026-08-27 18:02:41 +03:00
Algent 4616b5834c test: guard source-only consumer reflection contracts 2026-08-27 14:11:53 +03:00
Algent 49ed6fd751 fix: restore Schematica registry reflection compatibility 2026-08-27 14:02:47 +03:00
Algent 8d0ba7c76e docs: revise migration plan from consumer audit 2026-08-27 13:52:06 +03:00
Algent 16dd5f3dee docs: audit ForgeMultipart downstream consumers 2026-08-27 13:41:59 +03:00
Algent fa976c2002 refactor: port MultipartRenderer to Java
Kept in the TickScheduler$ shape: the companion holds the implementation
because Forge registers that instance itself, and the plain class holds static
forwarders. Both halves are load-bearing for different reasons -- guidenh
resolves renderWorldBlock as a static first and falls back to MODULE$ -- and
neither has a bytecode consumer, only reflective names.

The emitted class list is unchanged. All five rendering callbacks keep their
signatures, MODULE$ keeps its type and flags, and both classes keep class-level
@SideOnly(CLIENT). Only three Scala forwarders for inherited
TileEntitySpecialRenderer members and the companion clinit's ACC_PUBLIC differ.

The render id is still claimed in the singleton's initialiser, matching the
reference's first-access timing. The breaking-overlay branch moved to a private
helper that checks the erased Tuple2 and the boxed index before unboxing, which
is what the reference's pattern match compiled to.

125 plain-JVM tests and 22 Forge server tests pass, none changed by the port.
This class needs a client, so it adds nothing to either suite and everything to
the manual checklist.
2026-08-15 20:13:20 +02: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 40bb1b71b7 refactor: port PacketScheduler to Java
IScheduledPacketPart is descriptor-identical and schedulePacket is unchanged.
TScheduledPacketPart.read stays abstract: TMultiPart declares read, so a
default would be shadowed and a part would silently read a description instead
of a mask. The dispatch that lived in the $class helper is now the interface
static readMask, with the one-line forwarder documented on read.

writeScheduled and readScheduled became defaults. TMultiPart declares neither,
and empty bodies are what mixing the Scala trait in already gave a Scala
implementor -- only Java implementors ever had to write them out.

sendScheduled is public because the reference's private[multipart] reaches the
handler package and Java has no equivalent scope. An unsupported mask width now
throws IllegalArgumentException rather than scala.MatchError; both are
RuntimeException and the map is still left uncleared on that path, as before.

Dropped PacketScheduler$, TScheduledPacketPart$class and two closure classes,
none referenced in bytecode or by reflective name.

118 plain-JVM tests and 18 Forge server tests pass.
2026-08-15 17:04:41 +02:00
Algent 31ec83f91b refactor: port TileCache to Java
The first port free to change shape rather than preserve it: TileCache has zero
downstream references in bytecode and does not appear in guidenh's reflective
names. map() became a java.util.Map, add/remove became void, and apply returns
a nullable FlaggedTile instead of a scala.Option. No internal caller used any
of the discarded return values.

Dropped TileCache$, TileCache$FlaggedTile$ and FlaggedTile's case-class
machinery. It is only ever a map value, never compared, hashed, printed or
destructured.

findTile is unchanged, including the branch the reference obscures: its
trailing 'case _ => null' is unreachable because Some(FlaggedTile(t, rem))
matches whatever the flag holds, so a tile flagged removed is returned like any
other and only the warning is suppressed. That is pinned by a functional test
written before the port.

114 plain-JVM tests and 13 Forge server tests pass; the only test change is the
two-line adapter that stopped unwrapping a scala.Option.
2026-08-15 16:23:47 +02:00
Algent 097f527856 docs: record guidenh's reflective member surface from source
The constant-pool scan sees the 20 names guidenh reflects on but not the
members it looks up on them. Read from the checked-out source at 6137525.

Adds three constraints the ABI diff cannot see: MultipartGenerator$.MODULE$ is
the only route to generateCompositeTile because it is private[multipart] and
gets no static forwarder; MicroblockGenerator$.create is matched by exact
parameter types with MicroblockClass's FQN string-compared; and
TileMultipart.partList_$eq is reflectively load-bearing despite having no
Java-facing equivalent.

Verified the last of those survived the TileMultipart port already on this
branch, along with loadParts, notifyTileChange and markRender.
2026-08-15 16:15:19 +02:00
Algent c3d5b08ff7 refactor: port MultipartHelper to Java
MultipartHelper, MultipartHelper$ and MultipartHelper$IPartTileConverter are
all public-member- and descriptor-identical to the reference, and the full
emitted class list is unchanged -- this port neither adds nor removes a class.
MultipartHelper gains a private constructor and its companion's class
initializer loses ACC_PUBLIC, neither of which is nameable by a caller.

MultipartHelper$ was kept deliberately. It is not among the 17 MODULE$
singletons read from bytecode and no jar links against it, but guidenh names it
as a reflective string, and removing a companion breaks that invisibly.

createTileFromParts now builds one JavaConversions wrapper for both calls
instead of one per call site, and convertMulti returns Collections.emptyList or
singletonList instead of a Scala Seq wrapper. The declared type was always
java.lang.Iterable.

107 plain-JVM tests and 10 Forge server tests pass unchanged.
2026-08-15 15:47:17 +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 9f454042b4 docs: bring the migration plan up to date and add the manual checklist
The plan still showed Phases 2, 3 and 8 as untouched while most of their
work is done or answered. Adds a current status section, marks the items
that are genuinely complete, and explains why the two open Phase 2 items
are open because conversion is in progress rather than because the
approach is undecided.

Records the working rules the conversions produced, since they are the
part worth carrying into the remaining areas: check the inventory before
writing a bridge, only emit a default when no superclass in the chain
declares the member, audit existing super call sites rather than only
missing overrides, and diff concrete implementors when a trait gains a
default.

Also adds JAVA_MIGRATION_MANUAL_CHECKS.md, closing a Phase 0 item. Each
port so far has deferred something to "the manual checklist" without one
existing; this collects those into rendering, placement and downstream
integration checks, and states what is still covered nowhere.

Notes that 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.
2026-08-15 10:27:18 +02:00
Algent f2f1870931 refactor: port TItemMultiPart to Java
Replaces ItemMultiPart.scala with Java implementations of JItemMultiPart,
TItemMultiPart and the TItemMultiPart$class bridge. The interface is
descriptor-identical to the reference, JItemMultiPart keeps its
constructor and both instance methods and gains only additive statics, and
the bridge keeps all three public statics for ProjRed, its only consumer.
The emitted class-file set for this area is unchanged.

This is the first converted trait that extends a Minecraft class rather
than TMultiPart, so the linearization check ran against Item. The same
split applied: getHitDepth became a real default because Item does not
declare it, while onItemUse stayed abstract because Item does and a
default would silently lose to the vanilla implementation. The rule
generalises to the implementor's actual superclass.

The bridge's getHitDepth ignores its part argument and calls the static
directly, matching the reference whose trait body never used this. The
onItemUse path still dispatches getHitDepth through the interface, so an
implementor's override is honoured.

Validated with 57 plain-JVM tests, a clean build, and the Java 8 Forge
dedicated-server suite.
2026-08-14 21:25:57 +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 57130a6955 refactor: port TFacePart to Java
Replaces TFacePart.scala with a Java interface and retains the
TFacePart$class bridge for OpenComputers, ProjRed and ProjectBlue. The
interface is descriptor-identical to the reference; the bridge adds only a
private constructor.

This is the first converted trait where Java default methods are safe.
TMultiPart declares neither solid nor redstoneConductionMap, and neither
does anything in the microblock superclass chain, so there is no
superclass method for a default to lose to. Both members therefore become
real defaults rather than staying abstract with explicit forwarders, and
no in-repo Scala needed changing. The rule for the remaining traits is to
check that condition before choosing.

A side effect is that Java classes can now inherit these members;
McSidedMetaPart previously had to declare both just to accept the
defaults, and stays descriptor-identical.

Adds the first functional coverage of runtime class generation against a
ported type. Microblock classes are built by ASM at run time, so the
server suite now checks that a generated FaceMicroblock resolves the
inherited default and that a generated HollowMicroblock still returns its
own overrides.

Validated with 43 plain-JVM tests, a clean build, and the Java 8 Forge
dedicated-server suite at 3 tests.
2026-08-14 21:00:18 +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
Algent 246dafffda refactor: drop unused IDWriter and JPartialOcclusion Scala bridges
The downstream ABI inventory scanned 240 mod jars in GTNH daily
2026-08-14+678 and found no consumer of either bridge. Both were written
speculatively, before the inventory existed.

IDWriter had no downstream reference at all, so its four Scala function
accessors are removed and the class now selects a carrier width directly.
That also removes the Integer boxing and Function1/Function2 allocation
per read and write that the first port had preserved. Calling write or
read before setMax now throws IllegalStateException rather than
NullPointerException; no caller reaches that state.

JPartialOcclusion$class had no downstream reference either. The two
consumers that touch JPartialOcclusion only call getPartialOcclusionBoxes,
and the two jars that implement the interface emit no call to the helper.
The interface and both of its method descriptors are unchanged. The
ReferenceScalaPartialOcclusion fixture is removed with the helper it
existed to verify.

Validated with 27 plain-JVM tests, a clean checkstyleTest build with
Spotless re-enabled, and the Java 8 Forge dedicated-server suite.
2026-08-14 19:52:28 +02:00
Algent 78959e70e9 docs: inventory downstream ForgeMultipart ABI consumers 2026-08-14 19:48:01 +02:00
Algent a0428b9994 refactor: port partial occlusion to Java
Keep the Scala trait helper so reference-compiled implementations remain linkable.
2026-08-14 18:24:59 +02:00
Algent 2c610bdb48 refactor: port IDWriter to Java
Keep Scala function descriptors as deprecated bridges while adding primitive Java entry points.
2026-08-14 18:02:03 +02:00
Algent 07530d93bf test: characterize partial occlusion
Freeze voxel ownership and visibility rules before the Java port.
2026-08-14 17:46:30 +02:00