diff --git a/build.gradle b/build.gradle index 0603593..135736a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,15 @@ buildscript { dependencies { - classpath 'com.github.dexman545:Outlet:1.3.10' + classpath 'com.github.dexman545:Outlet:1.6.1' } } plugins { - id 'fabric-loom' version '1.6-SNAPSHOT' + id 'fabric-loom' version '1.7-SNAPSHOT' id 'maven-publish' id 'com.modrinth.minotaur' version '2.+' - id 'org.ajoberstar.reckon' version '0.13.0' + id 'org.ajoberstar.reckon' version '0.13.1' } -apply plugin: 'dex.plugins.outlet' +apply plugin: 'io.github.dexman545.outlet' java { toolchain { @@ -70,7 +70,10 @@ processResources { expand "version": project.version.toString(), "minecraftVersion": project.minecraft_version_range, "loaderVersion": ">=${project.loader_version}", - "fabricVersion": ">=${project.fabric_version}" + "fabricVersion": ">=${project.fabric_version}", + // Workaround for groovy jank + "class_618": '$class_618', + "class_593": '$class_593' } from 'LICENSE' diff --git a/gradle.properties b/gradle.properties index 5a82af9..c0282c8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,10 +3,10 @@ org.gradle.daemon=false # Fabric Properties # check these on https://fabricmc.net/develop - minecraft_version=1.21-pre2 - yarn_mappings=1.21-pre2+build.2 - loader_version=0.15.11 - fabric_version=0.99.4+1.21 + minecraft_version=1.21.3 + yarn_mappings=1.21.3+build.2 + loader_version=0.16.7 + fabric_version=0.106.1+1.21.3 # Mod Properties group=com.minelittlepony @@ -15,9 +15,9 @@ org.gradle.daemon=false description=Json-based entity models. Mson. # Publishing - minecraft_version_range=>=1.21-pre2 + minecraft_version_range=>=1.21.2 modrinth_loader_type=fabric modrinth_project_id=POWgsZW2 # Dependencies - modmenu_version=11.0.0-beta.1 + modmenu_version=12.0.0-beta.1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 17655d0..0d18421 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/com/minelittlepony/mson/api/EntityRendererRegistry.java b/src/main/java/com/minelittlepony/mson/api/EntityRendererRegistry.java index 38dfe66..7bf445e 100644 --- a/src/main/java/com/minelittlepony/mson/api/EntityRendererRegistry.java +++ b/src/main/java/com/minelittlepony/mson/api/EntityRendererRegistry.java @@ -31,7 +31,7 @@ public interface EntityRendererRegistry { /** * Adds a custom entity renderer. */ - > void registerEntityRenderer(EntityType type, Function constructor); + > void registerEntityRenderer(EntityType type, Function constructor); /** * Adds a custom block entity renderer. diff --git a/src/main/java/com/minelittlepony/mson/api/export/VanillaModelSerializer.java b/src/main/java/com/minelittlepony/mson/api/export/VanillaModelSerializer.java index b1de96d..f24f9b6 100644 --- a/src/main/java/com/minelittlepony/mson/api/export/VanillaModelSerializer.java +++ b/src/main/java/com/minelittlepony/mson/api/export/VanillaModelSerializer.java @@ -31,15 +31,15 @@ public VanillaModelSerializer() { public void exportAll(Path root) { ((ModelList)MinecraftClient.getInstance().getEntityModelLoader()).getModelParts().forEach((id, model) -> { try { - Path path = root.resolve(id.getId().getNamespace()).resolve(id.getId().getPath() + ".json"); + Path path = root.resolve(id.id().getNamespace()).resolve(id.id().getPath() + ".json"); writeToFile(path, model); if (modelLoader != null) { - ((MsonModelFormat)MsonModelFormat.INSTANCE).loadModel(id.getId(), path, modelLoader).ifPresent(content -> { + ((MsonModelFormat)MsonModelFormat.INSTANCE).loadModel(id.id(), path, modelLoader).ifPresent(content -> { BBModelFormat.INSTANCE.createSerializer().ifPresent(serializer -> { try (serializer) { serializer.writeToFile( - root.resolve(id.getId().getNamespace()).resolve(id.getId().getPath() + ".bbmodel").normalize(), + root.resolve(id.id().getNamespace()).resolve(id.id().getPath() + ".bbmodel").normalize(), content ); } catch (Exception ex) { diff --git a/src/main/java/com/minelittlepony/mson/api/model/BoxBuilder.java b/src/main/java/com/minelittlepony/mson/api/model/BoxBuilder.java index 3989633..ec79d5a 100644 --- a/src/main/java/com/minelittlepony/mson/api/model/BoxBuilder.java +++ b/src/main/java/com/minelittlepony/mson/api/model/BoxBuilder.java @@ -96,11 +96,11 @@ public BoxBuilder mirror(Axis axis, Optional mirror) { } public Vert vert(float x, float y, float z, int u, int v) { - return (Vert)new ModelPart.Vertex(x, y, z, u, v); + return (Vert)(Object)new ModelPart.Vertex(x, y, z, u, v); } public Vert vert(int[] parameters, float[][] positionMatrix) { - return (Vert)new ModelPart.Vertex( + return (Vert)(Object)new ModelPart.Vertex( positionMatrix[parameters[0]][0], positionMatrix[parameters[1]][1], positionMatrix[parameters[2]][2], parameters[3], parameters[4] ); @@ -142,7 +142,7 @@ public void quad(float u, float v, float w, float h, Direction direction, boolea ModelPart.Vertex[] verts = new ModelPart.Vertex[vertices.length]; System.arraycopy(vertices, 0, verts, 0, vertices.length); - Rect rect = (Rect)new ModelPart.Quad( + Rect rect = (Rect)(Object)new ModelPart.Quad( remap ? verts : defaultVertices, u, v, u + w, v + h, diff --git a/src/main/java/com/minelittlepony/mson/api/model/Vert.java b/src/main/java/com/minelittlepony/mson/api/model/Vert.java index 170659c..4adda8f 100644 --- a/src/main/java/com/minelittlepony/mson/api/model/Vert.java +++ b/src/main/java/com/minelittlepony/mson/api/model/Vert.java @@ -1,14 +1,22 @@ package com.minelittlepony.mson.api.model; +import net.minecraft.client.model.ModelPart; + import org.joml.Quaternionf; import org.joml.Vector3f; public interface Vert { - Vector3f getPos(); + default Vector3f getPos() { + return ((ModelPart.Vertex)this).pos(); + } - float getU(); + default float getU() { + return ((ModelPart.Vertex)this).u(); + } - float getV(); + default float getV() { + return ((ModelPart.Vertex)this).v(); + } default Vert rotate(float x, float y, float z) { return rotate(new Quaternionf().rotateXYZ(x, y, z)); diff --git a/src/main/java/com/minelittlepony/mson/api/model/biped/MsonPlayer.java b/src/main/java/com/minelittlepony/mson/api/model/biped/MsonPlayer.java index 52beeda..da42af4 100644 --- a/src/main/java/com/minelittlepony/mson/api/model/biped/MsonPlayer.java +++ b/src/main/java/com/minelittlepony/mson/api/model/biped/MsonPlayer.java @@ -9,18 +9,13 @@ import com.minelittlepony.mson.util.PartUtil; public class MsonPlayer - extends PlayerEntityModel + extends PlayerEntityModel implements MsonModel { - protected ModelPart cape; - protected ModelPart deadmsEars; - private boolean empty; public MsonPlayer(ModelPart tree) { super(tree, false); - cape = tree.getChild("cloak"); - deadmsEars = tree.getChild("ear"); empty = tree.traverse().noneMatch(p -> !p.isEmpty()); } diff --git a/src/main/java/com/minelittlepony/mson/impl/LoadWorker.java b/src/main/java/com/minelittlepony/mson/impl/LoadWorker.java index 067de62..f7a3f9e 100644 --- a/src/main/java/com/minelittlepony/mson/impl/LoadWorker.java +++ b/src/main/java/com/minelittlepony/mson/impl/LoadWorker.java @@ -1,6 +1,7 @@ package com.minelittlepony.mson.impl; import net.minecraft.util.profiler.Profiler; +import net.minecraft.util.profiler.Profilers; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; @@ -11,9 +12,10 @@ public interface LoadWorker { CompletableFuture load(Supplier loadFunc, String loadMessage); - public static LoadWorker async(Executor executor, Profiler profiler) { + public static LoadWorker async(Executor executor) { return (loadFunc, loadMessage) -> { return CompletableFuture.supplyAsync(() -> { + Profiler profiler = Profilers.get(); profiler.startTick(); profiler.push(loadMessage); try { diff --git a/src/main/java/com/minelittlepony/mson/impl/ModelFoundry.java b/src/main/java/com/minelittlepony/mson/impl/ModelFoundry.java index 782b67e..411b1f6 100644 --- a/src/main/java/com/minelittlepony/mson/impl/ModelFoundry.java +++ b/src/main/java/com/minelittlepony/mson/impl/ModelFoundry.java @@ -81,6 +81,7 @@ public Optional> getModelData(ModelKey key) throws Interrupted public CompletableFuture> loadModel(Identifier id, Identifier file, Resource resource) { synchronized (loadedFiles) { if (!loadedFiles.containsKey(id)) { + System.out.println("mson-reload:LOAD MODEL " + id + "/" + file); loadedFiles.put(id, getWorker().load(() -> { return mson.getHandlers(Files.getFileExtension(file.getPath())) .flatMap(handler -> handler.loadModel(id, file, resource, true, this).stream()) diff --git a/src/main/java/com/minelittlepony/mson/impl/MsonImpl.java b/src/main/java/com/minelittlepony/mson/impl/MsonImpl.java index 4bbf7cd..1d6040d 100644 --- a/src/main/java/com/minelittlepony/mson/impl/MsonImpl.java +++ b/src/main/java/com/minelittlepony/mson/impl/MsonImpl.java @@ -8,7 +8,6 @@ import net.minecraft.client.render.entity.model.EntityModelLayer; import net.minecraft.resource.ResourceManager; import net.minecraft.util.Identifier; -import net.minecraft.util.profiler.Profiler; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -75,7 +74,7 @@ public void registerVanillaModels(Map model synchronized (vanillaModels) { vanillaModels.clear(); modelParts.forEach((layer, vanilla) -> { - Identifier id = Identifier.of(layer.getId().getNamespace(), String.format("mson/%s", layer.getId().getPath())); + Identifier id = layer.id().withPath(p -> String.format("mson/%s", p)); ((MsonImpl.KeyHolder)vanilla).setKey(registeredModels.computeIfAbsent(id, VanillaKey::new)); vanillaModels.add(id); }); @@ -86,27 +85,22 @@ public void registerVanillaModels(Map model } } - private CompletableFuture requireVanillaModels(Synchronizer sync, ResourceManager sender, - Profiler prepareProfiler, Profiler applyProfiler, - Executor prepareExecutor, Executor applyExecutor) { + private CompletableFuture requireVanillaModels(ResourceManager sender, Executor prepareExecutor) { boolean hasVanillaModels; synchronized (vanillaModels) { hasVanillaModels = !vanillaModels.isEmpty(); } if (!hasVanillaModels) { - return MinecraftClient.getInstance().getEntityModelLoader() - .reload(sync, sender, prepareProfiler, applyProfiler, prepareExecutor, applyExecutor); + return CompletableFuture.runAsync(() -> MinecraftClient.getInstance().getEntityModelLoader().reload(sender), prepareExecutor); } return CompletableFuture.completedFuture(null); } @Override - public CompletableFuture reload(Synchronizer sync, ResourceManager sender, - Profiler prepareProfiler, Profiler applyProfiler, - Executor prepareExecutor, Executor applyExecutor) { - ModelFoundry loadingFoundry = new ModelFoundry(this).setWorker(LoadWorker.async(prepareExecutor, prepareProfiler)); + public CompletableFuture reload(Synchronizer sync, ResourceManager sender, Executor prepareExecutor, Executor applyExecutor) { + ModelFoundry loadingFoundry = new ModelFoundry(this).setWorker(LoadWorker.async(prepareExecutor)); - return requireVanillaModels(sync, sender, prepareProfiler, applyProfiler, prepareExecutor, applyExecutor) + return requireVanillaModels(sender, prepareExecutor) .thenComposeAsync(v -> loadingFoundry.load(), prepareExecutor) .thenCompose(sync::whenPrepared) .thenRunAsync(() -> { diff --git a/src/main/java/com/minelittlepony/mson/impl/PendingEntityRendererRegistry.java b/src/main/java/com/minelittlepony/mson/impl/PendingEntityRendererRegistry.java index 9c70103..875b6cf 100644 --- a/src/main/java/com/minelittlepony/mson/impl/PendingEntityRendererRegistry.java +++ b/src/main/java/com/minelittlepony/mson/impl/PendingEntityRendererRegistry.java @@ -32,7 +32,7 @@ public final class PendingEntityRendererRegistry implements EntityRendererRegist }); public final PendingRegistrations< EntityType, - Function> + Function> > entity = new PendingRegistrations<>(MsonImpl.id("renderers/entity"), EntityRendererRegistry::registerEntityRenderer); public final PendingRegistrations< BlockEntityType, @@ -45,7 +45,7 @@ public void registerPlayerRenderer(Identifier s } @Override - public > void registerEntityRenderer(EntityType type, Function constructor) { + public > void registerEntityRenderer(EntityType type, Function constructor) { entity.register(type, constructor); } diff --git a/src/main/java/com/minelittlepony/mson/impl/Test.java b/src/main/java/com/minelittlepony/mson/impl/Test.java index 9d9ef94..99e4ff9 100644 --- a/src/main/java/com/minelittlepony/mson/impl/Test.java +++ b/src/main/java/com/minelittlepony/mson/impl/Test.java @@ -2,7 +2,6 @@ import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.model.ModelPart; -import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.PlayerEntityRenderer; import net.minecraft.client.render.entity.model.PlayerEntityModel; @@ -72,7 +71,7 @@ static void exportBbModels(Iterable> keys) { }); } - static Function playerRendererFactor(ModelKey> key) { + static Function playerRendererFactor(ModelKey key) { return r -> new PlayerEntityRenderer(r, false) {{ this.model = key.createModel(); }}; diff --git a/src/main/java/com/minelittlepony/mson/impl/fast/FastModelPart.java b/src/main/java/com/minelittlepony/mson/impl/fast/FastModelPart.java index 1c0a424..3ed9f4d 100644 --- a/src/main/java/com/minelittlepony/mson/impl/fast/FastModelPart.java +++ b/src/main/java/com/minelittlepony/mson/impl/fast/FastModelPart.java @@ -73,12 +73,12 @@ private void computeContents() { for (Cuboid cube : accessor.getCuboids()) { Cube cu = ((Cube)cube); for (int i = 0; i < cu.sideCount(); i++) { - Quad quad = (Quad)cu.getSide(i); - for (Vertex vert : quad.vertices) { + Quad quad = (Quad)(Object)cu.getSide(i); + for (Vertex vert : quad.vertices()) { fragments.add(new Fragment( - vert.u, vert.v, - vertices.computeIfAbsent(vert.pos, Function.identity()), - normals.computeIfAbsent(quad.direction, Function.identity()) + vert.u(), vert.v(), + vertices.computeIfAbsent(vert.pos(), Function.identity()), + normals.computeIfAbsent(quad.direction(), Function.identity()) )); } } diff --git a/src/main/java/com/minelittlepony/mson/impl/mixin/MixinEntityRenderDispatcher.java b/src/main/java/com/minelittlepony/mson/impl/mixin/MixinEntityRenderDispatcher.java index 46fb25b..fdd249b 100644 --- a/src/main/java/com/minelittlepony/mson/impl/mixin/MixinEntityRenderDispatcher.java +++ b/src/main/java/com/minelittlepony/mson/impl/mixin/MixinEntityRenderDispatcher.java @@ -32,7 +32,7 @@ @Mixin(EntityRenderDispatcher.class) abstract class MixinEntityRenderDispatcher implements EntityRendererRegistry { @Shadow - private Map, EntityRenderer> renderers; + private Map, EntityRenderer> renderers; private Map, PlayerEntityRenderer>> customModelRenderers; @Shadow private @Final EntityModelLoader modelLoader; @@ -48,9 +48,11 @@ private EntityRendererFactory.Context createContext() { EntityRenderDispatcher self = (EntityRenderDispatcher)(Object)this; return new EntityRendererFactory.Context(self, mc.getItemRenderer(), + mc.getMapRenderer(), mc.getBlockRenderManager(), - mc.getEntityRenderDispatcher().getHeldItemRenderer(), mc.getResourceManager(), + mc.getResourceManager(), modelLoader, + mc.getEquipmentModelLoader(), mc.textRenderer ); } @@ -68,7 +70,7 @@ public void registerPlayerRenderer(Identifier i } @Override - public > void registerEntityRenderer(EntityType type, Function constructor) { + public > void registerEntityRenderer(EntityType type, Function constructor) { try { if (renderers instanceof ImmutableMap) { renderers = new HashMap<>(renderers); @@ -84,7 +86,7 @@ public > void registerEntityRender at = @At("HEAD"), cancellable = true ) - private void onGetRenderer(Entity entity, CallbackInfoReturnable> info) { + private void onGetRenderer(Entity entity, CallbackInfoReturnable> info) { if (entity instanceof AbstractClientPlayerEntity player) { customModelRenderers.values().stream() .filter(entry -> entry.getKey().test(player)) diff --git a/src/main/java/com/minelittlepony/mson/impl/mixin/MixinModelPart.java b/src/main/java/com/minelittlepony/mson/impl/mixin/MixinModelPart.java index c1b7b71..3eb10c7 100644 --- a/src/main/java/com/minelittlepony/mson/impl/mixin/MixinModelPart.java +++ b/src/main/java/com/minelittlepony/mson/impl/mixin/MixinModelPart.java @@ -51,11 +51,11 @@ public void setSides(Rect[] sides) { } @Override public Rect getSide(int index) { - return (Rect)sides[index]; + return (Rect)(Object)sides[index]; } @Override public void setSide(int index, Rect value) { - sides[index] = (ModelPart.Quad)value; + sides[index] = (ModelPart.Quad)(Object)value; } @Override public int sideCount() { @@ -74,11 +74,11 @@ abstract class MixinQuad implements Rect { @Override public Vert getVertex(int index) { - return (Vert)vertices[index]; + return (Vert)(Object)vertices[index]; } @Override public void setVertex(int index, Vert value) { - vertices[index] = (ModelPart.Vertex)value; + vertices[index] = (ModelPart.Vertex)(Object)value; } @Override @@ -112,10 +112,4 @@ public Rect setVertices(boolean reflect, Vert...vertices) { @Mixin(ModelPart.Vertex.class) abstract class MixinVertex implements Vert { - @Accessor("pos") @Override - public abstract Vector3f getPos(); - @Accessor("u") @Override - public abstract float getU(); - @Accessor("v") @Override - public abstract float getV(); } diff --git a/src/main/java/com/minelittlepony/mson/impl/mixin/MixinTexturedModelData.java b/src/main/java/com/minelittlepony/mson/impl/mixin/MixinTexturedModelData.java index 53bc899..a2f92dd 100644 --- a/src/main/java/com/minelittlepony/mson/impl/mixin/MixinTexturedModelData.java +++ b/src/main/java/com/minelittlepony/mson/impl/mixin/MixinTexturedModelData.java @@ -69,8 +69,8 @@ public JsonObject toJson(JsonBuffer exporter) { children.forEach((key, value) -> js.add(key, exporter.write(value))); })); if (rotationData != ModelTransform.NONE) { - exporter.array(json, "pivot", rotationData.pivotX, rotationData.pivotY, rotationData.pivotZ); - exporter.array(json, "rotate", rotationData.pitch, rotationData.yaw, rotationData.roll); + exporter.array(json, "pivot", rotationData.pivotX(), rotationData.pivotY(), rotationData.pivotZ()); + exporter.array(json, "rotate", rotationData.pitch(), rotationData.yaw(), rotationData.roll()); } }); } diff --git a/src/main/resources/assets/mson/models/entity/alex.json b/src/main/resources/assets/mson/models/entity/alex.json index 1786655..5faabb0 100644 --- a/src/main/resources/assets/mson/models/entity/alex.json +++ b/src/main/resources/assets/mson/models/entity/alex.json @@ -6,28 +6,30 @@ "texture": { "u": 32, "v": 48 }, "cubes": [ { "from": [-1, -2, -2], "size": [ 3, 12, 4] } - ] + ], + "children": { + "left_sleeve": { + "texture": { "u": 48, "v": 48 }, + "cubes": [ + { "from": [-1, -2, -2], "size": [ 3, 12, 4], "dilate": [0.25, 0.25, 0.25] } + ] + } + } }, "right_arm": { "pivot": [-5, 2.5, 0], "texture": { "u": 40, "v": 16 }, "cubes": [ { "from": [-2, -2, -2], "size": [ 3, 12, 4] } - ] - }, - "right_sleeve": { - "pivot": [-5, 2.5, 10], - "texture": { "u": 40, "v": 32 }, - "cubes": [ - { "from": [-2, -2, -2], "size": [ 3, 12, 4], "dilate": [0.25, 0.25, 0.25] } - ] - }, - "left_sleeve": { - "pivot": [5, 2.5, 0], - "texture": { "u": 48, "v": 48 }, - "cubes": [ - { "from": [-1, -2, -2], "size": [ 3, 12, 4], "dilate": [0.25, 0.25, 0.25] } - ] + ], + "children": { + "right_sleeve": { + "texture": { "u": 40, "v": 32 }, + "cubes": [ + { "from": [-2, -2, -2], "size": [ 3, 12, 4], "dilate": [0.25, 0.25, 0.25] } + ] + } + } } } } diff --git a/src/main/resources/assets/mson/models/entity/biped.json b/src/main/resources/assets/mson/models/entity/biped.json index 1e18733..615979b 100644 --- a/src/main/resources/assets/mson/models/entity/biped.json +++ b/src/main/resources/assets/mson/models/entity/biped.json @@ -6,13 +6,15 @@ "head": { "cubes": [ { "from": [-4, -8, -4], "size": [ 8, 8, 8] } - ] - }, - "hat": { - "texture": { "u": 32, "v": 0 }, - "cubes": [ - { "from": [-4, -8, -4], "size": [ 8, 8, 8], "dilate": [0.5, 0.5, 0.5] } - ] + ], + "children": { + "hat": { + "texture": { "u": 32, "v": 0 }, + "cubes": [ + { "from": [-4, -8, -4], "size": [ 8, 8, 8], "dilate": [0.5, 0.5, 0.5] } + ] + } + } }, "body": { "texture": { "u": 16, "v": 16 }, diff --git a/src/main/resources/assets/mson/models/entity/player_cape.json b/src/main/resources/assets/mson/models/entity/player_cape.json new file mode 100644 index 0000000..d2f2c2c --- /dev/null +++ b/src/main/resources/assets/mson/models/entity/player_cape.json @@ -0,0 +1,15 @@ +{ + "parent": "mson:biped", + "texture": { + "w": 64, "h": 64 + }, + "data": { + "cape": { + "texture": { "u": 0, "v": 0, "w": 64, "h": 32 }, + "visible": false, + "cubes": [ + { "from": [-5, 0, -1], "size": [10, 16, 1] } + ] + } + } +} diff --git a/src/main/resources/assets/mson/models/entity/player_ears.json b/src/main/resources/assets/mson/models/entity/player_ears.json new file mode 100644 index 0000000..fd6d767 --- /dev/null +++ b/src/main/resources/assets/mson/models/entity/player_ears.json @@ -0,0 +1,24 @@ +{ + "parent": "mson:biped", + "texture": { + "w": 64, "h": 64 + }, + "data": { + "left_ear": { + "texture": { "u": 24, "v": 0 }, + "pivot": [-6, -6, 0], + "visible": false, + "cubes": [ + { "from": [-3, -6, -1], "size": [6, 6, 1] } + ] + }, + "right_ear": { + "texture": { "u": 24, "v": 0 }, + "pivot": [6, -6, 0], + "visible": false, + "cubes": [ + { "from": [-3, -6, -1], "size": [6, 6, 1] } + ] + } + } +} diff --git a/src/main/resources/assets/mson/models/entity/steve.json b/src/main/resources/assets/mson/models/entity/steve.json index dbcbff4..0f80d33 100644 --- a/src/main/resources/assets/mson/models/entity/steve.json +++ b/src/main/resources/assets/mson/models/entity/steve.json @@ -4,72 +4,86 @@ "w": 64, "h": 64 }, "data": { - "ear": { - "texture": { "u": 24, "v": 0 }, - "visible": false, - "cubes": [ - { "from": [-3, -6, -1], "size": [6, 6, 1] } - ] - }, - "cloak": { - "texture": { "u": 0, "v": 0, "w": 64, "h": 32 }, - "visible": false, - "cubes": [ - { "from": [-5, 0, -1], "size": [10, 16, 1] } - ] - }, - "jacket": { - "texture": { "u": 16, "v": 32 }, - "visible": false, - "cubes": [ - { "from": [-4, 0, -2], "size": [ 8, 12, 4], "dilate": [0.25, 0.25, 0.25] } - ] - }, + "body": { + "texture": { "u": 16, "v": 16 }, + "cubes": [ + { "from": [-4, 0, -2], "size": [ 8, 12, 4] } + ], + "children": { + "jacket": { + "texture": { "u": 16, "v": 32 }, + "visible": false, + "cubes": [ + { "from": [-4, 0, -2], "size": [ 8, 12, 4], "dilate": [0.25, 0.25, 0.25] } + ] + } + } + }, "left_arm": { "pivot": [5, 2, 0], "texture": { "u": 32, "v": 48 }, "cubes": [ { "from": [-1, -2, -2], "size": [ 4, 12, 4] } - ] + ], + "children": { + "left_sleeve": { + "visible": false, + "texture": { "u": 48, "v": 48 }, + "cubes": [ + { "from": [-1, -2, -2], "size": [ 4, 12, 4], "dilate": [0.25, 0.25, 0.25] } + ] + } + } }, + "right_arm": { + "pivot": [-5, 2, 0], + "texture": { "u": 40, "v": 16 }, + "cubes": [ + { "from": [-3, -2, -2], "size": [ 4, 12, 4] } + ], + "children": { + "right_sleeve": { + "visible": false, + "texture": { "u": 40, "v": 32 }, + "cubes": [ + { "from": [-3, -2, -2], "size": [ 4, 12, 4], "dilate": [0.25, 0.25, 0.25] } + ] + } + } + }, "left_leg": { "pivot": [1.9, 12, 0], "texture": { "u": 16, "v": 48 }, "cubes": [ { "from": [-2, 0, -2], "size": [ 4, 12, 4] } - ] - }, - "right_sleeve": { - "pivot": [-5, 2, 0], - "visible": false, - "texture": { "u": 40, "v": 32 }, - "cubes": [ - { "from": [-3, -2, -2], "size": [ 4, 12, 4], "dilate": [0.25, 0.25, 0.25] } - ] + ], + "children": { + "left_pants": { + "pivot": [1.9, 12, 0], + "visible": false, + "texture": { "u": 0, "v": 48 }, + "cubes": [ + { "from": [-2, 0, -2], "size": [ 4, 12, 4], "dilate": [0.25, 0.25, 0.25] } + ] + } + } }, - "left_sleeve": { - "pivot": [5, 2, 0], - "visible": false, - "texture": { "u": 48, "v": 48 }, - "cubes": [ - { "from": [-1, -2, -2], "size": [ 4, 12, 4], "dilate": [0.25, 0.25, 0.25] } - ] - }, - "right_pants": { - "pivot": [-1.9, 12, 0], - "visible": false, - "texture": { "u": 0, "v": 32 }, - "cubes": [ - { "from": [-2, 0, -2], "size": [ 4, 12, 4], "dilate": [0.25, 0.25, 0.25] } - ] - }, - "left_pants": { - "pivot": [1.9, 12, 0], - "visible": false, - "texture": { "u": 0, "v": 48 }, - "cubes": [ - { "from": [-2, 0, -2], "size": [ 4, 12, 4], "dilate": [0.25, 0.25, 0.25] } - ] - } + "right_leg": { + "pivot": [-1.9, 12, 0], + "texture": { "u": 0, "v": 16 }, + "cubes": [ + { "from": [-2, 0, -2], "size": [ 4, 12, 4] } + ], + "children": { + "right_pants": { + "pivot": [-1.9, 12, 0], + "visible": false, + "texture": { "u": 0, "v": 32 }, + "cubes": [ + { "from": [-2, 0, -2], "size": [ 4, 12, 4], "dilate": [0.25, 0.25, 0.25] } + ] + } + } + } } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index dc4783b..0cf8cbd 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -36,6 +36,10 @@ "links": { "modmenu.discord": "https://discord.gg/zKSZ8Mg" } + }, + "loom:injected_interfaces": { + "net/minecraft/class_630$class_618": ["com/minelittlepony/mson/api/model/Vert"], + "net/minecraft/class_630$class_593": ["com/minelittlepony/mson/api/model/Rect"] } } } diff --git a/src/test/resources/assets/minecraft/models/entity/mson/enderman.json b/src/test/resources/assets/minecraft/models/entity/mson/enderman.json index 7298eb4..4e5ec17 100644 --- a/src/test/resources/assets/minecraft/models/entity/mson/enderman.json +++ b/src/test/resources/assets/minecraft/models/entity/mson/enderman.json @@ -1,13 +1,20 @@ { "parent": "mson:biped", "data": { - "hat": { - "texture": { "u": 0, "v": 16 }, - "pivot": [0, -14, 0], - "cubes": [ - { "from": [-4, -8, -4], "size": [ 8, 8, 8], "dilate": [-0.5, -0.5, -0.5] } - ] - }, + "head": { + "cubes": [ + { "from": [-4, -8, -4], "size": [ 8, 8, 8] } + ], + "children": { + "hat": { + "texture": { "u": 0, "v": 16 }, + "pivot": [0, -14, 0], + "cubes": [ + { "from": [-4, -8, -4], "size": [ 8, 8, 8], "dilate": [-0.5, -0.5, -0.5] } + ] + } + } + }, "body": { "texture": { "u": 32, "v": 16 }, "pivot": [0, -14, 0], diff --git a/src/test/resources/assets/mson_test/models/entity/planar_cube.json b/src/test/resources/assets/mson_test/models/entity/planar_cube.json index 4ed1cf3..bdb94c5 100644 --- a/src/test/resources/assets/mson_test/models/entity/planar_cube.json +++ b/src/test/resources/assets/mson_test/models/entity/planar_cube.json @@ -2,7 +2,12 @@ "parent": "mson:alex", "data": { "head": { - "visible": false + "visible": false, + "children": { + "hat": { + "visible": false + } + } }, "body": { "cubes": [ @@ -14,19 +19,44 @@ "position": [18, -8, 8], "mirror": [false, false] } - ] + ], + "children": { + "jacket": { + "visible": false + } + } }, "left_arm": { - "visible": false + "visible": false, + "children": { + "left_sleeve": { + "visible": false + } + } }, "left_leg": { - "visible": false + "visible": false, + "children": { + "left_pants": { + "visible": false + } + } }, "right_arm": { - "visible": false + "visible": false, + "children": { + "right_sleeve": { + "visible": false + } + } }, "right_leg": { - "visible": false + "visible": false, + "children": { + "right_pants": { + "visible": false + } + } }, "planar_test_4x4x4_cube": { "type": "mson:planar", diff --git a/src/test/resources/assets/mson_test/models/entity/plane.json b/src/test/resources/assets/mson_test/models/entity/plane.json index 1999e70..b542bb7 100644 --- a/src/test/resources/assets/mson_test/models/entity/plane.json +++ b/src/test/resources/assets/mson_test/models/entity/plane.json @@ -2,7 +2,12 @@ "parent": "mson:alex", "data": { "head": { - "visible": false + "visible": false, + "children": { + "hat": { + "visible": false + } + } }, "body": { "cubes": [ @@ -13,19 +18,44 @@ "position": [-32, -32, 0], "mirror": [false, true] } - ] + ], + "children": { + "jacket": { + "visible": false + } + } }, "left_arm": { - "visible": false + "visible": false, + "children": { + "left_sleeve": { + "visible": false + } + } }, "left_leg": { - "visible": false + "visible": false, + "children": { + "left_pants": { + "visible": false + } + } }, "right_arm": { - "visible": false + "visible": false, + "children": { + "right_sleeve": { + "visible": false + } + } }, "right_leg": { - "visible": false + "visible": false, + "children": { + "right_pants": { + "visible": false + } + } } } } diff --git a/src/test/resources/assets/mson_test/models/entity/rayman.json b/src/test/resources/assets/mson_test/models/entity/rayman.json index 2dd646b..c3bb496 100644 --- a/src/test/resources/assets/mson_test/models/entity/rayman.json +++ b/src/test/resources/assets/mson_test/models/entity/rayman.json @@ -4,41 +4,71 @@ "head": { "cubes": [ { "from": [-4, -9, -4], "size": [ 8, 8, 8] } - ] + ], + "children": { + "hat": { + "visible": false + } + } }, "body": { "texture": { "u": 16, "v": 16 }, "cubes": [ { "from": [-4, 0, -2], "size": [ 8, 12, 4] } - ] + ], + "children": { + "jacket": { + "visible": false + } + } }, "left_arm": { "pivot": [6, 2.5, 0], "texture": { "u": 32, "v": 48 }, "cubes": [ { "from": [0, 6, -2], "size": [ 3, 4, 4] } - ] + ], + "children": { + "left_sleeve": { + "visible": false + } + } }, "left_leg": { "pivot": [1.9, 12, 0], "texture": { "u": 16, "v": 48 }, "cubes": [ { "from": [-2, 8, -2], "size": [ 4, 4, 4] } - ] + ], + "children": { + "left_pants": { + "visible": false + } + } }, "right_arm": { "pivot": [-6, 2.5, 0], "texture": { "u": 40, "v": 16 }, "cubes": [ { "from": [-3, 6, -2], "size": [ 3, 4, 4] } - ] + ], + "children": { + "right_sleeve": { + "visible": false + } + } }, "right_leg": { "pivot": [-1.9, 12, 0], "texture": { "u": 0, "v": 16 }, "cubes": [ { "from": [-2, 8, -2], "size": [ 4, 4, 4] } - ] + ], + "children": { + "right_pants": { + "visible": false + } + } } } } diff --git a/src/test/resources/assets/mson_test/models/entity/slot_test.json b/src/test/resources/assets/mson_test/models/entity/slot_test.json index f4d249e..23c5daf 100644 --- a/src/test/resources/assets/mson_test/models/entity/slot_test.json +++ b/src/test/resources/assets/mson_test/models/entity/slot_test.json @@ -5,7 +5,10 @@ "cubes": [ { "from": [-4, -9, -4], "size": [ 8, 8, 8] } ], - "children": { + "children": { + "hat": { + "visible": false + }, "a_slot": { "type": "mson:slot", "name": "a_slot", @@ -21,35 +24,60 @@ "texture": { "u": 16, "v": 16 }, "cubes": [ { "from": [-4, 0, -2], "size": [ 8, 12, 4] } - ] + ], + "children": { + "jacket": { + "visible": false + } + } }, "left_arm": { "pivot": [6, 2.5, 0], "texture": { "u": 32, "v": 48 }, "cubes": [ { "from": [0, 6, -2], "size": [ 3, 4, 4] } - ] + ], + "children": { + "left_sleeve": { + "visible": false + } + } }, "left_leg": { "pivot": [1.9, 12, 0], "texture": { "u": 16, "v": 48 }, "cubes": [ { "from": [-2, 8, -2], "size": [ 4, 4, 4] } - ] + ], + "children": { + "left_pants": { + "visible": false + } + } }, "right_arm": { "pivot": [-6, 2.5, 0], "texture": { "u": 40, "v": 16 }, "cubes": [ { "from": [-3, 6, -2], "size": [ 3, 4, 4] } - ] + ], + "children": { + "right_sleeve": { + "visible": false + } + } }, "right_leg": { "pivot": [-1.9, 12, 0], "texture": { "u": 0, "v": 16 }, "cubes": [ { "from": [-2, 8, -2], "size": [ 4, 4, 4] } - ] + ], + "children": { + "right_pants": { + "visible": false + } + } } } }