diff --git a/src/main/java/ru/dbotthepony/mc/otm/shapes/BlockShapes.java b/src/main/java/ru/dbotthepony/mc/otm/shapes/BlockShapes.java index 748c5ccb2..b873312a2 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/shapes/BlockShapes.java +++ b/src/main/java/ru/dbotthepony/mc/otm/shapes/BlockShapes.java @@ -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) + ); } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/MatterRecyclerBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/MatterRecyclerBlock.kt index 926cdcd0f..9ca69884e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/MatterRecyclerBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/MatterRecyclerBlock.kt @@ -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 + + 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() + ) + } + } }