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 93243d876..e2e199955 100644 --- a/src/main/java/ru/dbotthepony/mc/otm/shapes/BlockShapes.java +++ b/src/main/java/ru/dbotthepony/mc/otm/shapes/BlockShapes.java @@ -99,16 +99,6 @@ public class BlockShapes { public static final BlockShape MATTER_REPLICATOR = new BlockShape( new SimpleCuboid(0.9375d, 0d, 0d, 1d, 0.6875d, 1d), new SimpleCuboid(0d, 0d, 0d, 0.0625d, 0.6875d, 1d), - new SimpleCuboid(0d, 0.6875d, 0.0625d, 0.5d, 1d, 0.375d), - new SimpleCuboid(0.5d, 0.6875d, 0d, 1d, 1d, 0.375d), - new SimpleCuboid(0.1875d, 0.6875d, 0.6875d, 0.9375d, 0.9375d, 0.9375d), - new SimpleCuboid(0.1875d, 0.6875d, 0.375d, 0.9375d, 0.9375d, 0.625d), - new SimpleCuboid(0.0625d, 0.6875d, 0.4375d, 0.1875d, 0.875d, 0.5625d), - new SimpleCuboid(0.0625d, 0.6875d, 0.75d, 0.1875d, 0.875d, 0.875d), - new SimpleCuboid(0d, 0.6875d, 0.9375d, 0.03125d, 1d, 1d), - new SimpleCuboid(0.96875d, 0.6875d, 0.9375d, 1d, 1d, 1d), - new SimpleCuboid(0.96875d, 0.9375d, 0.375d, 1d, 1d, 0.9375d), - new SimpleCuboid(0d, 0.9375d, 0.375d, 0.03125d, 1d, 0.9375d), new SimpleCuboid(0.0625d, 0d, 0d, 0.9375d, 0.0625d, 1d), new SimpleCuboid(0.5d, 0.4375d, 0d, 0.9375d, 0.6875d, 0.0625d), new SimpleCuboid(0.0625d, 0.5625d, 0d, 0.5d, 0.6875d, 0.0625d), @@ -117,7 +107,36 @@ public class BlockShapes { new SimpleCuboid(0.125d, 0.0625d, 0d, 0.875d, 0.125d, 0.0625d), new SimpleCuboid(0.0625d, 0.625d, 0.0625d, 0.9375d, 0.6875d, 0.9375d), new SimpleCuboid(0.0625d, 0.0625d, 0.9375d, 0.9375d, 0.6875d, 1d), - new SimpleCuboid(0.1875d, 0.0625d, 0.1875d, 0.8125d, 0.125d, 0.8125d) + new SimpleCuboid(0.15625d, 0.0625d, 0.15625d, 0.84375d, 0.125d, 0.84375d), + new SimpleCuboid(0.15625d, 0.5625d, 0.15625d, 0.84375d, 0.625d, 0.84375d), + new SimpleCuboid(0.5d, 0.6875d, 0d, 1d, 1d, 0.375d), + new SimpleCuboid(0d, 0.6875d, 0.0625d, 0.5d, 1d, 0.375d), + new SimpleCuboid(0d, 0.6875d, 0.375d, 1d, 1d, 1d), + new SimpleCuboid(0.5625d, 0.5d, -0.00625d, 0.9375d, 0.8125d, -0.00625d), + new SimpleCuboid(0.1875d, 0.25d, 1.00625d, 0.8125d, 0.3125d, 1.00625d), + new SimpleCuboid(0.71875d, 0.128125d, 0.21875d, 0.78125d, 0.128125d, 0.28125d), + new SimpleCuboid(0.21875d, 0.128125d, 0.21875d, 0.28125d, 0.128125d, 0.28125d), + new SimpleCuboid(0.21875d, 0.128125d, 0.71875d, 0.28125d, 0.128125d, 0.78125d), + new SimpleCuboid(0.71875d, 0.128125d, 0.71875d, 0.78125d, 0.128125d, 0.78125d), + new SimpleCuboid(0.1875d, 0.375d, 1.00625d, 0.8125d, 0.4375d, 1.00625d) + ); + + public static final BlockShape MATTER_ENTANGLER = new BlockShape( + new SimpleCuboid(0d, 0d, 0d, 1d, 0.3125d, 0.875d), + new SimpleCuboid(0d, 0d, 0.875d, 0.125d, 0.3125d, 1d), + new SimpleCuboid(0.875d, 0d, 0.875d, 1d, 0.3125d, 1d), + new SimpleCuboid(0.1875d, 0.375d, 0.1875d, 0.8125d, 1d, 0.8125d), + new SimpleCuboid(0d, 0.4375d, 0.25d, 0.125d, 0.9375d, 0.75d), + new SimpleCuboid(0.125d, 0.5d, 0.3125d, 0.1875d, 0.875d, 0.6875d), + new SimpleCuboid(0.8125d, 0.5d, 0.3125d, 0.875d, 0.875d, 0.6875d), + new SimpleCuboid(0.875d, 0.4375d, 0.25d, 1d, 0.9375d, 0.75d), + new SimpleCuboid(0d, 0.3125d, 0.875d, 1d, 0.4375d, 1d), + new SimpleCuboid(0d, 0.3125d, 0d, 1d, 0.4375d, 0.125d), + new SimpleCuboid(0d, 0.3125d, 0.125d, 0.125d, 0.4375d, 0.875d), + new SimpleCuboid(0.875d, 0.3125d, 0.125d, 1d, 0.4375d, 0.875d), + new SimpleCuboid(0.125d, 0.0625d, 0.84375d, 0.1875d, 0.25d, 0.96875d), + new SimpleCuboid(0.8125d, 0.0625d, 0.84375d, 0.875d, 0.25d, 0.96875d), + new SimpleCuboid(0.1875d, 0.0625d, 0.84375d, 0.8125d, 0.25d, 0.96875d) ); public static final BlockShape MATTER_DECOMPOSER = new BlockShape( diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/matter/MatterEntanglerBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/matter/MatterEntanglerBlock.kt index 2f727c31e..9c7d9bbf5 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/matter/MatterEntanglerBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/matter/MatterEntanglerBlock.kt @@ -1,6 +1,7 @@ package ru.dbotthepony.mc.otm.block.matter import net.minecraft.core.BlockPos +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 +10,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.level.block.state.StateDefinition +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.WorkerState import ru.dbotthepony.mc.otm.block.entity.matter.MatterEntanglerBlockEntity +import ru.dbotthepony.mc.otm.block.getShapeForEachState +import ru.dbotthepony.mc.otm.core.get +import ru.dbotthepony.mc.otm.shapes.BlockShapes class MatterEntanglerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), EntityBlock { init { @@ -32,4 +38,16 @@ class MatterEntanglerBlock : RotatableMatteryBlock(DEFAULT_MACHINE_PROPERTIES), if (p_153212_.isClientSide) return null return BlockEntityTicker { _, _, _, tile -> if (tile is MatterEntanglerBlockEntity) tile.tick() } } + + private val shapes = getShapeForEachState(rotationProperty) { BlockShapes.MATTER_ENTANGLER.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/matter_entangler.json b/src/main/resources/assets/overdrive_that_matters/models/block/matter_entangler.json index c387d07f8..286480624 100644 --- a/src/main/resources/assets/overdrive_that_matters/models/block/matter_entangler.json +++ b/src/main/resources/assets/overdrive_that_matters/models/block/matter_entangler.json @@ -1,13 +1,14 @@ { - "texture_size": [32, 32], + "credit": "Made with Blockbench", "parent": "block/block", "render_type": "cutout", + "texture_size": [32, 32], "textures": { "0": "overdrive_that_matters:block/machine_base", "1": "overdrive_that_matters:block/matter_entangler", "2": "overdrive_that_matters:block/matter_entangler_details", - "status": "overdrive_that_matters:block/screen_status_ok", - "particle": "overdrive_that_matters:block/matter_entangler" + "particle": "overdrive_that_matters:block/matter_entangler", + "status": "overdrive_that_matters:block/screen_status_ok" }, "elements": [ { @@ -58,7 +59,7 @@ "south": {"uv": [5, 0, 10, 5], "texture": "#2"}, "west": {"uv": [5, 5, 10, 10], "texture": "#2"}, "up": {"uv": [0, 0, 5, 5], "rotation": 180, "texture": "#2"}, - "down": {"uv": [5, 5, 10, 10], "texture": "#2"} + "down": {"uv": [10, 0, 15, 5], "texture": "#2"} } }, { @@ -72,7 +73,7 @@ "south": {"uv": [5, 0, 10, 5], "texture": "#2"}, "west": {"uv": [5, 5, 10, 10], "texture": "#2"}, "up": {"uv": [0, 0, 5, 5], "rotation": 180, "texture": "#2"}, - "down": {"uv": [5, 5, 10, 10], "texture": "#2"} + "down": {"uv": [10, 0, 15, 5], "texture": "#2"} } }, { diff --git a/src/main/resources/assets/overdrive_that_matters/models/block/matter_replicator.json b/src/main/resources/assets/overdrive_that_matters/models/block/matter_replicator.json index d0d75728d..5dfb18b6e 100644 --- a/src/main/resources/assets/overdrive_that_matters/models/block/matter_replicator.json +++ b/src/main/resources/assets/overdrive_that_matters/models/block/matter_replicator.json @@ -185,9 +185,9 @@ "from": [5, 11, 11], "to": [14, 15, 15], "faces": { - "north": {"uv": [11, 0, 15.5, 2], "rotation": 180, "texture": "#texture"}, - "south": {"uv": [11, 0, 15.5, 2], "texture": "#texture"}, - "up": {"uv": [11, 0, 15.5, 2], "texture": "#texture"} + "north": {"uv": [11, 0, 15.5, 2], "rotation": 180, "texture": "#texture", "neoforge_data": {"block_light": 15}}, + "south": {"uv": [11, 0, 15.5, 2], "texture": "#texture", "neoforge_data": {"block_light": 15}}, + "up": {"uv": [11, 0, 15.5, 2], "texture": "#texture", "neoforge_data": {"block_light": 15}} } }, { @@ -195,9 +195,9 @@ "from": [5, 11, 6], "to": [14, 15, 10], "faces": { - "south": {"uv": [11, 0, 15.5, 2], "texture": "#texture"}, - "up": {"uv": [11, 0, 15.5, 2], "texture": "#texture"}, - "down": {"uv": [0, 0, 6, 1], "texture": "#missing"} + "south": {"uv": [11, 0, 15.5, 2], "texture": "#texture", "neoforge_data": {"block_light": 15}}, + "up": {"uv": [11, 0, 15.5, 2], "texture": "#texture", "neoforge_data": {"block_light": 15}}, + "down": {"uv": [0, 0, 6, 1], "texture": "#missing", "neoforge_data": {"block_light": 15}} } }, { @@ -296,7 +296,7 @@ "to": [15, 13, -0.1], "rotation": {"angle": 0, "axis": "y", "origin": [13, 11, -2.05]}, "faces": { - "north": {"uv": [0, 3.2, 9.56, 11.14], "texture": "#status"} + "north": {"uv": [0, 3.2, 9.56, 11.14], "texture": "#status", "neoforge_data": {"block_light": 15}} } }, { @@ -305,7 +305,7 @@ "to": [13, 5, 16.1], "rotation": {"angle": 0, "axis": "y", "origin": [7, 7, 14.05]}, "faces": { - "south": {"uv": [0, 0, 16, 1.62], "texture": "#status"} + "south": {"uv": [0, 0, 16, 1.62], "texture": "#status", "neoforge_data": {"block_light": 15}} } }, { @@ -314,7 +314,7 @@ "to": [12.5, 2.05, 4.5], "rotation": {"angle": 0, "axis": "y", "origin": [6.5, 5, 3.5]}, "faces": { - "up": {"uv": [13.2, 3.9, 15.3, 6], "texture": "#status"} + "up": {"uv": [13.2, 3.9, 15.3, 6], "texture": "#status", "neoforge_data": {"block_light": 15}} } }, { @@ -323,7 +323,7 @@ "to": [4.5, 2.05, 4.5], "rotation": {"angle": 0, "axis": "y", "origin": [-1.5, 5, 3.5]}, "faces": { - "up": {"uv": [13.2, 3.9, 15.3, 6], "texture": "#status"} + "up": {"uv": [13.2, 3.9, 15.3, 6], "texture": "#status", "neoforge_data": {"block_light": 15}} } }, { @@ -332,7 +332,7 @@ "to": [4.5, 2.05, 12.5], "rotation": {"angle": 0, "axis": "y", "origin": [-1.5, 5, 11.5]}, "faces": { - "up": {"uv": [13.2, 3.9, 15.3, 6], "texture": "#status"} + "up": {"uv": [13.2, 3.9, 15.3, 6], "texture": "#status", "neoforge_data": {"block_light": 15}} } }, { @@ -341,7 +341,7 @@ "to": [12.5, 2.05, 12.5], "rotation": {"angle": 0, "axis": "y", "origin": [6.5, 5, 11.5]}, "faces": { - "up": {"uv": [13.2, 3.9, 15.3, 6], "texture": "#status"} + "up": {"uv": [13.2, 3.9, 15.3, 6], "texture": "#status", "neoforge_data": {"block_light": 15}} } }, { @@ -350,7 +350,7 @@ "to": [13, 7, 16.1], "rotation": {"angle": 0, "axis": "y", "origin": [7, 9, 14.05]}, "faces": { - "south": {"uv": [0, 0, 16, 1.62], "texture": "#status"} + "south": {"uv": [0, 0, 16, 1.62], "texture": "#status", "neoforge_data": {"block_light": 15}} } } ] diff --git a/src/main/resources/assets/overdrive_that_matters/textures/block/matter_entangler_details.png b/src/main/resources/assets/overdrive_that_matters/textures/block/matter_entangler_details.png index 82d71662f..404ba6c62 100644 Binary files a/src/main/resources/assets/overdrive_that_matters/textures/block/matter_entangler_details.png and b/src/main/resources/assets/overdrive_that_matters/textures/block/matter_entangler_details.png differ