From 5e3520de55cbe2bb4ea0a79f68df70b798fa34bd Mon Sep 17 00:00:00 2001 From: GearShocky Date: Wed, 26 Feb 2025 23:58:22 +0500 Subject: [PATCH] shapegen --- .../mc/otm/shapes/BlockShapes.java | 41 +++++++++++++----- .../otm/block/matter/MatterEntanglerBlock.kt | 18 ++++++++ .../models/block/matter_entangler.json | 11 ++--- .../models/block/matter_replicator.json | 26 +++++------ .../block/matter_entangler_details.png | Bin 788 -> 786 bytes 5 files changed, 67 insertions(+), 29 deletions(-) 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 82d71662fd9fef4f72f7d5b07b28855f2ab329a7..404ba6c621fe6a9f6c1c6b2b57e7b0439927bac0 100644 GIT binary patch delta 381 zcmV-@0fPRN29gGlTNPAPRA69WSy@@ev{xP;9<7~Bj)6Xra3=(4ZHIcXnWJH3~q|Van{s*ljgb7{J=NZo!J$(drzu|X?oC_hu5Mz8=_Q_}h zDbWG6egK~q<(pvL!X!j4vJn1Ekg7s9J3JSCLG5lcc?*IMhE zb18Ww1W8b#cv=OL4LL!6b&MeZ&la~q^?U@btX>dR{w6M=$br!g{(JE#PVVZ%_ b8Hv6C6o53Xp_?RF00000NkvXXu0mjfZ)T={ delta 383 zcmV-_0f7FJ29ySnTNPPZSzusb#WRzehPMxLI{SR762ost%eV*}*(c>e)?l=4nk#ix07-Ec1!#){R zASF70Iv>ENN%07g-2@CP-DJcL~D#1Ql$y@PC4#g6(2R*cpUQN*U`Y3%;F$ z_m~ke=gcc$uA?k~^$-DYl69wl40I5Pb>xI5a6&px(=nkhh3iG?EIcLT#1T_MnCDW; z%!}pR6M`hDkUh-;$%339R~=&r083qB0ZMg}@Vxt_Ho5RFhz`YsetxhRa5~X}sLU$Z z>;Y1t;?B%^Sy%hsX@&`xi+y)m4|_sBeYB^Zb2WMbcA?&s_DF8KZrcr3@%AcISh!yG z&`06^=)$(W3U{K%XA>-e^l}&(X2EdsQX%vIqR(i!FM|V`p@qE%tFs_~n^^X@nbC!z d2S$4&`UW0nG``S^PIdqQ002ovPDHLkV1jKbtbG6g