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 f2f64a10c..b1f97bd01 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/shapes/BlockShapes.java +++ b/src/main/java/ru/dbotthepony/mc/otm/shapes/BlockShapes.java @@ -622,4 +622,15 @@ public class BlockShapes { new SimpleCuboid(0.0625d, 0.375d, 0.0625d, 0.25d, 0.9375d, 0.9375d), new SimpleCuboid(0.75d, 0.375d, 0.0625d, 0.9375d, 0.9375d, 0.9375d) ); + + public static final BlockShape ESSENCE_STORAGE = new BlockShape( + new SimpleCuboid(0d, 0d, 0d, 1d, 0.125d, 1d), + new SimpleCuboid(0d, 0.1875d, 0d, 1d, 0.3125d, 1d), + new SimpleCuboid(0.5625d, 0.3125d, 0d, 1d, 1d, 0.875d), + new SimpleCuboid(0d, 0.625d, 0.875d, 1d, 1d, 1d), + new SimpleCuboid(0d, 0.3125d, 0.5625d, 0.5625d, 1d, 0.875d), + new SimpleCuboid(0.0625d, 0.125d, 0.0625d, 0.9375d, 0.1875d, 0.9375d), + new SimpleCuboid(0.0625d, 0.3125d, 0.875d, 0.9375d, 0.625d, 0.9375d), + new SimpleCuboid(0.0625d, 0.3125d, 0.0625d, 0.5625d, 0.9375d, 0.5625d) + ); } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/EssenceStorageBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/EssenceStorageBlock.kt index 0d4faf442..85b813e2f 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/EssenceStorageBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/tech/EssenceStorageBlock.kt @@ -4,6 +4,7 @@ import net.minecraft.core.BlockPos import net.minecraft.world.InteractionHand import net.minecraft.world.InteractionResult import net.minecraft.world.entity.player.Player +import net.minecraft.world.level.BlockGetter import net.minecraft.world.level.Level import net.minecraft.world.level.block.EntityBlock import net.minecraft.world.level.block.entity.BlockEntity @@ -11,9 +12,14 @@ 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.phys.BlockHitResult +import net.minecraft.world.phys.shapes.CollisionContext +import net.minecraft.world.phys.shapes.VoxelShape import ru.dbotthepony.mc.otm.block.RotatableMatteryBlock import ru.dbotthepony.mc.otm.block.entity.tech.EssenceStorageBlockEntity +import ru.dbotthepony.mc.otm.block.getShapeForEachState +import ru.dbotthepony.mc.otm.core.get import ru.dbotthepony.mc.otm.registry.MItems +import ru.dbotthepony.mc.otm.shapes.BlockShapes class EssenceStorageBlock : RotatableMatteryBlock(), EntityBlock { override fun newBlockEntity(pPos: BlockPos, pState: BlockState): BlockEntity { @@ -36,4 +42,16 @@ class EssenceStorageBlock : RotatableMatteryBlock(), EntityBlock { return super.use(blockState, level, blockPos, ply, hand, blockHitResult) } + + private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.ESSENCE_STORAGE.rotateFromNorth(it[rotationProperty]).computeShape() } + + @Suppress("override_deprecation") + override fun getShape( + state: BlockState, + blockGetter: BlockGetter, + pos: BlockPos, + context: CollisionContext + ): VoxelShape { + return shapes[state]!! + } } diff --git a/src/main/resources/assets/overdrive_that_matters/models/block/essence_storage.json b/src/main/resources/assets/overdrive_that_matters/models/block/essence_storage.json index 5f9f56224..232c1ec45 100644 --- a/src/main/resources/assets/overdrive_that_matters/models/block/essence_storage.json +++ b/src/main/resources/assets/overdrive_that_matters/models/block/essence_storage.json @@ -83,7 +83,6 @@ "from": [1, 5, 14], "to": [15, 10, 15], "faces": { - "north": {"uv": [0, 0, 7, 1.25], "texture": "#missing"}, "east": {"uv": [15.5, 10.5, 16, 11.75], "texture": "#0"}, "south": {"uv": [8.5, 10.5, 15.5, 11.75], "texture": "#0"}, "west": {"uv": [8, 10.5, 8.5, 11.75], "texture": "#0"} @@ -91,20 +90,12 @@ }, { "name": "container", - "from": [1, 15, 1], + "from": [1, 5, 1], "to": [9, 15, 9], - "faces": { - "up": {"uv": [8, 0, 12, 2], "texture": "#0"}, - "down": {"uv": [8, 0, 12, 2], "texture": "#0"} - } - }, - { - "name": "container", - "from": [1, 5, 1], - "to": [9, 15, 1], "faces": { "north": {"uv": [8, 2, 12, 4.5], "texture": "#0"}, - "south": {"uv": [8, 2, 12, 4.5], "texture": "#0"} + "west": {"uv": [8, 2, 12, 4.5], "texture": "#0"}, + "up": {"uv": [8, 0, 12, 2], "texture": "#0"} } }, { @@ -119,15 +110,6 @@ "up": {"uv": [9.5, 12.5, 13, 14.25], "texture": "#0"} }, "forge_data": { "block_light": 15, "sky_light": 15 } - }, - { - "name": "container", - "from": [1, 5, 1], - "to": [1, 15, 9], - "faces": { - "east": {"uv": [8, 2, 12, 4.5], "texture": "#0"}, - "west": {"uv": [8, 2, 12, 4.5], "texture": "#0"} - } } ], "display": {