mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-23 21:49:56 +00:00
refactor: port corner microblock logic to Java
Retain Scala trait declarations and helper bridges for inherited mixin registration and existing consumers.
This commit is contained in:
1 parent
82da4522bd
commit
33e0bc2ad3
6 files changed
+75
-34
No files matched your search
@@ -0,0 +1,21 @@
|
||||
package codechicken.microblock;
|
||||
|
||||
import codechicken.lib.vec.Cuboid6;
|
||||
|
||||
/** Corner behavior behind the retained Scala inheritance metadata and helper bridges. */
|
||||
final class CornerMicroblockTraitLogic {
|
||||
|
||||
private CornerMicroblockTraitLogic() {}
|
||||
|
||||
static void setShape(CornerMicroblock part, int size, int slot) {
|
||||
((Microblock) part).shape_$eq((byte) (size << 4 | (slot - 7)));
|
||||
}
|
||||
|
||||
static Cuboid6 getBounds(CornerMicroblock part) {
|
||||
return CornerMicroClass.aBounds()[((Microblock) part).shape()];
|
||||
}
|
||||
|
||||
static int getSlot(CornerMicroblock part) {
|
||||
return ((Microblock) part).getShape() + 7;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package codechicken.microblock
|
||||
|
||||
// Retain Scala inheritance metadata and helper bridges for generated and external mixins.
|
||||
trait CornerMicroblock extends CommonMicroblock {
|
||||
override def setShape(size: Int, slot: Int) = shape_$eq(
|
||||
(size << 4 | (slot - 7)).toByte
|
||||
)
|
||||
override def setShape(size: Int, slot: Int) =
|
||||
CornerMicroblockTraitLogic.setShape(this, size, slot)
|
||||
|
||||
def microClass = CornerMicroClass$.MODULE$
|
||||
|
||||
def getBounds = CornerMicroClass.aBounds()(shape)
|
||||
def getBounds = CornerMicroblockTraitLogic.getBounds(this)
|
||||
|
||||
override def getSlot = getShape + 7
|
||||
override def getSlot = CornerMicroblockTraitLogic.getSlot(this)
|
||||
}
|
||||
Reference in new issue
Block a user