Files
ForgeMultipart/src/main/scala/codechicken/multipart/TFacePart.java
T
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

23 lines
728 B
Java

package codechicken.multipart;
/**
* Interface which must be implemented by parts that go in a face part.
* <p>
* TMultiPart declares neither member, so unlike the other converted traits these can safely be default methods.
*/
public interface TFacePart extends TSlottedPart {
/** Passed down from Block.isSideSolid. Return true if this part is solid and opaque on the specified side. */
default boolean solid(int side) {
return true;
}
/**
* Return the redstone conduction map for which signal can pass through this part on the face. Eg, hollow covers
* return 0x10 as signal can pass through the center hole.
*/
default int redstoneConductionMap() {
return 0;
}
}