Drive viewer block shape
This commit is contained in:
parent
43e02f8c70
commit
d6e90e4679
@ -439,4 +439,21 @@ public class BlockShapes {
|
||||
new SimpleCuboid(0.625d, 0.1875d, 0.125d, 0.875d, 0.8125d, 0.375d),
|
||||
new SimpleCuboid(0.5625d, 0.6875d, 0.0625d, 0.9375d, 0.75d, 0.4375d)
|
||||
);
|
||||
|
||||
public static final BlockShape DRIVE_VIEWER = new BlockShape(
|
||||
new SimpleCuboid(0d, 0d, 0d, 1d, 0.5d, 1d),
|
||||
new SimpleCuboid(0.125d, 0.5d, 0.125d, 0.875d, 0.875d, 0.875d),
|
||||
new SimpleCuboid(0.25d, 0.5d, 0.8125d, 0.75d, 0.9375d, 0.9375d),
|
||||
new SimpleCuboid(0.875d, 0.5d, 0.375d, 0.9375d, 0.8125d, 0.5d),
|
||||
new SimpleCuboid(0.875d, 0.5d, 0.5625d, 0.9375d, 0.8125d, 0.6875d),
|
||||
new SimpleCuboid(0d, 0.5d, 0d, 0.0625d, 1d, 0.0625d),
|
||||
new SimpleCuboid(0.9375d, 0.5d, 0d, 1d, 1d, 0.0625d),
|
||||
new SimpleCuboid(0.3125d, 0.5d, 0d, 0.6875d, 0.9375d, 0.1875d),
|
||||
new SimpleCuboid(0.9375d, 0.5d, 0.9375d, 1d, 1d, 1d),
|
||||
new SimpleCuboid(0.03125d, 0.875d, 0.0625d, 0.0625d, 0.9375d, 0.9375d),
|
||||
new SimpleCuboid(0.03125d, 0.5625d, 0.0625d, 0.0625d, 0.625d, 0.9375d),
|
||||
new SimpleCuboid(0.9375d, 0.5625d, 0.0625d, 0.96875d, 0.625d, 0.9375d),
|
||||
new SimpleCuboid(0.9375d, 0.875d, 0.0625d, 0.96875d, 0.9375d, 0.9375d),
|
||||
new SimpleCuboid(0d, 0.5d, 0.9375d, 0.0625d, 1d, 1d)
|
||||
);
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
package ru.dbotthepony.mc.otm.block
|
||||
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.Direction
|
||||
import net.minecraft.world.item.context.BlockPlaceContext
|
||||
import net.minecraft.world.level.BlockGetter
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.block.Block
|
||||
import net.minecraft.world.level.block.EntityBlock
|
||||
@ -11,9 +13,12 @@ import net.minecraft.world.level.block.entity.BlockEntityType
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import net.minecraft.world.level.block.state.StateDefinition
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty
|
||||
import net.minecraft.world.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.block.entity.DriveViewerBlockEntity
|
||||
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
||||
import ru.dbotthepony.mc.otm.registry.MBlockEntities
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class DriveViewerBlock : RotatableMatteryBlock(), EntityBlock {
|
||||
override fun newBlockEntity(blockPos: BlockPos, blockState: BlockState): BlockEntity {
|
||||
@ -41,7 +46,30 @@ class DriveViewerBlock : RotatableMatteryBlock(), EntityBlock {
|
||||
return super.getStateForPlacement(context)!!.setValue(DRIVE_PRESENT, false)
|
||||
}
|
||||
|
||||
override fun getShape(
|
||||
p_60555_: BlockState,
|
||||
p_60556_: BlockGetter,
|
||||
p_60557_: BlockPos,
|
||||
p_60558_: CollisionContext
|
||||
): VoxelShape {
|
||||
return SHAPES[p_60555_.getValue(FACING).ordinal]
|
||||
}
|
||||
|
||||
companion object {
|
||||
val DRIVE_PRESENT: BooleanProperty = BooleanProperty.create("drive")
|
||||
private val SHAPES: Array<VoxelShape>
|
||||
|
||||
init {
|
||||
val def = BlockShapes.DRIVE_VIEWER.computeShape()
|
||||
|
||||
SHAPES = arrayOf(
|
||||
def,
|
||||
def,
|
||||
def,
|
||||
BlockShapes.DRIVE_VIEWER.rotate(Direction.NORTH).computeShape(),
|
||||
BlockShapes.DRIVE_VIEWER.rotate(Direction.WEST).computeShape(),
|
||||
BlockShapes.DRIVE_VIEWER.rotate(Direction.EAST).computeShape()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user