This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class ItemNBTHolder(val stack: ItemStack, val compound: CompoundNBT) { | |
protected fun byte(defaultValue: Byte) = SimpleNBTDelegate(defaultValue, CompoundNBT::getByte, CompoundNBT::putByte) | |
protected fun short(defaultValue: Short) = SimpleNBTDelegate(defaultValue, CompoundNBT::getShort, CompoundNBT::putShort) | |
protected fun int(defaultValue: Int) = SimpleNBTDelegate(defaultValue, CompoundNBT::getInt, CompoundNBT::putInt) | |
protected fun long(defaultValue: Long) = SimpleNBTDelegate(defaultValue, CompoundNBT::getLong, CompoundNBT::putLong) | |
protected fun float(defaultValue: Float) = SimpleNBTDelegate(defaultValue, CompoundNBT::getFloat, CompoundNBT::putFloat) | |
protected fun double(defaultValue: Double) = SimpleNBTDelegate(defaultValue, CompoundNBT::getDouble, CompoundNBT::putDouble) | |
protected fun string(defaultValue: String) = SimpleNBTDelegate(defaultValue, CompoundNBT::getString, CompoundNBT::putString) | |
protected fun byteArray(defaultValue: ByteArray = ByteArray(0)) = SimpleN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExampleItem : Item(Properties().group(ItemGroup.MISC)) { | |
/** | |
* root | |
* |- someString (String) | |
* |- someBoolean (Boolean) | |
* |- nested (Compound) | |
* - |- immutableString (String) | |
* |- nullableUUID (UUID) | |
* |- evenMoreNested (Compound) | |
* - |- someIntArray (int[]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val INSIDE_SHAPE: VoxelShape by lazy { | |
voxelShape { cube(2 by 2 by 2, 14 by 14 by 14) } | |
} | |
private val OUTSIDE_SHAPE: VoxelShape by lazy { | |
voxelShape { | |
shape { fullCube } | |
-voxelShape { | |
cube(2 by 2 by 0, 14 by 14 by 16) | |
+voxelShape { cube(2 by 0 by 2, 14 by 16 by 14) } |