diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DecorativeData.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DecorativeData.kt index c104e939d..4a13dd03c 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DecorativeData.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DecorativeData.kt @@ -230,16 +230,16 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr blockStateProvider.getVariantBuilder(MBlocks.LABORATORY_LAMP).forAllStates { return@forAllStates ConfiguredModel.builder() .modelFile(if (it[BlockStateProperties.LIT]) labLampOn!! else labLampOff!!) - .rotationX(it[BlockRotationFreedom.XZ_XY.property].front.xRotationBlockstateNorth()) - .rotationY(it[BlockRotationFreedom.XZ_XY.property].front.yRotationBlockstateNorth()) + .rotationX(it[BlockRotationFreedom.DIRECTIONAL.property].front.xRotationBlockstateNorth()) + .rotationY(it[BlockRotationFreedom.DIRECTIONAL.property].front.yRotationBlockstateNorth()) .build() } blockStateProvider.getVariantBuilder(MBlocks.LABORATORY_LAMP_INVERTED).forAllStates { return@forAllStates ConfiguredModel.builder() .modelFile(if (it[BlockStateProperties.LIT]) labLampOn!! else labLampOff!!) - .rotationX(it[BlockRotationFreedom.XZ_XY.property].front.xRotationBlockstateNorth()) - .rotationY(it[BlockRotationFreedom.XZ_XY.property].front.yRotationBlockstateNorth()) + .rotationX(it[BlockRotationFreedom.DIRECTIONAL.property].front.xRotationBlockstateNorth()) + .rotationY(it[BlockRotationFreedom.DIRECTIONAL.property].front.yRotationBlockstateNorth()) .build() } } diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/Banks.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/Banks.kt index a225b8566..7302eeb0c 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/Banks.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/Banks.kt @@ -28,7 +28,7 @@ open class BatteryBankProvider(event: GatherDataEvent) : BlockStateProvider(even forAllStates { ConfiguredModel.builder() .modelFile(models().getExistingFile(modLocation("block/$block"))) - .rotationY(it[BlockRotationFreedom.XZ.property].front.yRotationBlockstateNorth()) + .rotationY(it[BlockRotationFreedom.HORIZONTAL.property].front.yRotationBlockstateNorth()) .build() } } diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/BlockStates.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/BlockStates.kt index 96e676f1a..780b7f7ac 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/BlockStates.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/BlockStates.kt @@ -36,54 +36,54 @@ fun addBlockStates(provider: MatteryBlockStateProvider) { provider.exec { with(provider.getMultipartBuilder(MBlocks.PHANTOM_ATTRACTOR)) { - for (dir in BlockRotationFreedom.XZ.possibleValues) { + for (dir in BlockRotationFreedom.HORIZONTAL.possibleValues) { part().modelFile(provider.models().getExistingFile(modLocation("block/${MNames.PHANTOM_ATTRACTOR}"))) .rotationY(dir.front.yRotationBlockstateNorth()) .addModel() .condition(BlockStateProperties.DOUBLE_BLOCK_HALF, DoubleBlockHalf.LOWER) - .condition(BlockRotationFreedom.XZ.property, dir) + .condition(BlockRotationFreedom.HORIZONTAL.property, dir) .end() } } with(provider.getMultipartBuilder(MBlocks.ANDROID_CHARGER)) { - for (dir in BlockRotationFreedom.XZ.possibleValues) { + for (dir in BlockRotationFreedom.HORIZONTAL.possibleValues) { for (part in AndroidChargerBlock.PART.possibleValues) { part().modelFile(provider.models().getExistingFile(modLocation("block/${MNames.ANDROID_CHARGER}_${part.serializedName}"))) .rotationY(dir.front.yRotationBlockstateNorth()) .addModel() .condition(AndroidChargerBlock.PART, part) - .condition(BlockRotationFreedom.XZ.property, dir) + .condition(BlockRotationFreedom.HORIZONTAL.property, dir) .end() } } } with(provider.getMultipartBuilder(MBlocks.MATTER_BOTTLER)) { - for (dir in BlockRotationFreedom.XZ.possibleValues) { + for (dir in BlockRotationFreedom.HORIZONTAL.possibleValues) { for (enum in WorkerState.SEMI_WORKER_STATE.possibleValues) { part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name.lowercase()}"))) .rotationY(dir.front.yRotationBlockstateNorth()) .addModel() - .condition(BlockRotationFreedom.XZ.property, dir) + .condition(BlockRotationFreedom.HORIZONTAL.property, dir) .condition(WorkerState.WORKER_STATE, enum) .end() } } - for (dir in BlockRotationFreedom.XZ.possibleValues) { + for (dir in BlockRotationFreedom.HORIZONTAL.possibleValues) { for (enum in MatterBottlerBlock.SLOT_PROPERTIES) { part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name}_open"))) .rotationY(dir.front.yRotationBlockstateNorth()) .addModel() - .condition(BlockRotationFreedom.XZ.property, dir) + .condition(BlockRotationFreedom.HORIZONTAL.property, dir) .condition(enum, false) .end() part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name}_closed"))) .rotationY(dir.front.yRotationBlockstateNorth()) .addModel() - .condition(BlockRotationFreedom.XZ.property, dir) + .condition(BlockRotationFreedom.HORIZONTAL.property, dir) .condition(enum, true) .end() } @@ -116,19 +116,19 @@ fun addBlockStates(provider: MatteryBlockStateProvider) { modLocation("${crate.registryName!!.path}_${if (it.getValue( CargoCrateBlock.IS_OPEN)) "open" else "closed"}") )) - .rotationY(it.getValue(BlockRotationFreedom.XZ.property).front.yRotationBlockstateNorth()) + .rotationY(it.getValue(BlockRotationFreedom.HORIZONTAL.property).front.yRotationBlockstateNorth()) .buildLast() ) } } with(provider.getMultipartBuilder(MBlocks.STORAGE_BUS)) { - for (dir in BlockRotationFreedom.XZ_XY.possibleValues) { + for (dir in BlockRotationFreedom.DIRECTIONAL.possibleValues) { part().modelFile(provider.models().getExistingFile(modLocation("storage_bus"))) .rotationX(dir.front.xRotationBlockstateNorth()) .rotationY(dir.front.yRotationBlockstateNorth()) .addModel() - .condition(BlockRotationFreedom.XZ_XY.property, dir) + .condition(BlockRotationFreedom.DIRECTIONAL.property, dir) .end() part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_connection"))) @@ -144,12 +144,12 @@ fun addBlockStates(provider: MatteryBlockStateProvider) { } with(provider.getMultipartBuilder(MBlocks.STORAGE_IMPORTER)) { - for (dir in BlockRotationFreedom.XZ_XY.possibleValues) { + for (dir in BlockRotationFreedom.DIRECTIONAL.possibleValues) { part().modelFile(provider.models().getExistingFile(modLocation("storage_importer"))) .rotationX(dir.front.xRotationBlockstateNorth()) .rotationY(dir.front.yRotationBlockstateNorth()) .addModel() - .condition(BlockRotationFreedom.XZ_XY.property, dir) + .condition(BlockRotationFreedom.DIRECTIONAL.property, dir) .end() part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_connection"))) @@ -165,12 +165,12 @@ fun addBlockStates(provider: MatteryBlockStateProvider) { } with(provider.getMultipartBuilder(MBlocks.STORAGE_EXPORTER)) { - for (dir in BlockRotationFreedom.XZ_XY.possibleValues) { + for (dir in BlockRotationFreedom.DIRECTIONAL.possibleValues) { part().modelFile(provider.models().getExistingFile(modLocation("storage_exporter"))) .rotationX(dir.front.xRotationBlockstateNorth()) .rotationY(dir.front.yRotationBlockstateNorth()) .addModel() - .condition(BlockRotationFreedom.XZ_XY.property, dir) + .condition(BlockRotationFreedom.DIRECTIONAL.property, dir) .end() part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_connection"))) diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/ComplexBlockStates.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/ComplexBlockStates.kt index 05e00e779..dbadd096c 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/ComplexBlockStates.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/ComplexBlockStates.kt @@ -12,12 +12,12 @@ import ru.dbotthepony.mc.otm.registry.MBlocks fun addComplexBlockStates(provider: MatteryBlockStateProvider) { with(provider.getMultipartBuilder(MBlocks.DRIVE_VIEWER)) { - for (facing in BlockRotationFreedom.XZ.possibleValues) { + for (facing in BlockRotationFreedom.HORIZONTAL.possibleValues) { part() .modelFile(provider.models().getExistingFile(modLocation("block/drive_viewer_drive_part"))) .rotationY(facing.front.yRotationBlockstateNorth()) .addModel() - .condition(BlockRotationFreedom.XZ.property, facing) + .condition(BlockRotationFreedom.HORIZONTAL.property, facing) .condition(DriveViewerBlock.DRIVE_PRESENT, true) for (workState in WorkerState.SEMI_WORKER_STATE.possibleValues) { @@ -26,25 +26,25 @@ fun addComplexBlockStates(provider: MatteryBlockStateProvider) { .rotationY(facing.front.yRotationBlockstateNorth()) .addModel() .condition(WorkerState.SEMI_WORKER_STATE, workState) - .condition(BlockRotationFreedom.XZ.property, facing) + .condition(BlockRotationFreedom.HORIZONTAL.property, facing) } } } with(provider.getMultipartBuilder(MBlocks.PATTERN_STORAGE)) { - for (facing in BlockRotationFreedom.XZ.possibleValues) { + for (facing in BlockRotationFreedom.HORIZONTAL.possibleValues) { part() .modelFile(provider.models().getExistingFile(modLocation("block/pattern_storage"))) .rotationY(facing.front.yRotationBlockstateNorth()) .addModel() - .condition(BlockRotationFreedom.XZ.property, facing) + .condition(BlockRotationFreedom.HORIZONTAL.property, facing) for (i in 0 .. 7) { part() .modelFile(provider.models().getExistingFile(modLocation("block/pattern/model$i"))) .rotationY(facing.front.yRotationBlockstateNorth()) .addModel() - .condition(BlockRotationFreedom.XZ.property, facing) + .condition(BlockRotationFreedom.HORIZONTAL.property, facing) .condition(PatternStorageBlock.PATTERN_STORAGE_DISKS_PROPS[i], true) } } diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/MatteryBlockStateProvider.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/MatteryBlockStateProvider.kt index 2b2724bbf..4aa2544be 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/MatteryBlockStateProvider.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/MatteryBlockStateProvider.kt @@ -21,16 +21,16 @@ private val EMPTY: BlockStateTransform = { _, _, _ -> null } private fun initialTransform(it: BlockState, modelPath: String, builder: ConfiguredModel.Builder<*>): String { @Suppress("NAME_SHADOWING") var modelPath = modelPath - it.getValueNullable(BlockRotationFreedom.XZ.property)?.let { + it.getValueNullable(BlockRotationFreedom.HORIZONTAL.property)?.let { builder.rotationY(it.front.yRotationBlockstateNorth()) } - it.getValueNullable(BlockRotationFreedom.XZ_XY.property)?.let { + it.getValueNullable(BlockRotationFreedom.DIRECTIONAL.property)?.let { builder.rotationY(it.front.yRotationBlockstateNorth()) builder.rotationX(it.front.xRotationBlockstateNorth()) } - it.getValueNullable(BlockRotationFreedom.XZ_XY_ZY.property)?.let { + it.getValueNullable(BlockRotationFreedom.DIRECTIONAL_WITH_ROTATION.property)?.let { builder.rotationY(it.front.yRotationBlockstateNorth() + it.top.yRotationBlockstateNorth()) builder.rotationX(it.front.xRotationBlockstateNorth()) } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/MatteryBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/MatteryBlock.kt index c30bdb301..e234863ad 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/MatteryBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/MatteryBlock.kt @@ -115,9 +115,9 @@ abstract class MatteryBlock @JvmOverloads constructor( val state = blockState.getOptionalValue(WorkerState.WORKER_STATE).or { blockState.getOptionalValue(WorkerState.SEMI_WORKER_STATE) } if (state.isPresent && state.get() == WorkerState.WORKING) { - val state2 = blockState.getOptionalValue(BlockRotationFreedom.XZ.property) - .or { blockState.getOptionalValue(BlockRotationFreedom.XZ_XY.property) } - .or { blockState.getOptionalValue(BlockRotationFreedom.XZ_XY_ZY.property) } + val state2 = blockState.getOptionalValue(BlockRotationFreedom.HORIZONTAL.property) + .or { blockState.getOptionalValue(BlockRotationFreedom.DIRECTIONAL.property) } + .or { blockState.getOptionalValue(BlockRotationFreedom.DIRECTIONAL_WITH_ROTATION.property) } if (state2.isPresent) { val direction = state2.get() diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/RotatableMatteryBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/RotatableMatteryBlock.kt index 652634be9..602ec1b99 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/RotatableMatteryBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/RotatableMatteryBlock.kt @@ -10,7 +10,7 @@ import ru.dbotthepony.mc.otm.core.get import ru.dbotthepony.mc.otm.core.math.BlockRotation import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom -abstract class RotatableMatteryBlock @JvmOverloads constructor(properties: Properties = DEFAULT_PROPERTIES) : MatteryBlock(properties) { +abstract class RotatableMatteryBlock(properties: Properties = DEFAULT_PROPERTIES) : MatteryBlock(properties) { init { @Suppress("LeakingThis") registerDefaultState(getStateDefinition().any().setValue(rotationProperty, BlockRotation.SOUTH)) @@ -22,17 +22,17 @@ abstract class RotatableMatteryBlock @JvmOverloads constructor(properties: Prope override fun getStateForPlacement(context: BlockPlaceContext): BlockState? { return when (val freedom = rotationFreedom()) { - BlockRotationFreedom.XZ -> defaultBlockState().setValue( + BlockRotationFreedom.HORIZONTAL -> defaultBlockState().setValue( freedom.property, freedom.of(if (faceToPlayer(context)) context.horizontalDirection.opposite else context.horizontalDirection) ) - BlockRotationFreedom.XZ_XY -> defaultBlockState().setValue( + BlockRotationFreedom.DIRECTIONAL -> defaultBlockState().setValue( freedom.property, freedom.of(if (faceToPlayer(context)) context.nearestLookingDirection.opposite else context.nearestLookingDirection) ) - BlockRotationFreedom.XZ_XY_ZY -> { + BlockRotationFreedom.DIRECTIONAL_WITH_ROTATION -> { val primary = if (faceToPlayer(context)) context.nearestLookingDirection.opposite else context.nearestLookingDirection var secondary = if (faceToPlayer(context)) context.horizontalDirection else context.horizontalDirection.opposite @@ -46,7 +46,7 @@ abstract class RotatableMatteryBlock @JvmOverloads constructor(properties: Prope ) } - BlockRotationFreedom.FOUR -> TODO("Can't rotate with four rotation freedom yet") + BlockRotationFreedom.FULL -> TODO("Can't rotate with four rotation freedom yet") } } @@ -59,7 +59,7 @@ abstract class RotatableMatteryBlock @JvmOverloads constructor(properties: Prope val rotationProperty get() = rotationFreedom().property open fun rotationFreedom(): BlockRotationFreedom { - return BlockRotationFreedom.XZ + return BlockRotationFreedom.HORIZONTAL } open fun faceToPlayer(context: BlockPlaceContext): Boolean { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/EngineBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/EngineBlock.kt index 44ea148ab..d879d13a3 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/EngineBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/EngineBlock.kt @@ -29,7 +29,7 @@ class EngineBlock : RotatableMatteryBlock(Properties.of().mapColor(MapColor.COLO } override fun rotationFreedom(): BlockRotationFreedom { - return BlockRotationFreedom.XZ_XY + return BlockRotationFreedom.DIRECTIONAL } private val shapes = getShapeForEachState { BlockShapes.ENGINE.rotateFromNorth(it[rotationProperty]).computeShape() } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/HoloSignBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/HoloSignBlock.kt index 2d7f0998f..b784c2f1d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/HoloSignBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/HoloSignBlock.kt @@ -15,7 +15,7 @@ import ru.dbotthepony.mc.otm.shapes.BlockShapes class HoloSignBlock : RotatableMatteryBlock(), EntityBlock { override fun rotationFreedom(): BlockRotationFreedom { - return BlockRotationFreedom.XZ_XY_ZY + return BlockRotationFreedom.DIRECTIONAL_WITH_ROTATION } override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/LaboratoryLamp.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/LaboratoryLamp.kt index 4b942fb23..3dc4aa81c 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/LaboratoryLamp.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/decorative/LaboratoryLamp.kt @@ -26,7 +26,7 @@ import ru.dbotthepony.mc.otm.core.math.plus import ru.dbotthepony.mc.otm.once import ru.dbotthepony.mc.otm.registry.MBlocks -private val FACING_FULL = BlockRotationFreedom.XZ_XY.property +private val FACING_FULL = BlockRotationFreedom.DIRECTIONAL.property class LaboratoryLampLight : Block(Properties.of().strength(-1.0F, 3600000.8F).noCollission().noLootTable().replaceable().lightLevel { 15 }) { override fun createBlockStateDefinition(builder: StateDefinition.Builder) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/GravitationStabilizerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/GravitationStabilizerBlockEntity.kt index d5f6e1bc4..5e119bf06 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/GravitationStabilizerBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/tech/GravitationStabilizerBlockEntity.kt @@ -26,7 +26,7 @@ class GravitationStabilizerBlockEntity(p_155229_: BlockPos, p_155230_: BlockStat fun tick(level: Level) { var findBlackHole: BlackHoleBlockEntity? = null - val dir = blockState[BlockRotationFreedom.XZ_XY].normal + val dir = blockState[BlockRotationFreedom.DIRECTIONAL].normal for (i in 2 .. RANGE) { val pos = blockPos + dir * i diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/matter/MatterPanelBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/matter/MatterPanelBlock.kt index ca4502941..00cc3a746 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/matter/MatterPanelBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/matter/MatterPanelBlock.kt @@ -25,10 +25,10 @@ class MatterPanelBlock : RotatableMatteryBlock(), EntityBlock { private val shapes: ImmutableMap init { - registerDefaultState(getStateDefinition().any().setValue(BlockRotationFreedom.XZ_XY.property, BlockRotation.SOUTH)) + registerDefaultState(getStateDefinition().any().setValue(BlockRotationFreedom.DIRECTIONAL.property, BlockRotation.SOUTH)) shapes = getShapeForEachState { - when (it[BlockRotationFreedom.XZ_XY.property].front) { + when (it[BlockRotationFreedom.DIRECTIONAL.property].front) { Direction.NORTH -> Shapes.box( 0.0, 0.0, @@ -91,10 +91,10 @@ class MatterPanelBlock : RotatableMatteryBlock(), EntityBlock { } override fun rotationFreedom(): BlockRotationFreedom { - return BlockRotationFreedom.XZ_XY + return BlockRotationFreedom.DIRECTIONAL } override fun getStateForPlacement(context: BlockPlaceContext): BlockState? { - return defaultBlockState().setValue(BlockRotationFreedom.XZ_XY.property, BlockRotation.of(context.clickedFace)) + return defaultBlockState().setValue(BlockRotationFreedom.DIRECTIONAL.property, BlockRotation.of(context.clickedFace)) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StorageBusBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StorageBusBlock.kt index 1894edeca..1fb0b65d7 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StorageBusBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StorageBusBlock.kt @@ -30,11 +30,10 @@ import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom import ru.dbotthepony.mc.otm.registry.MBlockEntities import ru.dbotthepony.mc.otm.shapes.BlockShapes import ru.dbotthepony.mc.otm.core.math.unaryMinus -import ru.dbotthepony.mc.otm.oncePre class StorageBusBlock : RotatableMatteryBlock(), EntityBlock { override fun rotationFreedom(): BlockRotationFreedom { - return BlockRotationFreedom.XZ_XY + return BlockRotationFreedom.DIRECTIONAL } init { @@ -52,7 +51,7 @@ class StorageBusBlock : RotatableMatteryBlock(), EntityBlock { } override fun getStateForPlacement(context: BlockPlaceContext): BlockState? { - return super.getStateForPlacement(context)?.setValue(BlockRotationFreedom.XZ_XY.property, BlockRotation.of(-context.clickedFace)) + return super.getStateForPlacement(context)?.setValue(BlockRotationFreedom.DIRECTIONAL.property, BlockRotation.of(-context.clickedFace)) } override fun appendHoverText( diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StorageInterfaces.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StorageInterfaces.kt index 331dfe24a..54ee44c87 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StorageInterfaces.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/storage/StorageInterfaces.kt @@ -34,7 +34,7 @@ import ru.dbotthepony.mc.otm.core.math.unaryMinus class StorageImporterBlock : RotatableMatteryBlock(), EntityBlock { override fun rotationFreedom(): BlockRotationFreedom { - return BlockRotationFreedom.XZ_XY + return BlockRotationFreedom.DIRECTIONAL } override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity { @@ -76,7 +76,7 @@ class StorageImporterBlock : RotatableMatteryBlock(), EntityBlock { } override fun getStateForPlacement(context: BlockPlaceContext): BlockState? { - return super.getStateForPlacement(context)?.setValue(BlockRotationFreedom.XZ_XY.property, BlockRotation.of(-context.clickedFace)) + return super.getStateForPlacement(context)?.setValue(BlockRotationFreedom.DIRECTIONAL.property, BlockRotation.of(-context.clickedFace)) } override fun appendHoverText( @@ -116,7 +116,7 @@ class StorageImporterBlock : RotatableMatteryBlock(), EntityBlock { class StorageExporterBlock : RotatableMatteryBlock(), EntityBlock { override fun rotationFreedom(): BlockRotationFreedom { - return BlockRotationFreedom.XZ_XY + return BlockRotationFreedom.DIRECTIONAL } override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity { @@ -169,7 +169,7 @@ class StorageExporterBlock : RotatableMatteryBlock(), EntityBlock { } override fun getStateForPlacement(context: BlockPlaceContext): BlockState? { - return super.getStateForPlacement(context)?.setValue(BlockRotationFreedom.XZ_XY.property, BlockRotation.of(-context.clickedFace)) + return super.getStateForPlacement(context)?.setValue(BlockRotationFreedom.DIRECTIONAL.property, BlockRotation.of(-context.clickedFace)) } private val shapes = getShapeForEachState { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/GravitationStabilizerBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/GravitationStabilizerBlock.kt index 3e647b0e2..e2f33127e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/GravitationStabilizerBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/GravitationStabilizerBlock.kt @@ -55,7 +55,7 @@ class BlockGravitationStabilizer : RotatableMatteryBlock(props), EntityBlock { } override fun rotationFreedom(): BlockRotationFreedom { - return BlockRotationFreedom.XZ_XY + return BlockRotationFreedom.DIRECTIONAL } override fun createBlockStateDefinition(builder: StateDefinition.Builder) { @@ -68,7 +68,7 @@ class BlockGravitationStabilizer : RotatableMatteryBlock(props), EntityBlock { val blockPos = context.clickedPos val level = context.level - for (face in BlockRotationFreedom.XZ_XY.possibleValues) { + for (face in BlockRotationFreedom.DIRECTIONAL.possibleValues) { val dir = face.normal for (i in 1 ..GravitationStabilizerBlockEntity.RANGE) { @@ -78,14 +78,14 @@ class BlockGravitationStabilizer : RotatableMatteryBlock(props), EntityBlock { if (!getState.isAir) { if (chunk.getBlockEntity(pos) is BlackHoleBlockEntity) { - state = state.setValue(BlockRotationFreedom.XZ_XY.property, face) + state = state.setValue(BlockRotationFreedom.DIRECTIONAL.property, face) break } } } } - val bbPos = blockPos + state.getValue(BlockRotationFreedom.XZ_XY.property).normal + val bbPos = blockPos + state.getValue(BlockRotationFreedom.DIRECTIONAL.property).normal if (!context.level.isInWorldBounds(bbPos)) return null if (!level.getBlockState(bbPos).canBeReplaced(context)) return null @@ -103,9 +103,9 @@ class BlockGravitationStabilizer : RotatableMatteryBlock(props), EntityBlock { super.setPlacedBy(level, blockPos, blockState, entity, itemStack) if (!level.isClientSide) { - val bbPos = blockPos + blockState.getValue(BlockRotationFreedom.XZ_XY.property).normal + val bbPos = blockPos + blockState.getValue(BlockRotationFreedom.DIRECTIONAL.property).normal val newState = MBlocks.GRAVITATION_STABILIZER_LENS.defaultBlockState() - .setValue(BlockRotationFreedom.XZ_XY.property, blockState.getValue(BlockRotationFreedom.XZ_XY.property)) + .setValue(BlockRotationFreedom.DIRECTIONAL.property, blockState.getValue(BlockRotationFreedom.DIRECTIONAL.property)) level.setBlock(bbPos, newState, UPDATE_ALL) } @@ -137,7 +137,7 @@ class BlockGravitationStabilizer : RotatableMatteryBlock(props), EntityBlock { p_60557_: BlockPos, p_60558_: CollisionContext ): VoxelShape { - return SHAPES[p_60555_[BlockRotationFreedom.XZ_XY].ordinal] + return SHAPES[p_60555_[BlockRotationFreedom.DIRECTIONAL].ordinal] } companion object { @@ -155,14 +155,14 @@ class BlockGravitationStabilizer : RotatableMatteryBlock(props), EntityBlock { } fun getBoundingBlockPos(blockState: BlockState, blockPos: BlockPos): BlockPos { - return blockPos + blockState.getValue(BlockRotationFreedom.XZ_XY.property).normal + return blockPos + blockState.getValue(BlockRotationFreedom.DIRECTIONAL.property).normal } } } class BlockGravitationStabilizerLens : RotatableMatteryBlock(props) { override fun rotationFreedom(): BlockRotationFreedom { - return BlockRotationFreedom.XZ_XY + return BlockRotationFreedom.DIRECTIONAL } override fun createBlockStateDefinition(builder: StateDefinition.Builder) { @@ -196,7 +196,7 @@ class BlockGravitationStabilizerLens : RotatableMatteryBlock(props) { p_60557_: BlockPos, p_60558_: CollisionContext ): VoxelShape { - return SHAPES[p_60555_[BlockRotationFreedom.XZ_XY].front.ordinal] + return SHAPES[p_60555_[BlockRotationFreedom.DIRECTIONAL].front.ordinal] } companion object { @@ -205,7 +205,7 @@ class BlockGravitationStabilizerLens : RotatableMatteryBlock(props) { } fun getBoundingBlockPos(blockState: BlockState, blockPos: BlockPos): BlockPos { - return blockPos + blockState.getValue(BlockRotationFreedom.XZ_XY.property).front.opposite.normal + return blockPos + blockState.getValue(BlockRotationFreedom.DIRECTIONAL.property).front.opposite.normal } private val SHAPES = arrayOf( diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/BankRenderer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/BankRenderer.kt index 9da03e508..07969b2b0 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/BankRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/BankRenderer.kt @@ -49,7 +49,7 @@ abstract class BankRenderer(private val context: B stack.pushPose() stack.translate(0.5f, 0.5f, 0.5f) - stack.rotate(blockEntity.blockState[BlockRotationFreedom.XZ.property].front) + stack.rotate(blockEntity.blockState[BlockRotationFreedom.HORIZONTAL.property].front) stack.translate(-0.5f, -0.5f, -0.5f) for ((i, model) in models.withIndex()) { @@ -73,7 +73,7 @@ abstract class BankRenderer(private val context: B stack.pushPose() - val facing = blockEntity.blockState[BlockRotationFreedom.XZ].front + val facing = blockEntity.blockState[BlockRotationFreedom.HORIZONTAL].front val rotateFacing = facing == Direction.NORTH || facing == Direction.SOUTH if (rotateFacing) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/GravitationStabilizerRenderer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/GravitationStabilizerRenderer.kt index b57b863b4..60e1b97f4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/GravitationStabilizerRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/GravitationStabilizerRenderer.kt @@ -47,7 +47,7 @@ class GravitationStabilizerRenderer(private val context: BlockEntityRendererProv var len = 64.0 var lenI = 64 - val normal = tile.blockState[BlockRotationFreedom.XZ_XY].normal + val normal = tile.blockState[BlockRotationFreedom.DIRECTIONAL].normal val level = tile.level var bhTile: BlackHoleBlockEntity? = null @@ -68,7 +68,7 @@ class GravitationStabilizerRenderer(private val context: BlockEntityRendererProv poseStack.pushPose() poseStack.translate(0.5, 0.5, 0.5) - val facing = tile.blockState[BlockRotationFreedom.XZ_XY].front + val facing = tile.blockState[BlockRotationFreedom.DIRECTIONAL].front val rotateZ: Double val rotateY: Double diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/HoloSignRenderer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/HoloSignRenderer.kt index 015b6f26c..4e1be4a88 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/HoloSignRenderer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/client/render/blockentity/HoloSignRenderer.kt @@ -27,7 +27,7 @@ class HoloSignRenderer(private val context: BlockEntityRendererProvider.Context) return poseStack.pushPose() - poseStack.rotateWithBlockFacing(tile.blockState[BlockRotationFreedom.XZ_XY_ZY]) + poseStack.rotateWithBlockFacing(tile.blockState[BlockRotationFreedom.DIRECTIONAL_WITH_ROTATION]) poseStack.translate(0.5f, 0.5f, 0.5f) poseStack.scale(0.01f, 0.01f, 0.01f) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/math/BlockRotationFreedom.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/math/BlockRotationFreedom.kt index 405446d33..8a7328ca5 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/core/math/BlockRotationFreedom.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/math/BlockRotationFreedom.kt @@ -8,13 +8,13 @@ import java.util.EnumMap * Controls the rotational freedom of block in space, employing [property] and [of] to get valid value from set of possible values */ enum class BlockRotationFreedom(vararg values: BlockRotation) { - XZ( + HORIZONTAL( BlockRotation.NORTH, BlockRotation.SOUTH, BlockRotation.WEST, BlockRotation.EAST, ), - XZ_XY( + DIRECTIONAL( BlockRotation.DOWN, BlockRotation.UP, BlockRotation.NORTH, @@ -22,7 +22,7 @@ enum class BlockRotationFreedom(vararg values: BlockRotation) { BlockRotation.WEST, BlockRotation.EAST, ), - XZ_XY_ZY( + DIRECTIONAL_WITH_ROTATION( BlockRotation.DOWN, BlockRotation.UP, BlockRotation.NORTH, @@ -40,7 +40,7 @@ enum class BlockRotationFreedom(vararg values: BlockRotation) { /** * These rotations are impossible to achieve using blockstates because blockstate def can't rotate models in XY plane (z axis) */ - FOUR( + FULL( BlockRotation.DOWN, BlockRotation.UP, BlockRotation.NORTH,