Plate press physical model
This commit is contained in:
parent
ed6a76764b
commit
4271db62c8
@ -349,4 +349,22 @@ public class BlockShapes {
|
||||
new SimpleCuboid(0.3125d, 0.3125d, 0.875d, 0.6875d, 0.6875d, 1d),
|
||||
new SimpleCuboid(0.3125d, 0.3125d, 0d, 0.6875d, 0.6875d, 0.125d)
|
||||
);
|
||||
|
||||
public static final BlockShape PLATE_PRESS_IDLE = new BlockShape(
|
||||
new SimpleCuboid(0d, 0d, 0d, 1d, 0.5d, 1d),
|
||||
new SimpleCuboid(0d, 0.5d, 0.4375d, 1d, 0.75d, 1d),
|
||||
new SimpleCuboid(0.75d, 0.5d, 0.0625d, 1d, 0.75d, 0.4375d),
|
||||
new SimpleCuboid(0.125d, 0.5d, 0.25d, 0.6875d, 1d, 0.8125d),
|
||||
new SimpleCuboid(0.8125d, 0.5d, 0d, 0.9375d, 0.75d, 0.0625d),
|
||||
new SimpleCuboid(0.9375d, 0.75d, 0.9375d, 1d, 0.875d, 1d),
|
||||
new SimpleCuboid(0d, 0.75d, 0.9375d, 0.0625d, 0.875d, 1d),
|
||||
new SimpleCuboid(0.01875d, 0.8125d, 0.0625d, 0.05d, 0.875d, 0.9375d),
|
||||
new SimpleCuboid(0d, 0.5d, 0d, 0.0625d, 0.875d, 0.0625d),
|
||||
new SimpleCuboid(0.0625d, 0.8125d, 0.95d, 0.9375d, 0.875d, 0.98125d),
|
||||
new SimpleCuboid(0.6875d, 0.5d, 0.5625d, 0.75d, 0.875d, 0.75d),
|
||||
new SimpleCuboid(0.6875d, 0.5d, 0.3125d, 0.75d, 0.875d, 0.5d),
|
||||
new SimpleCuboid(0.0625d, 0.5d, 0.3125d, 0.125d, 0.875d, 0.5d),
|
||||
new SimpleCuboid(0.0625d, 0.5d, 0.5625d, 0.125d, 0.875d, 0.75d),
|
||||
new SimpleCuboid(0.775d, 0.75d, 0.125d, 0.9625d, 0.9375d, 0.875d)
|
||||
);
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package ru.dbotthepony.mc.otm.block
|
||||
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.Direction
|
||||
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
|
||||
@ -9,9 +11,12 @@ import net.minecraft.world.level.block.entity.BlockEntityTicker
|
||||
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.phys.shapes.CollisionContext
|
||||
import net.minecraft.world.phys.shapes.VoxelShape
|
||||
import ru.dbotthepony.mc.otm.Registry
|
||||
import ru.dbotthepony.mc.otm.block.entity.BlockEntityPlatePress
|
||||
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
|
||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes
|
||||
|
||||
class BlockPlatePress(properties: Properties = DEFAULT_PROPERTIES) : BlockMatteryRotatable(properties), EntityBlock {
|
||||
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
|
||||
@ -33,4 +38,31 @@ class BlockPlatePress(properties: Properties = DEFAULT_PROPERTIES) : BlockMatter
|
||||
super.createBlockStateDefinition(builder)
|
||||
builder.add(WorkerState.WORKER_STATE)
|
||||
}
|
||||
|
||||
|
||||
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 {
|
||||
private val SHAPES: Array<VoxelShape>
|
||||
|
||||
init {
|
||||
val def = BlockShapes.PLATE_PRESS_IDLE.computeShape()
|
||||
|
||||
SHAPES = arrayOf(
|
||||
def,
|
||||
def,
|
||||
def,
|
||||
BlockShapes.PLATE_PRESS_IDLE.rotate(Direction.NORTH).computeShape(),
|
||||
BlockShapes.PLATE_PRESS_IDLE.rotate(Direction.WEST).computeShape(),
|
||||
BlockShapes.PLATE_PRESS_IDLE.rotate(Direction.EAST).computeShape()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user