idk how to do

This commit is contained in:
gamma-delta 2022-06-18 10:18:34 -05:00
parent a03f80de2e
commit f4cfbb0e48
9 changed files with 71 additions and 26 deletions

File diff suppressed because one or more lines are too long

View file

@ -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"}
}

View file

@ -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"}
}

View file

@ -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"}
}
}
],

View file

@ -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"}
}
}
],

View file

@ -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"}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 497 B

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

After

Width:  |  Height:  |  Size: 458 B

View file

@ -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<BlockModelBuilder> 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()) {
}
}
}
}
}
}