mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
[Backport] Ponify the bogged
# Conflicts: # src/main/java/com/minelittlepony/client/render/MobRenderers.java # src/main/java/com/minelittlepony/client/render/entity/SkeleponyRenderer.java # src/main/java/com/minelittlepony/client/render/entity/feature/AbstractClothingFeature.java
This commit is contained in:
parent
5fce5b376c
commit
c42461cad6
8 changed files with 153 additions and 2 deletions
|
@ -1,8 +1,11 @@
|
||||||
package com.minelittlepony.client.model;
|
package com.minelittlepony.client.model;
|
||||||
|
|
||||||
import net.minecraft.client.model.Model;
|
import net.minecraft.client.model.Model;
|
||||||
|
import net.minecraft.client.render.RenderLayer;
|
||||||
import net.minecraft.client.model.ModelPart;
|
import net.minecraft.client.model.ModelPart;
|
||||||
import net.minecraft.client.render.entity.model.ArmorStandEntityModel;
|
import net.minecraft.client.render.entity.model.ArmorStandEntityModel;
|
||||||
|
import net.minecraft.client.render.entity.model.SinglePartEntityModel;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.mob.VexEntity;
|
import net.minecraft.entity.mob.VexEntity;
|
||||||
import net.minecraft.entity.passive.*;
|
import net.minecraft.entity.passive.*;
|
||||||
|
@ -38,6 +41,15 @@ public final class ModelType {
|
||||||
public static final ModelKey<ZomponyModel<?>> ZOMBIE = register("zombie", ZomponyModel::new);
|
public static final ModelKey<ZomponyModel<?>> ZOMBIE = register("zombie", ZomponyModel::new);
|
||||||
public static final ModelKey<PiglinPonyModel> PIGLIN = register("piglin", PiglinPonyModel::new);
|
public static final ModelKey<PiglinPonyModel> PIGLIN = register("piglin", PiglinPonyModel::new);
|
||||||
public static final ModelKey<SkeleponyModel<?>> SKELETON = register("skeleton", SkeleponyModel::new);
|
public static final ModelKey<SkeleponyModel<?>> SKELETON = register("skeleton", SkeleponyModel::new);
|
||||||
|
public static final ModelKey<SinglePartEntityModel<?>> BOGGED_MUSHROOMS = register("bogged_mushrooms", tree -> new SinglePartEntityModel<>(RenderLayer::getEntityTranslucent) {
|
||||||
|
@Override
|
||||||
|
public ModelPart getPart() {
|
||||||
|
return tree;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAngles(Entity entity, float var2, float var3, float var4, float var5, float var6) {}
|
||||||
|
});
|
||||||
public static final ModelKey<SkeleponyModel<?>> SKELETON_CLOTHES = register("skeleton_clothes", SkeleponyModel::new);
|
public static final ModelKey<SkeleponyModel<?>> SKELETON_CLOTHES = register("skeleton_clothes", SkeleponyModel::new);
|
||||||
public static final ModelKey<PillagerPonyModel<?>> PILLAGER = register("pillager", PillagerPonyModel::new);
|
public static final ModelKey<PillagerPonyModel<?>> PILLAGER = register("pillager", PillagerPonyModel::new);
|
||||||
public static final ModelKey<IllagerPonyModel<?>> ILLAGER = register("illager", IllagerPonyModel::new);
|
public static final ModelKey<IllagerPonyModel<?>> ILLAGER = register("illager", IllagerPonyModel::new);
|
||||||
|
|
|
@ -48,6 +48,7 @@ public class MobRenderers {
|
||||||
public static final MobRenderers SKELETON = register("skeletons", (state, pony) -> {
|
public static final MobRenderers SKELETON = register("skeletons", (state, pony) -> {
|
||||||
pony.switchRenderer(state, EntityType.SKELETON, SkeleponyRenderer::skeleton);
|
pony.switchRenderer(state, EntityType.SKELETON, SkeleponyRenderer::skeleton);
|
||||||
pony.switchRenderer(state, EntityType.STRAY, SkeleponyRenderer::stray);
|
pony.switchRenderer(state, EntityType.STRAY, SkeleponyRenderer::stray);
|
||||||
|
pony.switchRenderer(state, EntityType.BOGGED, SkeleponyRenderer::bogged);
|
||||||
pony.switchRenderer(state, EntityType.WITHER_SKELETON, SkeleponyRenderer::wither);
|
pony.switchRenderer(state, EntityType.WITHER_SKELETON, SkeleponyRenderer::wither);
|
||||||
});
|
});
|
||||||
public static final MobRenderers GUARDIAN = register("guardians", (state, pony) -> {
|
public static final MobRenderers GUARDIAN = register("guardians", (state, pony) -> {
|
||||||
|
|
|
@ -1,19 +1,30 @@
|
||||||
package com.minelittlepony.client.render.entity;
|
package com.minelittlepony.client.render.entity;
|
||||||
|
|
||||||
|
import com.minelittlepony.api.model.BodyPart;
|
||||||
import com.minelittlepony.client.MineLittlePony;
|
import com.minelittlepony.client.MineLittlePony;
|
||||||
import com.minelittlepony.client.model.ModelType;
|
import com.minelittlepony.client.model.ModelType;
|
||||||
import com.minelittlepony.client.model.entity.SkeleponyModel;
|
import com.minelittlepony.client.model.entity.SkeleponyModel;
|
||||||
import com.minelittlepony.client.render.entity.feature.StrayClothingFeature;
|
import com.minelittlepony.client.render.entity.feature.ClothingFeature;
|
||||||
import com.minelittlepony.client.render.entity.npc.textures.TextureSupplier;
|
import com.minelittlepony.client.render.entity.npc.textures.TextureSupplier;
|
||||||
|
|
||||||
|
import net.minecraft.client.render.*;
|
||||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
|
import net.minecraft.client.render.entity.LivingEntityRenderer;
|
||||||
|
import net.minecraft.client.render.entity.feature.FeatureRenderer;
|
||||||
|
import net.minecraft.client.render.entity.model.SinglePartEntityModel;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.mob.*;
|
import net.minecraft.entity.mob.*;
|
||||||
|
import net.minecraft.util.Colors;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class SkeleponyRenderer<Skeleton extends AbstractSkeletonEntity> extends PonyRenderer<Skeleton, SkeleponyModel<Skeleton>> {
|
public class SkeleponyRenderer<Skeleton extends AbstractSkeletonEntity> extends PonyRenderer<Skeleton, SkeleponyModel<Skeleton>> {
|
||||||
public static final Identifier SKELETON = MineLittlePony.id("textures/entity/skeleton/skeleton_pony.png");
|
public static final Identifier SKELETON = MineLittlePony.id("textures/entity/skeleton/skeleton_pony.png");
|
||||||
public static final Identifier WITHER = MineLittlePony.id("textures/entity/skeleton/skeleton_wither_pony.png");
|
public static final Identifier WITHER = MineLittlePony.id("textures/entity/skeleton/skeleton_wither_pony.png");
|
||||||
public static final Identifier STRAY = MineLittlePony.id("textures/entity/skeleton/stray_pony.png");
|
public static final Identifier STRAY = MineLittlePony.id("textures/entity/skeleton/stray_pony.png");
|
||||||
|
public static final Identifier BOGGED = MineLittlePony.id("textures/entity/skeleton/bogged_pony.png");
|
||||||
|
|
||||||
|
public static final Identifier STRAY_SKELETON_OVERLAY = MineLittlePony.id("textures/entity/skeleton/stray_pony_overlay.png");
|
||||||
|
public static final Identifier BOGGED_SKELETON_OVERLAY = MineLittlePony.id("textures/entity/skeleton/bogged_pony_overlay.png");
|
||||||
|
|
||||||
public SkeleponyRenderer(EntityRendererFactory.Context context, Identifier texture, float scale) {
|
public SkeleponyRenderer(EntityRendererFactory.Context context, Identifier texture, float scale) {
|
||||||
super(context, ModelType.SKELETON, TextureSupplier.of(texture), scale);
|
super(context, ModelType.SKELETON, TextureSupplier.of(texture), scale);
|
||||||
|
@ -24,10 +35,40 @@ public class SkeleponyRenderer<Skeleton extends AbstractSkeletonEntity> extends
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SkeleponyRenderer<StrayEntity> stray(EntityRendererFactory.Context context) {
|
public static SkeleponyRenderer<StrayEntity> stray(EntityRendererFactory.Context context) {
|
||||||
return PonyRenderer.appendFeature(new SkeleponyRenderer<>(context, STRAY, 1), StrayClothingFeature::new);
|
return PonyRenderer.appendFeature(new SkeleponyRenderer<StrayEntity>(context, STRAY, 1), ctx -> {
|
||||||
|
return new ClothingFeature<StrayEntity, SkeleponyModel<StrayEntity>>(ctx, ModelType.SKELETON_CLOTHES, STRAY_SKELETON_OVERLAY);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SkeleponyRenderer<BoggedEntity> bogged(EntityRendererFactory.Context context) {
|
||||||
|
return PonyRenderer.appendFeature(PonyRenderer.appendFeature(new SkeleponyRenderer<>(context, BOGGED, 1), ctx -> {
|
||||||
|
return new ClothingFeature<BoggedEntity, SkeleponyModel<BoggedEntity>>(ctx, ModelType.SKELETON_CLOTHES, BOGGED_SKELETON_OVERLAY);
|
||||||
|
}), BoggedMushroomsFeature::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SkeleponyRenderer<WitherSkeletonEntity> wither(EntityRendererFactory.Context context) {
|
public static SkeleponyRenderer<WitherSkeletonEntity> wither(EntityRendererFactory.Context context) {
|
||||||
return new SkeleponyRenderer<>(context, WITHER, 1.2F);
|
return new SkeleponyRenderer<>(context, WITHER, 1.2F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class BoggedMushroomsFeature extends FeatureRenderer<BoggedEntity, SkeleponyModel<BoggedEntity>> {
|
||||||
|
public static final Identifier MUSHROOMS = MineLittlePony.id("textures/entity/skeleton/bogged_pony_mushrooms.png");
|
||||||
|
|
||||||
|
private final SinglePartEntityModel<BoggedEntity> model = ModelType.BOGGED_MUSHROOMS.createModel();
|
||||||
|
|
||||||
|
public BoggedMushroomsFeature(LivingEntityRenderer<BoggedEntity, SkeleponyModel<BoggedEntity>> renderer) {
|
||||||
|
super(renderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(MatrixStack matrices, VertexConsumerProvider vertices, int light, BoggedEntity entity, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch) {
|
||||||
|
if (!entity.isSheared()) {
|
||||||
|
matrices.push();
|
||||||
|
getContextModel().transform(BodyPart.HEAD, matrices);
|
||||||
|
getContextModel().head.rotate(matrices);
|
||||||
|
VertexConsumer buffer = vertices.getBuffer(model.getLayer(MUSHROOMS));
|
||||||
|
model.render(matrices, buffer, light, OverlayTexture.DEFAULT_UV, Colors.WHITE);
|
||||||
|
matrices.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.minelittlepony.client.render.entity.feature;
|
||||||
|
|
||||||
|
import net.minecraft.client.render.OverlayTexture;
|
||||||
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
|
import net.minecraft.client.render.entity.feature.FeatureRenderer;
|
||||||
|
import net.minecraft.client.render.entity.feature.FeatureRendererContext;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.util.Colors;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
import com.minelittlepony.client.model.ClientPonyModel;
|
||||||
|
import com.minelittlepony.mson.api.ModelKey;
|
||||||
|
|
||||||
|
// separate class in case I need it later
|
||||||
|
public class ClothingFeature<
|
||||||
|
T extends LivingEntity,
|
||||||
|
M extends ClientPonyModel<T>
|
||||||
|
> extends FeatureRenderer<T, M> {
|
||||||
|
|
||||||
|
protected final FeatureRendererContext<T, M> context;
|
||||||
|
private final M model;
|
||||||
|
private final Identifier texture;
|
||||||
|
|
||||||
|
public ClothingFeature(FeatureRendererContext<T, M> context, ModelKey<? super M> model, Identifier texture) {
|
||||||
|
super(context);
|
||||||
|
this.context = context;
|
||||||
|
this.model = model.createModel();
|
||||||
|
this.texture = texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(MatrixStack matrices, VertexConsumerProvider vertices, int light, T entity, float limbDistance, float limbAngle, float tickDelta, float animationProgress, float headYaw, float headPitch) {
|
||||||
|
model.setAngles(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch);
|
||||||
|
VertexConsumer buffer = vertices.getBuffer(model.getLayer(texture));
|
||||||
|
model.render(matrices, buffer, light, OverlayTexture.DEFAULT_UV, Colors.WHITE);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
{
|
||||||
|
"texture": {"u": 50, "w": 64, "h": 32},
|
||||||
|
"data": {
|
||||||
|
"mushrooms": {
|
||||||
|
"pivot": [0, 1, -2],
|
||||||
|
"children": {
|
||||||
|
"red_mushroom_1": {
|
||||||
|
"texture": {"v": 16},
|
||||||
|
"pivot": [3, -8, 3],
|
||||||
|
"rotate": [0, 45, 0],
|
||||||
|
"cubes": [
|
||||||
|
{ "from": [-3, -3, 0], "size": [6, 4, 0]}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"red_mushroom_2": {
|
||||||
|
"texture": {"v": 16},
|
||||||
|
"pivot": [3, -8, 3],
|
||||||
|
"rotate": [0, 134, 0],
|
||||||
|
"cubes": [
|
||||||
|
{ "from": [-3, -3, 0], "size": [6, 4, 0]}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"brown_mushroom_1": {
|
||||||
|
"texture": {"v": 22},
|
||||||
|
"pivot": [-3, -8, -3],
|
||||||
|
"rotate": [0, 45, 0],
|
||||||
|
"cubes": [
|
||||||
|
{ "from": [-3, -3, 0], "size": [6, 4, 0]}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"brown_mushroom_2": {
|
||||||
|
"texture": {"v": 22},
|
||||||
|
"pivot": [-3, -8, -3],
|
||||||
|
"rotate": [0, 134, 0],
|
||||||
|
"cubes": [
|
||||||
|
{ "from": [-3, -3, 0], "size": [6, 4, 0]}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"brown_mushroom_3": {
|
||||||
|
"texture": {"v": 28},
|
||||||
|
"pivot": [-2, -1, 4],
|
||||||
|
"rotate": [-90, 0, 45],
|
||||||
|
"cubes": [
|
||||||
|
{ "from": [-3, -4, 0], "size": [6, 4, 0]}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"brown_mushroom_4": {
|
||||||
|
"texture": {"v": 28},
|
||||||
|
"pivot": [-2, -1, 4],
|
||||||
|
"rotate": [-90, 0, 134],
|
||||||
|
"cubes": [
|
||||||
|
{ "from": [-3, -4, 0], "size": [6, 4, 0]}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.5 KiB |
Loading…
Reference in a new issue