Matter Recycler block shape

This commit is contained in:
DBotThePony 2022-05-15 19:25:40 +07:00
parent 2e58853c74
commit f016e10dd2
Signed by: DBot
GPG Key ID: DCC23B5715498507
2 changed files with 50 additions and 0 deletions

View File

@ -456,4 +456,23 @@ public class BlockShapes {
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)
);
public static final BlockShape MATTER_RECYCLER = new BlockShape(
new SimpleCuboid(0d, 0d, 0d, 1d, 0.625d, 0.6875d),
new SimpleCuboid(0d, 0.3125d, 0.6875d, 1d, 0.625d, 1d),
new SimpleCuboid(0.1875d, 0.625d, 0.1875d, 0.8125d, 0.6875d, 0.8125d),
new SimpleCuboid(0.125d, 0.6875d, 0.125d, 0.875d, 0.8125d, 0.875d),
new SimpleCuboid(0.0625d, 0.8125d, 0.0625d, 0.9375d, 0.9375d, 0.9375d),
new SimpleCuboid(0.9375d, 0.625d, 0d, 1d, 1d, 0.0625d),
new SimpleCuboid(0.9375d, 0.625d, 0.9375d, 1d, 1d, 1d),
new SimpleCuboid(0d, 0.625d, 0.9375d, 0.0625d, 1d, 1d),
new SimpleCuboid(0d, 0.625d, 0d, 0.0625d, 1d, 0.0625d),
new SimpleCuboid(0.01875d, 0.8125d, 0.0625d, 0.05d, 0.875d, 0.9375d),
new SimpleCuboid(0.95d, 0.8125d, 0.0625d, 0.98125d, 0.875d, 0.9375d),
new SimpleCuboid(0d, 0d, 0.6875d, 0.03125d, 0.0625d, 1d),
new SimpleCuboid(0d, 0.0625d, 0.9375d, 0.03125d, 0.3125d, 1d),
new SimpleCuboid(0.96875d, 0d, 0.6875d, 1d, 0.0625d, 1d),
new SimpleCuboid(0.96875d, 0.0625d, 0.9375d, 1d, 0.3125d, 1d),
new SimpleCuboid(0.0625d, 0.0625d, 0.6875d, 0.9375d, 0.3125d, 0.9375d)
);
}

View File

@ -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.block.entity.MatterRecyclerBlockEntity
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.shapes.BlockShapes
class MatterRecyclerBlock : RotatableMatteryBlock(), EntityBlock {
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
@ -33,4 +38,30 @@ class MatterRecyclerBlock : RotatableMatteryBlock(), EntityBlock {
return BlockEntityTicker { _, _, _, tile -> if (tile is MatterRecyclerBlockEntity) tile.tick() }
}
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.MATTER_RECYCLER.computeShape()
SHAPES = arrayOf(
def,
def,
def,
BlockShapes.MATTER_RECYCLER.rotate(Direction.NORTH).computeShape(),
BlockShapes.MATTER_RECYCLER.rotate(Direction.WEST).computeShape(),
BlockShapes.MATTER_RECYCLER.rotate(Direction.EAST).computeShape()
)
}
}
}