GearShocky — Сегодня, в 18:47

pattern monitor не поворачивается
This commit is contained in:
DBotThePony 2022-10-27 18:50:48 +07:00
parent 3ed221afc6
commit a178c88bf2
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -16,8 +16,9 @@ import net.minecraft.world.item.context.BlockPlaceContext
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.state.properties.EnumProperty
import ru.dbotthepony.mc.otm.block.MatteryBlock
import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock
class MatterPanelBlock : MatteryBlock(), EntityBlock {
class MatterPanelBlock : RotatableMatteryBlock(), EntityBlock {
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
return MatterPanelBlockEntity(blockPos, blockState)
}
@ -25,10 +26,10 @@ class MatterPanelBlock : MatteryBlock(), EntityBlock {
private val shapes: ImmutableMap<BlockState, VoxelShape>
init {
registerDefaultState(getStateDefinition().any().setValue(FACING, Direction.SOUTH))
registerDefaultState(getStateDefinition().any().setValue(FACING_FULL, Direction.SOUTH))
shapes = getShapeForEachState {
when (it.getValue(FACING)) {
when (it.getValue(FACING_FULL)) {
Direction.NORTH -> Shapes.box(
0.0,
0.0,
@ -90,15 +91,10 @@ class MatterPanelBlock : MatteryBlock(), EntityBlock {
return shapes[p_60555_]!!
}
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
builder.add(FACING)
}
override val hasFreeRotation: Boolean
get() = true
override fun getStateForPlacement(context: BlockPlaceContext): BlockState? {
return defaultBlockState().setValue(FACING, context.clickedFace)
}
companion object {
val FACING: EnumProperty<Direction> = EnumProperty.create("facing", Direction::class.java)
return defaultBlockState().setValue(FACING_FULL, context.clickedFace)
}
}