mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Added parasprites
This commit is contained in:
parent
655923a650
commit
e985dc8950
8 changed files with 157 additions and 0 deletions
|
@ -12,6 +12,7 @@ import com.minelittlepony.client.model.entity.BreezieModel;
|
|||
import com.minelittlepony.client.model.entity.EnderStallionModel;
|
||||
import com.minelittlepony.client.model.entity.GuardianPonyModel;
|
||||
import com.minelittlepony.client.model.entity.IllagerPonyModel;
|
||||
import com.minelittlepony.client.model.entity.ParaspriteModel;
|
||||
import com.minelittlepony.client.model.entity.PiglinPonyModel;
|
||||
import com.minelittlepony.client.model.entity.PillagerPonyModel;
|
||||
import com.minelittlepony.client.model.entity.SkeleponyModel;
|
||||
|
@ -63,6 +64,7 @@ public final class ModelType {
|
|||
public static final ModelKey<GuardianPonyModel> GUARDIAN = register("guardian", GuardianPonyModel::new);
|
||||
public static final ModelKey<EnderStallionModel> ENDERMAN = register("enderman", EnderStallionModel::new);
|
||||
public static final ModelKey<BreezieModel<VexEntity>> BREEZIE = register("breezie", BreezieModel::new);
|
||||
public static final ModelKey<ParaspriteModel> PARASPRITE = register("parasprite", ParaspriteModel::new);
|
||||
|
||||
public static final ModelKey<PonyElytra<?>> ELYTRA = register("elytra", PonyElytra::new);
|
||||
public static final ModelKey<PonySkullModel> SKULL = register("skull", PonySkullModel::new);
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package com.minelittlepony.client.model.entity;
|
||||
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.passive.StriderEntity;
|
||||
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
import com.minelittlepony.mson.api.MsonModel;
|
||||
|
||||
public class ParaspriteModel extends EntityModel<StriderEntity> implements MsonModel {
|
||||
|
||||
private ModelPart body;
|
||||
private ModelPart leftWing;
|
||||
private ModelPart rightWing;
|
||||
|
||||
private ModelPart saddle;
|
||||
|
||||
public ParaspriteModel() {
|
||||
super(RenderLayer::getEntityTranslucent);
|
||||
child = false;
|
||||
textureHeight = 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(ModelContext context) {
|
||||
body = context.findByName("body");
|
||||
saddle = context.findByName("saddle");
|
||||
leftWing = context.findByName("leftWing");
|
||||
rightWing = context.findByName("rightWing");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
|
||||
body.render(matrices, vertices, light, overlay, red, green, blue, alpha);
|
||||
saddle.render(matrices, vertices, light, overlay, red, green, blue, alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAngles(StriderEntity entity, float move, float swing, float ticks, float headYaw, float headPitch) {
|
||||
body.yaw = headYaw * 0.017453292F;
|
||||
body.pitch = headPitch * 0.017453292F;
|
||||
|
||||
saddle.copyPositionAndRotation(body);
|
||||
|
||||
float sin = (float)Math.sin(ticks) / 2;
|
||||
float cos = (float)Math.cos(ticks) / 3;
|
||||
|
||||
leftWing.roll = 0.5F + cos;
|
||||
leftWing.yaw = 0.5F - sin;
|
||||
|
||||
rightWing.visible = true;
|
||||
rightWing.roll = -0.5F - cos;
|
||||
rightWing.yaw = -0.5F + sin;
|
||||
}
|
||||
}
|
|
@ -55,6 +55,9 @@ public final class MobRenderers {
|
|||
public static final MobRenderers INANIMATE = register("inanimates", (state, pony) -> {
|
||||
pony.switchRenderer(state, EntityType.ARMOR_STAND, PonyStandRenderer::new);
|
||||
});
|
||||
public static final MobRenderers STRIDER = register("strider", (state, pony) -> {
|
||||
pony.switchRenderer(state, EntityType.STRIDER, ParaspriteRenderer::new);
|
||||
});
|
||||
|
||||
private final BiConsumer<Boolean, PonyRenderDispatcher> changer;
|
||||
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package com.minelittlepony.client.render.entity;
|
||||
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.render.entity.MobEntityRenderer;
|
||||
import net.minecraft.client.render.entity.feature.PigSaddleFeatureRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.passive.StriderEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.client.model.ModelType;
|
||||
import com.minelittlepony.client.model.entity.ParaspriteModel;
|
||||
|
||||
public class ParaspriteRenderer extends MobEntityRenderer<StriderEntity, ParaspriteModel> {
|
||||
|
||||
private static final Identifier NORMAL = new Identifier("minelittlepony", "textures/entity/strider/strider_pony.png");
|
||||
private static final Identifier CONFUSED = new Identifier("minelittlepony", "textures/entity/strider/strider_confused_pony.png");
|
||||
|
||||
private static final Identifier SADDLE = new Identifier("minelittlepony", "textures/entity/strider/strider_saddle_pony.png");
|
||||
|
||||
public ParaspriteRenderer(EntityRenderDispatcher dispatcher) {
|
||||
super(dispatcher, ModelType.PARASPRITE.createModel(), 0.5F);
|
||||
addFeature(new PigSaddleFeatureRenderer<>(this, ModelType.PARASPRITE.createModel(), SADDLE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getTexture(StriderEntity entity) {
|
||||
return entity.method_26348() ? CONFUSED : NORMAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void scale(StriderEntity entity, MatrixStack stack, float ticks) {
|
||||
float scale = 0.9375F;
|
||||
if (entity.isBaby()) {
|
||||
scale *= 0.5F;
|
||||
shadowRadius = 0.25F;
|
||||
} else {
|
||||
shadowRadius = 0.5F;
|
||||
}
|
||||
|
||||
stack.scale(scale, scale, scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isShaking(StriderEntity entity) {
|
||||
return entity.method_26348();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"texture": {
|
||||
"w": 64, "h": 64
|
||||
},
|
||||
"body": {
|
||||
"center": [-4, -4, -4],
|
||||
"cubes": [
|
||||
{"from": [0, 0, 0], "size": [8, 8, 8] }
|
||||
],
|
||||
"children": [
|
||||
{
|
||||
"name": "leftWing",
|
||||
"center": [4, 2, 8],
|
||||
"texture": {"u": 32, "v": 0},
|
||||
"cubes": [
|
||||
{
|
||||
"type": "mson:plane",
|
||||
"face": "east",
|
||||
"position": [0, -16, 0],
|
||||
"size": [ 16, 16 ]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rightWing",
|
||||
"center": [4, 2, 8],
|
||||
"texture": {"u": 48, "v": 0},
|
||||
"cubes": [
|
||||
{
|
||||
"type": "mson:plane",
|
||||
"face": "west",
|
||||
"position": [0, -16, 0],
|
||||
"size": [ 16, 16 ]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"saddle": {
|
||||
"center": [-4, -4, -4],
|
||||
"texture": {"u": 0, "v": 16},
|
||||
"visible": true,
|
||||
"cubes": [
|
||||
{"from": [-4, -0.1, -4], "size": [16, 16, 16] }
|
||||
]
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in a new issue