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.
This commit is contained in:
Algent committed 2026-08-15 15:32:45 +02:00
1 parent 3e68e67599
commit 9db07f8c7c
15 files changed
+189 -107

No files matched your search

@@ -0,0 +1,26 @@
package codechicken.microblock;
import net.minecraft.world.World;
import codechicken.lib.vec.Cuboid6;
/**
* Wrapper class blocks/tiles/parts wanting to use the micro material system to render part of their models.
* <p>
* The accessors keep their Scala names because TMultiPart already declares world/x/y/z/getRenderBounds under exactly
* these names, which is what implements this interface for every part.
*/
public interface IMicroMaterialRender {
/** May be null for inventory rendering. */
World world();
int x();
int y();
int z();
/** Return the bounds of the part for texture mapping side decals like grass. */
Cuboid6 getRenderBounds();
}
@@ -1,21 +0,0 @@
package codechicken.microblock
import codechicken.lib.vec.Cuboid6
import net.minecraft.world.World
/** Wrapper class blocks/tiles/parts wanting to use the micro material system to
* render part of their models.
*/
trait IMicroMaterialRender {
/** May be null for inventory rendering.
*/
def world: World
def x: Int
def y: Int
def z: Int
/** Return the bounds of the part for texture mapping side decals like grass
*/
def getRenderBounds: Cuboid6
}
@@ -0,0 +1,14 @@
package codechicken.microblock;
/**
* Implement this on center parts that connect through hollow covers to have the covers render their hollows to fit the
* connection size.
*/
public interface ISidedHollowConnect {
/**
* @param side The side of the block on which the cover resides
* @return The size (width and height) of the connection in pixels. Must be less than 12 and more than 0
*/
int getHollowSize(int side);
}
@@ -1,15 +0,0 @@
package codechicken.microblock
/** Implement this on center parts that connect through hollow covers to have
* the covers render their hollows to fit the connection size
*/
trait ISidedHollowConnect {
/** @param side
* The side of the block on which the cover resides
* @return
* The size (width and height) of the connection in pixels. Must be be less
* than 12 and more than 0
*/
def getHollowSize(side: Int): Int
}
@@ -0,0 +1,14 @@
package codechicken.multipart;
/**
* Mixin interface for parts that want to be notified of neighbor tile change events (comparators or inventory
* maintainers).
*/
public interface INeighborTileChange {
/** Returns whether this part needs calls for tile changes through one solid block. */
boolean weakTileChanges();
/** Callback for neighbor tile changes, from same function in Block. */
void onNeighborTileChanged(int side, boolean weak);
}
@@ -1,16 +0,0 @@
package codechicken.multipart
/** Mixin interface for parts that want to be notified of neighbor tile change
* events (comparators or inventory maintainers)
*/
trait INeighborTileChange {
/** Returns whether this part needs calls for tile changes through one solid
* block
*/
def weakTileChanges(): Boolean
/** Callback for neighbor tile changes, from same function in Block
*/
def onNeighborTileChanged(side: Int, weak: Boolean)
}
@@ -0,0 +1,14 @@
package codechicken.multipart;
import java.util.Random;
/**
* Interface for parts that need random display ticks (torches).
* <p>
* Marker interface for TRandomDisplayTickTile.
*/
public interface IRandomDisplayTick {
/** Called on a random display tick. */
void randomDisplayTick(Random random);
}
@@ -1,14 +0,0 @@
package codechicken.multipart
import java.util.Random
/** Interface for parts that need random display ticks (torches)
*
* Marker interface for TRandomDisplayTickTile
*/
trait IRandomDisplayTick {
/** Called on a random display tick.
*/
def randomDisplayTick(random: Random)
}
@@ -0,0 +1,30 @@
package codechicken.multipart;
/**
* Interface for parts with random update ticks. Used in conjunction with TickScheduler.
* <p>
* The Scala trait extended TMultiPart, but a trait extending a class is a bare interface in bytecode, so implementors
* must extend TMultiPart themselves.
*/
public interface TRandomUpdateTick {
/**
* Called on random update. Random ticks are between 800 and 1600 ticks from their last scheduled/random tick.
*/
void randomUpdate();
/**
* Registers the part for random ticking. This cannot be a default method: TMultiPart declares onWorldJoin, and a
* superclass method always beats an interface default, so the default would never run. Every implementor must
* declare it and call {@link TickScheduler#loadRandomTick(TRandomUpdateTick)} itself.
*
* <pre>
*
* &#64;Override
* public void onWorldJoin() {
* TickScheduler.loadRandomTick(this);
* }
* </pre>
*/
void onWorldJoin();
}
@@ -1,19 +0,0 @@
package codechicken.multipart
/** Interface for parts with random update ticks. Used in conjuction with
* TickScheduler
*/
trait TRandomUpdateTick extends TMultiPart {
/** Called on random update. Random ticks are between 800 and 1600 ticks from
* their last scheduled/random tick
*/
def randomUpdate()
/** If implementing interface in java, be sure to implement this method
* yourself
*/
override def onWorldJoin() {
TickScheduler.loadRandomTick(this)
}
}
@@ -0,0 +1,16 @@
package codechicken.multipart;
/**
* Interface for parts that fill a slot based configuration as defined in PartMap. If this is implemented, calling
* partMap(slot) on the host tile will return this part if the corresponding bit in the slotMask is set.
* <p>
* Marker interface for TSlottedTile.
* <p>
* The Scala trait extended TMultiPart, but a trait extending a class is a bare interface in bytecode, so implementors
* must extend TMultiPart themselves.
*/
public interface TSlottedPart {
/** A bitmask of slots that this part fills. Slot x is 1&lt;&lt;x. */
int getSlotMask();
}
@@ -1,14 +0,0 @@
package codechicken.multipart
/** Interface for parts that fill a slot based configuration as defined in
* PartMap. If this is implemented, calling partMap(slot) on the host tile will
* return this part if the corresponding bit in the slotMask is set
*
* Marker interface for TSlottedTile
*/
trait TSlottedPart extends TMultiPart {
/** a bitmask of slots that this part fills. slot x is 1<<x
*/
def getSlotMask: Int
}