Striders are now dragons

This commit is contained in:
Sollace 2022-06-18 18:08:46 +02:00
parent 690decda00
commit 156d73f39a
18 changed files with 336 additions and 54 deletions

View file

@ -13,19 +13,7 @@ import com.minelittlepony.api.model.gear.IGear;
import com.minelittlepony.api.pony.meta.Race;
import com.minelittlepony.api.pony.meta.Wearable;
import com.minelittlepony.client.model.armour.PonyArmourModel;
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.PonyArmourStandModel;
import com.minelittlepony.client.model.entity.SkeleponyModel;
import com.minelittlepony.client.model.entity.VillagerPonyModel;
import com.minelittlepony.client.model.entity.WitchPonyModel;
import com.minelittlepony.client.model.entity.ZomponyModel;
import com.minelittlepony.client.model.entity.ZomponyVillagerModel;
import com.minelittlepony.client.model.entity.*;
import com.minelittlepony.client.model.entity.race.AlicornModel;
import com.minelittlepony.client.model.entity.race.ChangelingModel;
import com.minelittlepony.client.model.entity.race.EarthPonyModel;
@ -71,7 +59,8 @@ 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<ParaspriteModel<VexEntity>> VEX = register("vex", ParaspriteModel::new);
public static final ModelKey<ParaspriteModel<StriderEntity>> STRIDER = register("strider", ParaspriteModel::new);
public static final ModelKey<SpikeModel<StriderEntity>> STRIDER = register("strider", SpikeModel::new);
public static final ModelKey<SaddleModel<StriderEntity>> STRIDER_SADDLE = register("strider_saddle", SaddleModel::new);
public static final ModelKey<BreezieModel<AllayEntity>> ALLAY = register("allay", BreezieModel::new);
public static final ModelKey<PonyElytra<?>> ELYTRA = register("elytra", PonyElytra::new);

View file

@ -0,0 +1,27 @@
package com.minelittlepony.client.model.entity;
import net.minecraft.client.model.ModelPart;
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.LivingEntity;
import net.minecraft.util.math.MathHelper;
public class SaddleModel<T extends LivingEntity> extends EntityModel<T> {
private ModelPart root;
public SaddleModel(ModelPart tree) {
root = tree;
}
@Override
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch) {
root.pivotY = -MathHelper.cos(move * 1.5f) * 2.0f * swing;
}
@Override
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
root.render(matrices, vertices, light, overlay, red, green, blue, alpha);
}
}

View file

@ -0,0 +1,103 @@
package com.minelittlepony.client.model.entity;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.passive.StriderEntity;
import net.minecraft.util.math.MathHelper;
public class SpikeModel<T extends LivingEntity> extends BipedEntityModel<T> {
private final ModelPart tail;
private final ModelPart tail2;
private final ModelPart tail3;
public SpikeModel(ModelPart tree) {
super(tree);
tail = body.getChild("tail");
tail2 = tail.getChild("tail2");
tail3 = tail2.getChild("tail3");
}
@Override
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch) {
swing *= 2;
move *= 1.5F;
child = false;
head.pivotX = 0;
head.pivotZ = 0;
head.pivotY = 0;
super.setAngles(entity, move, swing, ticks, headYaw, headPitch);
leftArm.pivotY++;
rightArm.pivotY++;
body.pitch += 0.15F;
if ((entity instanceof StriderEntity strider && strider.isSaddled())) {
leftArm.pitch = 3.15F;
leftArm.yaw = 1;
rightArm.pitch = 3.15F;
rightArm.yaw = -1;
head.pivotY += 4;
head.pivotZ = -3;
hat.pivotY += 4;
hat.pivotZ = -3;
leftLeg.pitch += 0.4F;
rightLeg.pitch += 0.4F;
} else {
float flailAmount = 1 + (float)MathHelper.clamp(entity.getVelocity().y * 10, 0, 7);
leftArm.roll -= 0.2F * flailAmount;
rightArm.roll += 0.2F * flailAmount;
leftArm.pivotZ += 2;
leftArm.pitch -= 0.3F;
rightArm.pivotZ += 2;
rightArm.pitch -= 0.3F;
if (entity instanceof StriderEntity strider && strider.isCold()) {
float armMotion = (float)Math.sin(ticks / 10F) / 10F;
leftArm.pitch = -1 - armMotion;
rightArm.pitch = -1 + armMotion;
leftArm.yaw = 0.8F;
rightArm.yaw = -0.8F;
leftArm.pivotZ -= 3;
rightArm.pivotZ -= 3;
}
}
tail.pitch = (float)Math.sin(move) / 3F - 0.5F;
tail2.pitch = -tail.pitch / 2;
tail3.pitch = tail2.pitch / 2;
tail.yaw = (float)Math.sin(ticks / 20F) / 40 + (float)Math.sin(move / 20F) / 4;
tail2.yaw = tail.yaw / 2;
tail3.yaw = tail2.yaw / 2;
for (var part : this.getHeadParts()) {
part.pivotY += 7;
}
for (var part : this.getBodyParts()) {
part.pivotY += 7;
}
}
}

View file

@ -15,7 +15,7 @@ import java.util.UUID;
/**
* All currently loaded background ponies.
*/
class BackgroundPonyList implements VariatedTextureSupplier.VariatedTexture {
class BackgroundPonyList {
/**
* All currently loaded background ponies.
*/
@ -25,6 +25,7 @@ class BackgroundPonyList implements VariatedTextureSupplier.VariatedTexture {
public BackgroundPonyList(Identifier id) {
this.id = id;
reloadAll(MinecraftClient.getInstance().getResourceManager());
}
public Identifier getId(UUID uuid) {
@ -47,9 +48,4 @@ class BackgroundPonyList implements VariatedTextureSupplier.VariatedTexture {
return MinecraftClient.getInstance().player != null
&& MinecraftClient.getInstance().player.getUuid().equals(uuid);
}
@Override
public Identifier get(UUID uuid) {
return getId(uuid);
}
}

View file

@ -29,6 +29,7 @@ import java.util.concurrent.TimeUnit;
public class PonyManager implements IPonyManager, SimpleSynchronousResourceReloadListener {
private static final Identifier ID = new Identifier("minelittlepony", "background_ponies");
public static final Identifier BACKGROUND_PONIES = new Identifier("minelittlepony", "textures/entity/pony");
private final PonyConfig config;
@ -100,7 +101,7 @@ public class PonyManager implements IPonyManager, SimpleSynchronousResourceReloa
@Override
public IPony getBackgroundPony(UUID uuid) {
return ((Pony)getPony(MineLittlePony.getInstance().getVariatedTextures().get(VariatedTextureSupplier.BACKGROUND_PONIES).get(uuid))).defaulted();
return ((Pony)getPony(MineLittlePony.getInstance().getVariatedTextures().get(BACKGROUND_PONIES, uuid))).defaulted();
}
@Override

View file

@ -12,21 +12,11 @@ import java.util.UUID;
public class VariatedTextureSupplier implements SimpleSynchronousResourceReloadListener {
private static final Identifier ID = new Identifier("minelittlepony", "variated_textures");
public static final Identifier BACKGROUND_PONIES = new Identifier("minelittlepony", "textures/entity/pony");
public static final Identifier BREEZIE_PONIES = new Identifier("minelittlepony", "textures/entity/allay/pony");
public static final Identifier PARASPRITE_PONIES = new Identifier("minelittlepony", "textures/entity/illager/vex_pony");
private final Map<Identifier, BackgroundPonyList> entries = new HashMap<>();
public VariatedTextureSupplier() {
get(BACKGROUND_PONIES);
get(BREEZIE_PONIES);
get(PARASPRITE_PONIES);
}
@Override
public void reload(ResourceManager manager) {
entries.forEach((key, value) -> value.reloadAll(manager));
entries.clear();
}
@Override
@ -34,15 +24,15 @@ public class VariatedTextureSupplier implements SimpleSynchronousResourceReloadL
return ID;
}
public VariatedTexture get(Identifier id) {
private BackgroundPonyList get(Identifier id) {
return entries.computeIfAbsent(id, BackgroundPonyList::new);
}
public interface VariatedTexture {
Identifier get(UUID uuid);
public Identifier get(Identifier poolId, UUID seed) {
return get(poolId).getId(seed);
}
default Identifier get(Entity entity) {
return get(entity.getUuid());
}
public Identifier get(Identifier poolId, Entity entity) {
return get(poolId, entity.getUuid());
}
}

View file

@ -10,12 +10,13 @@ import net.minecraft.util.math.BlockPos;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.entity.BreezieModel;
import com.minelittlepony.client.pony.VariatedTextureSupplier;
/**
* AKA a breezie :D
*/
public class AllayRenderer extends MobEntityRenderer<AllayEntity, BreezieModel<AllayEntity>> {
public static final Identifier BREEZIE_PONIES = new Identifier("minelittlepony", "textures/entity/allay/pony");
public AllayRenderer(EntityRendererFactory.Context context) {
super(context, ModelType.ALLAY.createModel(), 0.4f);
addFeature(new HeldItemFeatureRenderer<AllayEntity, BreezieModel<AllayEntity>>(this, context.getHeldItemRenderer()));
@ -23,7 +24,7 @@ public class AllayRenderer extends MobEntityRenderer<AllayEntity, BreezieModel<A
@Override
public Identifier getTexture(AllayEntity allayEntity) {
return MineLittlePony.getInstance().getVariatedTextures().get(VariatedTextureSupplier.BREEZIE_PONIES).get(allayEntity);
return MineLittlePony.getInstance().getVariatedTextures().get(BREEZIE_PONIES, allayEntity);
}
@Override

View file

@ -3,27 +3,28 @@ package com.minelittlepony.client.render.entity;
import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.client.render.entity.feature.SaddleFeatureRenderer;
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.passive.StriderEntity;
import net.minecraft.util.Identifier;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.entity.ParaspriteModel;
public class StriderRenderer extends MobEntityRenderer<StriderEntity, ParaspriteModel<StriderEntity>> {
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");
public class StriderRenderer extends MobEntityRenderer<StriderEntity, EntityModel<StriderEntity>> {
public static final Identifier DRAGON_PONIES = new Identifier("minelittlepony", "textures/entity/strider/pony");
public static final Identifier COLD_DRAGON_PONIES = new Identifier("minelittlepony", "textures/entity/strider/cold_pony");
private static final Identifier SADDLE = new Identifier("minelittlepony", "textures/entity/strider/strider_saddle_pony.png");
public StriderRenderer(EntityRendererFactory.Context context) {
super(context, ModelType.STRIDER.createModel(), 0.5F);
addFeature(new SaddleFeatureRenderer<>(this, ModelType.STRIDER.createModel(), SADDLE));
addFeature(new SaddleFeatureRenderer<>(this, ModelType.STRIDER_SADDLE.createModel(), SADDLE));
}
@Override
public Identifier getTexture(StriderEntity entity) {
return entity.isCold() ? CONFUSED : NORMAL;
return MineLittlePony.getInstance().getVariatedTextures().get(entity.isCold() ? COLD_DRAGON_PONIES : DRAGON_PONIES, entity);
}
@Override

View file

@ -8,9 +8,10 @@ import net.minecraft.util.Identifier;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.entity.ParaspriteModel;
import com.minelittlepony.client.pony.VariatedTextureSupplier;
public class VexRenderer extends MobEntityRenderer<VexEntity, ParaspriteModel<VexEntity>> {
public static final Identifier PARASPRITE_PONIES = new Identifier("minelittlepony", "textures/entity/illager/vex_pony");
public VexRenderer(EntityRendererFactory.Context context) {
super(context, ModelType.VEX.createModel(), 0.3F);
}
@ -22,7 +23,7 @@ public class VexRenderer extends MobEntityRenderer<VexEntity, ParaspriteModel<Ve
@Override
public Identifier getTexture(VexEntity entity) {
return MineLittlePony.getInstance().getVariatedTextures().get(VariatedTextureSupplier.PARASPRITE_PONIES).get(entity);
return MineLittlePony.getInstance().getVariatedTextures().get(PARASPRITE_PONIES, entity);
}
}

View file

@ -1,12 +1,167 @@
{
"parent": "minelittlepony:vex",
"parent": "mson:steve",
"texture": {
"w": 64, "h": 64
},
"data": {
"saddle": {
"pivot": [-4, -4, -4],
"texture": {"u": 0, "v": 16},
"visible": true,
"head": {
"cubes": [
{"from": [-4, -0.1, -4], "size": [16, 16, 16] }
{ "from": [-3, -7, -3], "size": [ 6, 6, 6] },
{ "from": [-2, -3, -4.5], "size": [ 4, 2, 2], "texture": { "v": 12 } }
],
"children": {
"left_ear": {
"texture": { "u": 18 },
"pivot": [2.5, -4, 0],
"rotate": [45, 0, 30],
"type": "mson:planar",
"up": [0, 0, 0, 2, 2, 8, 16 ]
},
"left_ear_2": {
"texture": { "u": 22 },
"pivot": [2.5, -4, 0],
"rotate": [35, -10, 50],
"type": "mson:planar",
"up": [0, 0, 0, 2, 2, 8, 16 ]
},
"right_ear": {
"texture": { "u": 18, "v": 2 },
"pivot": [-2.5, -4, 0],
"rotate": [45, 0, -30],
"type": "mson:planar",
"up": [-2, 0, 0, 2, 2, 8, 16 ]
},
"right_ear_2": {
"texture": { "u": 22, "v": 2 },
"pivot": [-2.5, -4, 0],
"rotate": [35, -10, -10],
"type": "mson:planar",
"up": [-2, 0, 0, 2, 2, 8, 16 ]
},
"top_spines": {
"texture": { "u": 8, "v": 12 },
"pivot": [-1, -12, 0],
"rotate": [15, 0, 0],
"cubes": [
{ "from": [0, 1, 0], "size": [ 2, 5, 4], "dilate": -0.1 },
{ "from": [0, 0, -4], "size": [ 2, 5, 4] }
]
},
"back_spines": {
"texture": { "u": 8, "v": 12 },
"pivot": [-1, -6, 8],
"rotate": [-65, 0, 0],
"cubes": [
{ "from": [0, 0, -4], "size": [ 2, 5, 4], "dilate": -0.2 },
{ "from": [0, 2, -1], "size": [ 2, 5, 4], "dilate": -0.3 }
]
}
}
},
"hat": {
"texture": { "u": 24, "v": 0 },
"cubes": [
{ "from": [-3, -7, -3], "size": [ 6, 6, 6], "dilate": [0.5, 0.5, 0.5] }
]
},
"body": {
"cubes": [
{ "from": [-2, -1, -2], "size": [ 4, 2, 3], "texture": { "v": 21 } },
{ "from": [-3, 1, -2.5], "size": [ 6, 4, 5], "texture": { "v": 26 } },
{ "from": [-4, 5, -3], "size": [ 8, 8, 8], "texture": { "v": 35 } }
],
"children": {
"spines": {
"texture": { "u": 8, "v": 12 },
"pivot": [-1, 0, 0],
"rotate": [45, 0, 0],
"cubes": [
{ "from": [0, 0, 0], "size": [ 2, 5, 4], "dilate": -0.4 },
{ "from": [0, 2, -3], "size": [ 2, 5, 4], "dilate": -0.4 },
{ "from": [0, 4, -4], "size": [ 2, 5, 4], "dilate": -0.4 }
]
},
"tail": {
"pivot": [-4, 7, 5],
"rotate": [-25, 0, 0],
"texture": { "v": 51 },
"cubes": [
{ "from": [2, 0, 0], "size": [ 4, 4, 5] }
],
"children": {
"tail2": {
"pivot": [0.5, 0, 3],
"rotate": [65, 0, 0],
"texture": { "u": 11, "v": 53 },
"cubes": [
{ "from": [2, 0, -2], "size": [ 3, 3, 7] }
],
"children": {
"spines": {
"texture": { "u": 8, "v": 12 },
"pivot": [2.5, 3, 5],
"rotate": [230, 0, 0],
"cubes": [
{ "from": [0, 0, -4], "size": [ 2, 5, 4], "dilate": -0.6 },
{ "from": [0, 2, -1], "size": [ 2, 5, 4], "dilate": -0.8 }
]
},
"tail3": {
"pivot": [2.5, 0, 5],
"rotate": [-15, 0, 0],
"texture": { "u": 0, "v": 60 },
"cubes": [
{ "from": [0, 0, 0], "size": [ 2, 2, 2] }
],
"children": {
"spines": {
"pivot": [-0.5, 0, 3],
"rotate": [-10, 45, 0],
"cubes": [
{ "from": [0, 0, 0], "size": [ 2, 1, 2] }
]
}
}
}
}
}
}
}
}
},
"right_arm": {
"pivot": [-5, 3, 0],
"texture": { "u": 24 },
"cubes": [
{ "from": [-1, -2, -2], "size": [ 3, 3, 3], "texture": { "v": 12 }, "dilate": -0.25 },
{ "from": [-0.5, 0.75, -1.5], "size": [ 2, 6, 2], "texture": { "v": 18 } }
]
},
"left_arm": {
"pivot": [5, 3, 0],
"texture": { "u": 40, "v": 16 },
"mirror": [true, false, false],
"texture": { "u": 36 },
"cubes": [
{ "from": [-2, -2, -2], "size": [ 3, 3, 3], "texture": { "v": 12 }, "dilate": -0.25 },
{ "from": [-1.5, 0.75, -1.5], "size": [ 2, 6, 2], "texture": { "v": 18 } }
]
},
"right_leg": {
"pivot": [-1.9, 3, 0],
"texture": { "u": 24 },
"cubes": [
{ "from": [-2, 0, -2], "size": [ 3, 4, 3], "texture": { "v": 28 } },
{ "from": [-2, 4, -3], "size": [ 3, 1, 4], "texture": { "v": 35 } }
]
},
"left_leg": {
"pivot": [1.9, 3, 0],
"texture": { "u": 38 },
"mirror": [true, false, false],
"cubes": [
{ "from": [-1, 0, -2], "size": [ 3, 4, 3 ], "texture": { "v": 28 } },
{ "from": [-1, 4, -3], "size": [ 3, 1, 4], "texture": { "v": 35 } }
]
}
}

View file

@ -0,0 +1,18 @@
{
"texture": {
"w": 64, "h": 64
},
"data": {
"saddle": {
"cubes": [
{ "from": [-8, -7, -8], "size": [ 16, 13, 16], "dilate": 0.5 }
]
},
"pillow": {
"texture": { "v": 29 },
"cubes": [
{ "from": [-8, -7, -8], "size": [ 16, 13, 16] }
]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB