diff --git a/gradle.properties b/gradle.properties index 44f07f50..b33d2341 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,4 +23,4 @@ org.gradle.daemon=false modmenu_version=4.0.0 kirin_version=1.11.0-beta.2 hd_skins_version=6.6.0 - mson_version=1.6.0-beta.3 + mson_version=1.6.0-beta.4 diff --git a/src/main/java/com/minelittlepony/client/model/ModelType.java b/src/main/java/com/minelittlepony/client/model/ModelType.java index 1a337db2..b380e6a9 100644 --- a/src/main/java/com/minelittlepony/client/model/ModelType.java +++ b/src/main/java/com/minelittlepony/client/model/ModelType.java @@ -2,6 +2,7 @@ package com.minelittlepony.client.model; import net.minecraft.client.model.Model; import net.minecraft.client.model.ModelPart; +import net.minecraft.client.render.entity.model.AllayEntityModel; import net.minecraft.client.render.entity.model.ArmorStandEntityModel; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.mob.VexEntity; @@ -70,6 +71,7 @@ public final class ModelType { public static final ModelKey ENDERMAN = register("enderman", EnderStallionModel::new); public static final ModelKey> BREEZIE = register("breezie", BreezieModel::new); public static final ModelKey PARASPRITE = register("parasprite", ParaspriteModel::new); + public static final ModelKey ALLAY = register("allay", AllayEntityModel::new); public static final ModelKey> ELYTRA = register("elytra", PonyElytra::new); diff --git a/src/main/java/com/minelittlepony/client/render/MobRenderers.java b/src/main/java/com/minelittlepony/client/render/MobRenderers.java index fcbcec6a..9f9d29f3 100644 --- a/src/main/java/com/minelittlepony/client/render/MobRenderers.java +++ b/src/main/java/com/minelittlepony/client/render/MobRenderers.java @@ -59,6 +59,9 @@ public final class MobRenderers { public static final MobRenderers STRIDER = register("striders", (state, pony) -> { pony.switchRenderer(state, EntityType.STRIDER, ParaspriteRenderer::new); }); + public static final MobRenderers ALLAY = register("allays", (state, pony) -> { + pony.switchRenderer(state, EntityType.ALLAY, AllayRenderer::new); + }); private final BiConsumer changer; diff --git a/src/main/java/com/minelittlepony/client/render/entity/AllayRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/AllayRenderer.java new file mode 100644 index 00000000..37cf04fc --- /dev/null +++ b/src/main/java/com/minelittlepony/client/render/entity/AllayRenderer.java @@ -0,0 +1,29 @@ +package com.minelittlepony.client.render.entity; + +import net.minecraft.client.render.entity.*; +import net.minecraft.client.render.entity.feature.HeldItemFeatureRenderer; +import net.minecraft.client.render.entity.model.AllayEntityModel; +import net.minecraft.entity.passive.AllayEntity; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; + +import com.minelittlepony.client.model.ModelType; + +public class AllayRenderer extends MobEntityRenderer { + private static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/entity/allay/allay_pony.png"); + + public AllayRenderer(EntityRendererFactory.Context context) { + super(context, ModelType.ALLAY.createModel(), 0.4f); + addFeature(new HeldItemFeatureRenderer(this, context.getHeldItemRenderer())); + } + + @Override + public Identifier getTexture(AllayEntity allayEntity) { + return TEXTURE; + } + + @Override + protected int getBlockLight(AllayEntity allayEntity, BlockPos blockPos) { + return 15; + } +} diff --git a/src/main/java/com/minelittlepony/client/util/render/NativeUtil.java b/src/main/java/com/minelittlepony/client/util/render/NativeUtil.java index a627eb22..4099fe6c 100644 --- a/src/main/java/com/minelittlepony/client/util/render/NativeUtil.java +++ b/src/main/java/com/minelittlepony/client/util/render/NativeUtil.java @@ -112,7 +112,7 @@ public class NativeUtil { int height = _getTexLevelParameter(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT); if (width * height == 0) { - throw new IllegalStateException("GL texture not uploaded yet"); + throw new IllegalStateException("GL texture not uploaded yet: " + resource); } try (NativeImage image = new NativeImage(InternalFormat.valueOf(format).getClassification(), width, height, false)) { diff --git a/src/main/resources/assets/minelittlepony/models/allay.json b/src/main/resources/assets/minelittlepony/models/allay.json new file mode 100644 index 00000000..3d0fd463 --- /dev/null +++ b/src/main/resources/assets/minelittlepony/models/allay.json @@ -0,0 +1,59 @@ +{ + "texture": {"w": 32, "h": 32}, + "data": { + "root": { + "pivot": [0, 23.5, 0], + "children": { + "head": { + "pivot": [ 0, -3.99, 0 ], + "cubes": [ + { "from": [-2.5, -5, -2.5], "size": [ 5, 5, 5] }, + + { "from": [-2.7, -6.6, -0.5], "size": [ 2, 2, 2], "texture": {"u": 10, "v": 10}, "dilate": -0.4 }, + { "from": [ 0.7, -6.6, -0.5], "size": [ 2, 2, 2], "texture": {"u": 10, "v": 14}, "dilate": -0.4 }, + + { "from": [-1, -1, -3.3], "size": [ 2, 1, 1], "texture": {"u": 18, "v": 15} } + ] + }, + "body": { + "texture": { "u": 0, "v": 10 }, + "pivot": [ 0, -4, 0 ], + "cubes": [ + { "from": [-1.5, 0, -1], "size": [ 3, 4, 2] }, + { "from": [-1.5, 0, -1], "size": [ 3, 5, 2], "texture": {"u": 0, "v": 16}, "dilate": -0.2 } + ], + "children": { + "right_arm": { + "texture": { "u": 23, "v": 0 }, + "pivot": [ -1.75, 0.5, 0 ], + "cubes": [ + { "from": [-0.75, -0.5, -1], "size": [ 1, 4, 2], "dilate": -0.01 } + ] + }, + "left_arm": { + "texture": { "u": 23, "v": 6 }, + "pivot": [ 1.75, 0.5, 0 ], + "cubes": [ + { "from": [-0.25, -0.5, -1], "size": [ 1, 4, 2], "dilate": -0.01 } + ] + }, + "right_wing": { + "texture": { "u": 16, "v": 14 }, + "pivot": [ -0.5, 0, 0.65 ], + "cubes": [ + { "from": [0, 1, 0], "size": [ 0, 5, 8] } + ] + }, + "left_wing": { + "texture": { "u": 16, "v": 14 }, + "pivot": [ 0.5, 0, 0.65 ], + "cubes": [ + { "from": [0, 1, 0], "size": [ 0, 5, 8] } + ] + } + } + } + } + } + } +} diff --git a/src/main/resources/assets/minelittlepony/textures/entity/allay/allay_pony.png b/src/main/resources/assets/minelittlepony/textures/entity/allay/allay_pony.png new file mode 100644 index 00000000..852c7b49 Binary files /dev/null and b/src/main/resources/assets/minelittlepony/textures/entity/allay/allay_pony.png differ