GearShocky — Сегодня, в 18:47
pattern monitor не поворачивается
This commit is contained in:
parent
3ed221afc6
commit
a178c88bf2
@ -16,8 +16,9 @@ import net.minecraft.world.item.context.BlockPlaceContext
|
|||||||
import net.minecraft.world.level.block.Block
|
import net.minecraft.world.level.block.Block
|
||||||
import net.minecraft.world.level.block.state.properties.EnumProperty
|
import net.minecraft.world.level.block.state.properties.EnumProperty
|
||||||
import ru.dbotthepony.mc.otm.block.MatteryBlock
|
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 {
|
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||||
return MatterPanelBlockEntity(blockPos, blockState)
|
return MatterPanelBlockEntity(blockPos, blockState)
|
||||||
}
|
}
|
||||||
@ -25,10 +26,10 @@ class MatterPanelBlock : MatteryBlock(), EntityBlock {
|
|||||||
private val shapes: ImmutableMap<BlockState, VoxelShape>
|
private val shapes: ImmutableMap<BlockState, VoxelShape>
|
||||||
|
|
||||||
init {
|
init {
|
||||||
registerDefaultState(getStateDefinition().any().setValue(FACING, Direction.SOUTH))
|
registerDefaultState(getStateDefinition().any().setValue(FACING_FULL, Direction.SOUTH))
|
||||||
|
|
||||||
shapes = getShapeForEachState {
|
shapes = getShapeForEachState {
|
||||||
when (it.getValue(FACING)) {
|
when (it.getValue(FACING_FULL)) {
|
||||||
Direction.NORTH -> Shapes.box(
|
Direction.NORTH -> Shapes.box(
|
||||||
0.0,
|
0.0,
|
||||||
0.0,
|
0.0,
|
||||||
@ -90,15 +91,10 @@ class MatterPanelBlock : MatteryBlock(), EntityBlock {
|
|||||||
return shapes[p_60555_]!!
|
return shapes[p_60555_]!!
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createBlockStateDefinition(builder: StateDefinition.Builder<Block, BlockState>) {
|
override val hasFreeRotation: Boolean
|
||||||
builder.add(FACING)
|
get() = true
|
||||||
}
|
|
||||||
|
|
||||||
override fun getStateForPlacement(context: BlockPlaceContext): BlockState? {
|
override fun getStateForPlacement(context: BlockPlaceContext): BlockState? {
|
||||||
return defaultBlockState().setValue(FACING, context.clickedFace)
|
return defaultBlockState().setValue(FACING_FULL, context.clickedFace)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
companion object {
|
|
||||||
val FACING: EnumProperty<Direction> = EnumProperty.create("facing", Direction::class.java)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user