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

73 lines
2.2 KiB
Java

package codechicken.multipart;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import codechicken.lib.packet.PacketCustom;
import codechicken.lib.vec.BlockCoord;
import codechicken.lib.vec.Vector3;
import scala.Tuple2;
/**
* Scala companion singleton. Retained because compiled Scala consumers read MODULE$ and call these instance methods.
*/
public final class TileMultipart$ {
public static final TileMultipart$ MODULE$ = new TileMultipart$();
private TileMultipart$() {}
public int renderID() {
return TileMultipart.renderID();
}
public void renderID_$eq(int value) {
TileMultipart.renderID_$eq(value);
}
public TileMultipart getOrConvertTile(World world, BlockCoord pos) {
return TileMultipart.getOrConvertTile(world, pos);
}
public Tuple2<TileMultipart, Object> getOrConvertTile2(World world, BlockCoord pos) {
return TileMultipart.getOrConvertTile2(world, pos);
}
public TileMultipart getTile(World world, BlockCoord pos) {
return TileMultipart.getTile(world, pos);
}
public boolean checkNoEntityCollision(World world, BlockCoord pos, TMultiPart part) {
return TileMultipart.checkNoEntityCollision(world, pos, part);
}
public boolean canPlacePart(World world, BlockCoord pos, TMultiPart part) {
return TileMultipart.canPlacePart(world, pos, part);
}
public boolean replaceable(World world, BlockCoord pos) {
return TileMultipart.replaceable(world, pos);
}
public TileMultipart addPart(World world, BlockCoord pos, TMultiPart part) {
return TileMultipart.addPart(world, pos, part);
}
public void handleDescPacket(World world, BlockCoord pos, PacketCustom packet) {
TileMultipart.handleDescPacket(world, pos, packet);
}
public void handlePacket(BlockCoord pos, World world, int i, PacketCustom packet) {
TileMultipart.handlePacket(pos, world, i, packet);
}
public TileMultipart createFromNBT(NBTTagCompound tag) {
return TileMultipart.createFromNBT(tag);
}
public void dropItem(ItemStack stack, World world, Vector3 pos) {
TileMultipart.dropItem(stack, world, pos);
}
}