Storage power supplier block shape

This commit is contained in:
DBotThePony 2022-05-15 14:18:56 +07:00
parent 07efb6ed85
commit 43e02f8c70
Signed by: DBot
GPG Key ID: DCC23B5715498507
3 changed files with 53 additions and 1 deletions

View File

@ -417,4 +417,26 @@ public class BlockShapes {
new SimpleCuboid(0.125d, 0.875d, 0.75d, 0.875d, 0.9375d, 0.875d), new SimpleCuboid(0.125d, 0.875d, 0.75d, 0.875d, 0.9375d, 0.875d),
new SimpleCuboid(0.125d, 0.0625d, 0.75d, 0.875d, 0.125d, 0.875d) new SimpleCuboid(0.125d, 0.0625d, 0.75d, 0.875d, 0.125d, 0.875d)
); );
public static final BlockShape STORAGE_POWER_SUPPLIER = new BlockShape(
new SimpleCuboid(0.5d, 0d, 0d, 1d, 0.1875d, 1d),
new SimpleCuboid(0.5d, 0.8125d, 0d, 1d, 1d, 1d),
new SimpleCuboid(0d, 0d, 0.375d, 0.5d, 0.875d, 0.9375d),
new SimpleCuboid(0.1875d, 0.5d, 0.25d, 0.3125d, 0.8125d, 0.375d),
new SimpleCuboid(0.125d, 0d, 0.1875d, 0.375d, 0.5d, 0.375d),
new SimpleCuboid(0.0625d, 0.875d, 0.46875d, 0.5d, 0.9375d, 0.59375d),
new SimpleCuboid(0.0625d, 0.875d, 0.71875d, 0.5d, 0.9375d, 0.84375d),
new SimpleCuboid(0.5625d, 0.1875d, 0.5625d, 0.9375d, 0.25d, 0.9375d),
new SimpleCuboid(0.5625d, 0.3125d, 0.5625d, 0.9375d, 0.375d, 0.9375d),
new SimpleCuboid(0.5625d, 0.4375d, 0.5625d, 0.9375d, 0.5d, 0.9375d),
new SimpleCuboid(0.5625d, 0.5625d, 0.5625d, 0.9375d, 0.625d, 0.9375d),
new SimpleCuboid(0.625d, 0.1875d, 0.625d, 0.875d, 0.8125d, 0.875d),
new SimpleCuboid(0.5625d, 0.6875d, 0.5625d, 0.9375d, 0.75d, 0.9375d),
new SimpleCuboid(0.5625d, 0.1875d, 0.0625d, 0.9375d, 0.25d, 0.4375d),
new SimpleCuboid(0.5625d, 0.3125d, 0.0625d, 0.9375d, 0.375d, 0.4375d),
new SimpleCuboid(0.5625d, 0.4375d, 0.0625d, 0.9375d, 0.5d, 0.4375d),
new SimpleCuboid(0.5625d, 0.5625d, 0.0625d, 0.9375d, 0.625d, 0.4375d),
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)
);
} }

View File

@ -39,7 +39,6 @@ class PlatePressBlock(properties: Properties = DEFAULT_PROPERTIES) : RotatableMa
builder.add(WorkerState.WORKER_STATE) builder.add(WorkerState.WORKER_STATE)
} }
override fun getShape( override fun getShape(
p_60555_: BlockState, p_60555_: BlockState,
p_60556_: BlockGetter, p_60556_: BlockGetter,

View File

@ -1,14 +1,19 @@
package ru.dbotthepony.mc.otm.block package ru.dbotthepony.mc.otm.block
import net.minecraft.core.BlockPos 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.Level
import net.minecraft.world.level.block.EntityBlock import net.minecraft.world.level.block.EntityBlock
import net.minecraft.world.level.block.entity.BlockEntity import net.minecraft.world.level.block.entity.BlockEntity
import net.minecraft.world.level.block.entity.BlockEntityTicker import net.minecraft.world.level.block.entity.BlockEntityTicker
import net.minecraft.world.level.block.entity.BlockEntityType import net.minecraft.world.level.block.entity.BlockEntityType
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.phys.shapes.CollisionContext
import net.minecraft.world.phys.shapes.VoxelShape
import ru.dbotthepony.mc.otm.block.entity.StoragePowerSupplierBlockEntity import ru.dbotthepony.mc.otm.block.entity.StoragePowerSupplierBlockEntity
import ru.dbotthepony.mc.otm.registry.MBlockEntities import ru.dbotthepony.mc.otm.registry.MBlockEntities
import ru.dbotthepony.mc.otm.shapes.BlockShapes
class StoragePowerSupplierBlock : RotatableMatteryBlock(), EntityBlock { class StoragePowerSupplierBlock : RotatableMatteryBlock(), EntityBlock {
override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity { override fun newBlockEntity(p_153215_: BlockPos, p_153216_: BlockState): BlockEntity {
@ -25,4 +30,30 @@ class StoragePowerSupplierBlock : RotatableMatteryBlock(), EntityBlock {
return BlockEntityTicker { _, _, _, tile -> if (tile is StoragePowerSupplierBlockEntity) tile.tick() } return BlockEntityTicker { _, _, _, tile -> if (tile is StoragePowerSupplierBlockEntity) 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.STORAGE_POWER_SUPPLIER.computeShape()
SHAPES = arrayOf(
def,
def,
def,
BlockShapes.STORAGE_POWER_SUPPLIER.rotate(Direction.NORTH).computeShape(),
BlockShapes.STORAGE_POWER_SUPPLIER.rotate(Direction.WEST).computeShape(),
BlockShapes.STORAGE_POWER_SUPPLIER.rotate(Direction.EAST).computeShape()
)
}
}
} }