diff --git a/src/main/java/com/minelittlepony/client/model/ModelType.java b/src/main/java/com/minelittlepony/client/model/ModelType.java index a90b7068..bde9ae29 100644 --- a/src/main/java/com/minelittlepony/client/model/ModelType.java +++ b/src/main/java/com/minelittlepony/client/model/ModelType.java @@ -10,6 +10,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.PiglinPonyModel; import com.minelittlepony.client.model.entity.PillagerPonyModel; import com.minelittlepony.client.model.entity.SkeleponyModel; import com.minelittlepony.client.model.entity.VillagerPonyModel; @@ -53,6 +54,7 @@ public final class ModelType { public static final ModelKey> VILLAGER = register("villager", VillagerPonyModel::new); public static final ModelKey WITCH = register("witch", WitchPonyModel::new); public static final ModelKey> ZOMBIE = register("zombie", ZomponyModel::new); + public static final ModelKey PIGLIN = register("piglin", PiglinPonyModel::new); public static final ModelKey ZOMBIE_VILLAGER = register("zombie_villager", ZomponyVillagerModel::new); public static final ModelKey> SKELETON = register("skeleton", SkeleponyModel::new); public static final ModelKey> SKELETON_CLOTHES = register("skeleton_clothes", SkeleponyModel::new); diff --git a/src/main/java/com/minelittlepony/client/model/entity/PiglinPonyModel.java b/src/main/java/com/minelittlepony/client/model/entity/PiglinPonyModel.java new file mode 100644 index 00000000..909b9121 --- /dev/null +++ b/src/main/java/com/minelittlepony/client/model/entity/PiglinPonyModel.java @@ -0,0 +1,41 @@ +package com.minelittlepony.client.model.entity; + +import net.minecraft.entity.mob.HostileEntity; +import net.minecraft.entity.mob.PiglinEntity; + +import com.minelittlepony.client.model.entity.race.AlicornModel; + +public class PiglinPonyModel extends AlicornModel { + + private boolean isPegasus; + + public PiglinPonyModel() { + super(false); + } + + @Override + public void animateModel(HostileEntity entity, float move, float swing, float ticks) { + isPegasus = entity.getUuid().getLeastSignificantBits() % 30 == 0; + + if (entity instanceof PiglinEntity) { + PiglinEntity piglinEntity = (PiglinEntity)entity; + PiglinEntity.Activity activity = piglinEntity.getActivity(); + + leftArmPose = ArmPose.EMPTY; + rightArmPose = ArmPose.EMPTY; + + if (activity == PiglinEntity.Activity.CROSSBOW_HOLD) { + rightArmPose = ArmPose.CROSSBOW_HOLD; + } else if (activity == PiglinEntity.Activity.CROSSBOW_CHARGE) { + rightArmPose = ArmPose.BOW_AND_ARROW; + } else if (activity == PiglinEntity.Activity.ADMIRING_ITEM) { + leftArmPose = ArmPose.ITEM; + } + } + } + + @Override + public boolean canFly() { + return isPegasus; + } +} diff --git a/src/main/java/com/minelittlepony/client/render/MobRenderers.java b/src/main/java/com/minelittlepony/client/render/MobRenderers.java index c9d3411c..8aac7192 100644 --- a/src/main/java/com/minelittlepony/client/render/MobRenderers.java +++ b/src/main/java/com/minelittlepony/client/render/MobRenderers.java @@ -36,8 +36,9 @@ public final class MobRenderers { pony.switchRenderer(state, EntityType.GIANT, ZomponyRenderer.Giant::new); pony.switchRenderer(state, EntityType.DROWNED, ZomponyRenderer.Drowned::new); }); - public static final MobRenderers ZOMBIE_PIGMAN = register("pigzombies", (state, pony) -> { - pony.switchRenderer(state, EntityType.ZOMBIFIED_PIGLIN, ZomponyRenderer.Piglin::new); + public static final MobRenderers PIGLIN = register("pigzombies", (state, pony) -> { + pony.switchRenderer(state, EntityType.PIGLIN, PonyPiglinRenderer::new); + pony.switchRenderer(state, EntityType.ZOMBIFIED_PIGLIN, PonyPiglinRenderer::new); }); public static final MobRenderers SKELETON = register("skeletons", (state, pony) -> { pony.switchRenderer(state, EntityType.SKELETON, SkeleponyRenderer::new); diff --git a/src/main/java/com/minelittlepony/client/render/entity/PonyPiglinRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/PonyPiglinRenderer.java new file mode 100644 index 00000000..502afd09 --- /dev/null +++ b/src/main/java/com/minelittlepony/client/render/entity/PonyPiglinRenderer.java @@ -0,0 +1,28 @@ +package com.minelittlepony.client.render.entity; + +import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.entity.mob.HostileEntity; +import net.minecraft.entity.mob.PiglinEntity; +import net.minecraft.util.Identifier; + +import com.minelittlepony.client.model.ModelType; +import com.minelittlepony.client.model.entity.PiglinPonyModel; + +public class PonyPiglinRenderer extends PonyRenderer.Caster { + public static final Identifier NORMAL = new Identifier("minelittlepony", "textures/entity/piglin/piglin_pony.png"); + public static final Identifier ZOMBIFIED = new Identifier("minelittlepony", "textures/entity/piglin/zombified_piglin_pony.png"); + + public PonyPiglinRenderer(EntityRenderDispatcher manager) { + super(manager, ModelType.PIGLIN); + } + + @Override + public Identifier findTexture(HostileEntity entity) { + return entity instanceof PiglinEntity ? NORMAL : new Identifier("minelittlepony", "textures/entity/piglin/zombified_piglin_pony.png"); + } + + @Override + protected boolean method_25450(HostileEntity entity) { + return entity instanceof PiglinEntity && ((PiglinEntity)entity).canConvert(); + } +} diff --git a/src/main/java/com/minelittlepony/client/render/entity/ZomponyRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/ZomponyRenderer.java index 8156803a..9c94ab5f 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/ZomponyRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/ZomponyRenderer.java @@ -6,7 +6,6 @@ import net.minecraft.entity.mob.DrownedEntity; import net.minecraft.entity.mob.GiantEntity; import net.minecraft.entity.mob.HuskEntity; import net.minecraft.entity.mob.ZombieEntity; -import net.minecraft.entity.mob.ZombifiedPiglinEntity; import net.minecraft.util.Identifier; import com.minelittlepony.client.model.ModelType; @@ -16,7 +15,6 @@ public class ZomponyRenderer extends PonyRenderer.C public static final Identifier ZOMBIE = new Identifier("minelittlepony", "textures/entity/zombie/zombie_pony.png"); public static final Identifier HUSK = new Identifier("minelittlepony", "textures/entity/zombie/husk_pony.png"); - public static final Identifier PIGMAN = new Identifier("minelittlepony", "textures/entity/zombie/zombie_pigman_pony.png"); public static final Identifier DROWNED = new Identifier("minelittlepony", "textures/entity/zombie/drowned_pony.png"); public ZomponyRenderer(EntityRenderDispatcher manager) { @@ -40,18 +38,6 @@ public class ZomponyRenderer extends PonyRenderer.C } } - public static class Piglin extends ZomponyRenderer { - - public Piglin(EntityRenderDispatcher manager) { - super(manager); - } - - @Override - public Identifier findTexture(ZombifiedPiglinEntity entity) { - return PIGMAN; - } - } - public static class Husk extends ZomponyRenderer { public Husk(EntityRenderDispatcher manager) { diff --git a/src/main/resources/assets/minelittlepony/models/piglin.json b/src/main/resources/assets/minelittlepony/models/piglin.json new file mode 100644 index 00000000..07ebb0b0 --- /dev/null +++ b/src/main/resources/assets/minelittlepony/models/piglin.json @@ -0,0 +1,3 @@ +{ + "parent": "minelittlepony:zombie" +} diff --git a/src/main/resources/assets/minelittlepony/textures/entity/zombie/zombie_pigman_pony.png b/src/main/resources/assets/minelittlepony/textures/entity/piglin/piglin_pony.png similarity index 100% rename from src/main/resources/assets/minelittlepony/textures/entity/zombie/zombie_pigman_pony.png rename to src/main/resources/assets/minelittlepony/textures/entity/piglin/piglin_pony.png diff --git a/src/main/resources/assets/minelittlepony/textures/entity/piglin/zombified_piglin_pony.png b/src/main/resources/assets/minelittlepony/textures/entity/piglin/zombified_piglin_pony.png new file mode 100644 index 00000000..9a7fa9ab Binary files /dev/null and b/src/main/resources/assets/minelittlepony/textures/entity/piglin/zombified_piglin_pony.png differ