diff --git a/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget.bbmodel b/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget.bbmodel new file mode 100644 index 00000000..9dc48dac --- /dev/null +++ b/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget.bbmodel @@ -0,0 +1 @@ +{"meta":{"format_version":"4.0","creation_time":1655482395,"model_format":"java_block","box_uv":false},"name":"template_sided_circle_widget","parent":"","ambientocclusion":true,"front_gui_light":false,"visible_box":[1,1,0],"variable_placeholders":"","variable_placeholder_buttons":[],"resolution":{"width":32,"height":32},"elements":[{"name":"body","rescale":false,"locked":false,"from":[2,0,2],"to":[14,4,14],"autouv":0,"color":4,"origin":[0,0,0],"faces":{"north":{"uv":[0,2,12,6],"texture":0},"east":{"uv":[0,2,12,6],"texture":0},"south":{"uv":[0,2,12,6],"texture":0},"west":{"uv":[0,2,12,6],"texture":0},"up":{"uv":[4,4,28,28],"texture":1},"down":{"uv":[18,2,30,14],"rotation":270,"texture":0}},"type":"cube","uuid":"78e81623-f7a8-9f6d-6f27-4b16d7d02b84"},{"name":"north","rescale":false,"locked":false,"from":[4,0,0],"to":[12,2,2],"autouv":0,"color":7,"origin":[0,0,0],"faces":{"north":{"uv":[0,0,8,2],"texture":0},"east":{"uv":[4,0,8,4],"texture":1},"south":{"uv":[0,0,8,2]},"west":{"uv":[4,0,8,4],"texture":1},"up":{"uv":[8,0,24,4],"texture":1},"down":{"uv":[8,0,24,4],"rotation":180,"texture":1}},"type":"cube","uuid":"6456e2bb-dbae-5334-9973-f22048882cac"},{"name":"south","rescale":false,"locked":false,"from":[4,0,14],"to":[12,2,16],"autouv":0,"color":7,"origin":[0,0,0],"faces":{"north":{"uv":[0,0,8,2]},"east":{"uv":[4,28,8,32],"texture":1},"south":{"uv":[0,0,8,2],"texture":0},"west":{"uv":[4,28,8,32],"texture":1},"up":{"uv":[8,0,24,4],"texture":1},"down":{"uv":[8,28,24,32],"rotation":180,"texture":1}},"type":"cube","uuid":"cbe20ec3-971b-a083-6041-846a52874410"},{"name":"west","rescale":false,"locked":false,"from":[0,0,4],"to":[2,2,12],"autouv":0,"color":1,"origin":[0,0,0],"faces":{"north":{"uv":[0,4,4,8],"texture":1},"east":{"uv":[0,0,8,2]},"south":{"uv":[0,4,4,8],"texture":1},"west":{"uv":[0,0,8,2],"texture":0},"up":{"uv":[0,8,4,24],"texture":1},"down":{"uv":[0,8,4,24],"rotation":180,"texture":1}},"type":"cube","uuid":"7c80f8ba-7270-4e77-bc57-507c4f2db165"},{"name":"east","rescale":false,"locked":false,"from":[14,0,4],"to":[16,2,12],"autouv":0,"color":6,"origin":[0,0,0],"faces":{"north":{"uv":[28,4,32,8],"texture":1},"east":{"uv":[0,0,8,2],"texture":0},"south":{"uv":[32,4,28,8],"texture":1},"west":{"uv":[0,0,8,2]},"up":{"uv":[28,8,32,24],"texture":1},"down":{"uv":[28,8,32,24],"rotation":180,"texture":1}},"type":"cube","uuid":"2eff68e1-4e7d-8c3f-36ad-9ff8b5fffba7"}],"outliner":["78e81623-f7a8-9f6d-6f27-4b16d7d02b84",{"name":"connectors","origin":[0,0,0],"color":0,"uuid":"9f7305b6-7774-6591-f5dd-113a5aaa07f3","export":true,"isOpen":true,"locked":false,"visibility":true,"autouv":0,"children":["6456e2bb-dbae-5334-9973-f22048882cac","7c80f8ba-7270-4e77-bc57-507c4f2db165","cbe20ec3-971b-a083-6041-846a52874410","2eff68e1-4e7d-8c3f-36ad-9ff8b5fffba7"]}],"textures":[{"path":"C:\\home\\coding\\minecraft_stuff\\modding\\personal\\hex\\Common\\src\\main\\resources\\assets\\hexcasting\\textures\\block\\circle\\common.png","name":"common.png","folder":"block/circle","namespace":"hexcasting","id":"common","particle":true,"render_mode":"default","visible":true,"mode":"bitmap","saved":true,"uuid":"806171fe-1683-72aa-7a7a-db2d78bacf17","relative_path":"../../../textures/block/circle/common.png","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAWBJREFUWEftlbFOw0AMhp2RUkEqhNSBFYmFkTcoKxsrr8POI7BUiI0VJtjCXLVSB6hAAUSkBFS6Fv1Gf3ScQppKuNPdcpfkbH/+z75Ex4cncxGRvCikE8c6Yzy/v+o8ekwiXRiNqHdwND9LTtX93WBLbvu5jPqZZGkia92L1QAgOLJ3BxVx1cH68vq8UhEksoxIN/dX6kcVmM5mattutXR2n7nmdxr6weCHxxavb6gv1w++fUzz0uwlG/8AoAae0lQNoALXBCEUHOzv7tUqgD07290yCdrSV/H1WUL8AqiSmyBwioxgvAgAGbtBma77nkqUAMucW91e1oAP4T+bAvylAMGp5uRtIiYKuAB1SgwehjYALMJFx2AKgIJly/rtjfemNYDMNtsdbUUER+ewLf1WNKkBAGAAAoMXEjNnMeJCMgVo0tr/DtAkaNUe019tE6gAEBQICgQFggJBgaBAUOAbExUFMMgUMvMAAAAASUVORK5CYII="},{"path":"C:\\home\\coding\\minecraft_stuff\\modding\\personal\\hex\\Common\\src\\main\\resources\\assets\\hexcasting\\textures\\block\\circle\\impetus.png","name":"impetus.png","folder":"block/circle","namespace":"hexcasting","id":"core","particle":false,"render_mode":"default","visible":true,"mode":"bitmap","saved":true,"uuid":"dab33251-e255-b08f-9166-155959348842","relative_path":"../../../textures/block/circle/impetus.png","source":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAYpJREFUOE+Nk7Evg2EQxu9bEWkTUhpShiaVMhg0JBikOtoMFgkDE8bGhEm6+jcsYuwkIZFYDCIkjUhDSoO0pLpWfhf35m1puOX73nvfe+655+4C+bb0xEIjHArpqVKtSq1el+rnh4Q6u6Wro0P91/c38vRaCCyGrzv098QbOKbHp+ShVPoR3BbAMpMVMxaWBb/PjP+rwq0M9PapP7DMyeERpfiXwfDs8tw9Cxbnl5U6xsXc+rH+3x1tyGA06jSJZHIyuxSWw5U1TQSQakAJjy/PMhZPOIByPttUCpog5MHFvuxkcvouFompL0gMpZSBAXBhmfETzNk0MjEpWRkAQKt4BLJRs3b6AsIU8awEwIPJZLrh99kALLM/F7wDkEQwAFA1sPbZBUPkC8jZkhiA06AVgC7QAQIIxCzzXj7rRHQa+BMIg92TU5lJvsnq6JZOIzVjdADbTG03zYsbZebBV7rdVLaOtAOgG++1yl+D6O5tqRxA6zYiFoxQGqPVxXLxf9topfjBCPnbOn8BGwzv3ErIL30AAAAASUVORK5CYII="}],"display":{"thirdperson_righthand":{"rotation":[75,45,0],"translation":[0,2.5,0],"scale":[0.375,0.375,0.375]},"thirdperson_lefthand":{"rotation":[75,45,0],"translation":[0,2.5,0],"scale":[0.375,0.375,0.375]},"firstperson_righthand":{"rotation":[0,45,0],"scale":[0.4,0.4,0.4]},"firstperson_lefthand":{"rotation":[0,225,0],"scale":[0.4,0.4,0.4]},"ground":{"translation":[0,3,0],"scale":[0.25,0.25,0.25]},"gui":{"rotation":[30,225,0],"scale":[0.625,0.625,0.625]},"fixed":{"scale":[0.5,0.5,0.5]}}} \ No newline at end of file diff --git a/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_body.json b/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_body.json index f46756f3..7994908b 100644 --- a/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_body.json +++ b/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_body.json @@ -10,12 +10,12 @@ { "name": "body", "from": [2, 0, 2], - "to": [14, 8, 14], + "to": [14, 4, 14], "faces": { - "north": {"uv": [1, 4, 7, 8], "texture": "#common"}, - "east": {"uv": [1, 4, 7, 8], "texture": "#common"}, - "south": {"uv": [1, 4, 7, 8], "texture": "#common"}, - "west": {"uv": [1, 4, 7, 8], "texture": "#common"}, + "north": {"uv": [0, 1, 6, 3], "texture": "#common"}, + "east": {"uv": [0, 1, 6, 3], "texture": "#common"}, + "south": {"uv": [0, 1, 6, 3], "texture": "#common"}, + "west": {"uv": [0, 1, 6, 3], "texture": "#common"}, "up": {"uv": [2, 2, 14, 14], "texture": "#core"}, "down": {"uv": [9, 1, 15, 7], "rotation": 270, "texture": "#common"} } diff --git a/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_east.json b/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_east.json index 55e12d0f..2d34cdb1 100644 --- a/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_east.json +++ b/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_east.json @@ -10,12 +10,12 @@ { "name": "east", "from": [14, 0, 4], - "to": [16, 4, 12], + "to": [16, 2, 12], "faces": { - "north": {"uv": [0, 12, 2, 16], "texture": "#core"}, - "east": {"uv": [0, 0, 4, 2], "texture": "#common"}, - "south": {"uv": [0, 12, 2, 16], "texture": "#core"}, - "west": {"uv": [0, 0, 4.5, 1], "texture": "#missing"}, + "north": {"uv": [14, 2, 16, 4], "texture": "#core"}, + "east": {"uv": [0, 0, 4, 1], "texture": "#common"}, + "south": {"uv": [16, 2, 14, 4], "texture": "#core"}, + "west": {"uv": [0, 0, 4, 1], "texture": "#missing"}, "up": {"uv": [14, 4, 16, 12], "texture": "#core"}, "down": {"uv": [14, 4, 16, 12], "rotation": 180, "texture": "#core"} } diff --git a/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_north.json b/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_north.json index b00eed01..ef2ef5d2 100644 --- a/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_north.json +++ b/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_north.json @@ -10,14 +10,14 @@ { "name": "north", "from": [4, 0, 0], - "to": [12, 4, 2], + "to": [12, 2, 2], "faces": { - "north": {"uv": [0, 0, 4, 2], "texture": "#common"}, - "east": {"uv": [0, 0, 2, 4], "texture": "#core"}, + "north": {"uv": [0, 0, 4, 1], "texture": "#common"}, + "east": {"uv": [2, 0, 4, 2], "texture": "#core"}, "south": {"uv": [0, 0, 4, 1], "texture": "#missing"}, - "west": {"uv": [0, 0, 2, 4], "texture": "#core"}, + "west": {"uv": [2, 0, 4, 2], "texture": "#core"}, "up": {"uv": [4, 0, 12, 2], "texture": "#core"}, - "down": {"uv": [4, 0, 12, 2], "texture": "#core"} + "down": {"uv": [4, 0, 12, 2], "rotation": 180, "texture": "#core"} } } ], diff --git a/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_south.json b/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_south.json index f2845685..43c343bb 100644 --- a/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_south.json +++ b/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_south.json @@ -10,14 +10,14 @@ { "name": "south", "from": [4, 0, 14], - "to": [12, 4, 16], + "to": [12, 2, 16], "faces": { "north": {"uv": [0, 0, 4, 1], "texture": "#missing"}, - "east": {"uv": [14, 12, 16, 16], "texture": "#core"}, - "south": {"uv": [0, 0, 4, 2], "texture": "#common"}, - "west": {"uv": [14, 12, 16, 16], "texture": "#core"}, - "up": {"uv": [4, 14, 12, 16], "texture": "#core"}, - "down": {"uv": [4, 14, 12, 16], "texture": "#core"} + "east": {"uv": [2, 14, 4, 16], "texture": "#core"}, + "south": {"uv": [0, 0, 4, 1], "texture": "#common"}, + "west": {"uv": [2, 14, 4, 16], "texture": "#core"}, + "up": {"uv": [4, 0, 12, 2], "texture": "#core"}, + "down": {"uv": [4, 14, 12, 16], "rotation": 180, "texture": "#core"} } } ], diff --git a/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_west.json b/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_west.json index d7a00f44..f69f85e6 100644 --- a/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_west.json +++ b/Common/src/main/resources/assets/hexcasting/models/block/template_sided_circle_widget_west.json @@ -10,12 +10,12 @@ { "name": "west", "from": [0, 0, 4], - "to": [2, 4, 12], + "to": [2, 2, 12], "faces": { - "north": {"uv": [14, 0, 16, 4], "texture": "#core"}, - "east": {"uv": [0, 0, 4.5, 1], "texture": "#missing"}, - "south": {"uv": [14, 0, 16, 4], "texture": "#core"}, - "west": {"uv": [0, 0, 4, 2], "texture": "#common"}, + "north": {"uv": [0, 2, 2, 4], "texture": "#core"}, + "east": {"uv": [0, 0, 4, 1], "texture": "#missing"}, + "south": {"uv": [0, 2, 2, 4], "texture": "#core"}, + "west": {"uv": [0, 0, 4, 1], "texture": "#common"}, "up": {"uv": [0, 4, 2, 12], "texture": "#core"}, "down": {"uv": [0, 4, 2, 12], "rotation": 180, "texture": "#core"} } diff --git a/Common/src/main/resources/assets/hexcasting/textures/block/circle/common.png b/Common/src/main/resources/assets/hexcasting/textures/block/circle/common.png index ce3460c5..6a58b2a7 100644 Binary files a/Common/src/main/resources/assets/hexcasting/textures/block/circle/common.png and b/Common/src/main/resources/assets/hexcasting/textures/block/circle/common.png differ diff --git a/Common/src/main/resources/assets/hexcasting/textures/block/circle/impetus.png b/Common/src/main/resources/assets/hexcasting/textures/block/circle/impetus.png index a00f1d23..22b30355 100644 Binary files a/Common/src/main/resources/assets/hexcasting/textures/block/circle/impetus.png and b/Common/src/main/resources/assets/hexcasting/textures/block/circle/impetus.png differ diff --git a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexBlockStatesAndModels.java b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexBlockStatesAndModels.java index 326a000c..d87ce49c 100644 --- a/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexBlockStatesAndModels.java +++ b/Forge/src/main/java/at/petrak/hexcasting/forge/datagen/xplat/HexBlockStatesAndModels.java @@ -2,9 +2,11 @@ package at.petrak.hexcasting.forge.datagen.xplat; import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.api.block.circle.BlockSidedCircleWidget; +import at.petrak.hexcasting.api.circles.Margin; import at.petrak.hexcasting.common.blocks.akashic.BlockAkashicBookshelf; import at.petrak.hexcasting.common.lib.HexBlocks; import at.petrak.paucal.api.forge.datagen.PaucalBlockStateAndModelProvider; +import it.unimi.dsi.fastutil.booleans.Boolean2ObjectFunction; import net.minecraft.core.Direction; import net.minecraft.data.DataGenerator; import net.minecraft.resources.ResourceLocation; @@ -142,11 +144,53 @@ public class HexBlockStatesAndModels extends PaucalBlockStateAndModelProvider { // so there's gonna be a *lot* of model files. // Each block needs a body + 4 connector models, for unenergized and energized versions, for non-margin // and margin versions. ("Margin" = the overlay model we stick on top, so some of the model rotates and some doesn't.) + // Due to the third dimension being a mistake, we *also* need a version of the model that points up and one that points sideways. + // This is because minecraft only accepts N quarters around the X axis and N quarters around the Y axis, and this doesn't + // let us get all the 24 rotations we need. // // To avoid the generated folder becoming incredibly thicc and to save resource pack makers we put everything in a folder. // // Files are named {blockpath}/{part}['_' margin]['_' energized]. // So, `toolsmith_impetus/body_energized` for the large chunk in the middle when active, // `farmer_locus/north_margin` for the north connector when rendering the overlay, etc. + var cursor = getMultipartBuilder(widget); + var parts = new String[]{ + "body", "north", "south", "east", "west" + }; + for (var part : parts) { + for (boolean energized : BlockSidedCircleWidget.ENERGIZED.getPossibleValues()) { + String energizedStr = energized ? "" : "_energized"; + Boolean2ObjectFunction modelMaker = (margin) -> { + String marginStr = margin ? "" : "_margin"; + return models().withExistingParent(widget.getRegistryName().getPath() + "/" + part + + marginStr + energizedStr, + modLoc("template_sided_circle_widget_" + part)) + .texture("common", modLoc("block/circle/" + commonName + energizedStr)) + .texture("core", modLoc("block/circle/" + coreName + marginStr + energizedStr)); + + }; + var unmarginModel = modelMaker.apply(false); + var marginModel = modelMaker.apply(true); + + for (var normal : Direction.values()) { + // For each normal dir we add the base model, THEN the margin-textured model on top of it. + // Phew. + int xRot = normal == Direction.DOWN ? 180 : normal.getAxis().isHorizontal() ? 90 : 0; + int yRot = normal.getAxis().isVertical() ? 0 : (int) normal.toYRot(); + cursor.part() + .modelFile(unmarginModel) + .rotationX(xRot) + .rotationY(yRot) + .nextModel(); + // Additionally rotate the margin model by the margin amount, about the normal vector ... + // but we need to transform that into a sequence of X and Y rotations. + // Uegh. + for (var margin : Margin.values()) { + + } + } + } + } + } }