Merge pull request #48 from Sollace/zebra_models

Further rework models and added a few new ones
This commit is contained in:
Matthew Messinger 2018-06-02 11:34:05 -04:00 committed by GitHub
commit 0a11cfc4ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 731 additions and 269 deletions

View file

@ -23,6 +23,7 @@ public class PonyConfig implements Exposable {
@Expose public boolean pigzombies = true; @Expose public boolean pigzombies = true;
@Expose public boolean skeletons = true; @Expose public boolean skeletons = true;
@Expose public boolean illagers = true; @Expose public boolean illagers = true;
@Expose public boolean guardians = true;
/** /**
* Gets the current PonyLevel. That is the level of ponies you would like to see. * Gets the current PonyLevel. That is the level of ponies you would like to see.

View file

@ -9,6 +9,7 @@ import com.minelittlepony.hdskins.gui.RenderPonyModel;
import com.minelittlepony.model.player.PlayerModels; import com.minelittlepony.model.player.PlayerModels;
import com.minelittlepony.render.LevitatingItemRenderer; import com.minelittlepony.render.LevitatingItemRenderer;
import com.minelittlepony.render.player.RenderPonyPlayer; import com.minelittlepony.render.player.RenderPonyPlayer;
import com.minelittlepony.render.ponies.RenderPonyGuardian;
import com.minelittlepony.render.ponies.RenderPonyIllager; import com.minelittlepony.render.ponies.RenderPonyIllager;
import com.minelittlepony.render.ponies.RenderPonyPigman; import com.minelittlepony.render.ponies.RenderPonyPigman;
import com.minelittlepony.render.ponies.RenderPonySkeleton; import com.minelittlepony.render.ponies.RenderPonySkeleton;
@ -22,8 +23,10 @@ import com.mumfrey.liteloader.util.ModUtilities;
import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityElderGuardian;
import net.minecraft.entity.monster.EntityEvoker; import net.minecraft.entity.monster.EntityEvoker;
import net.minecraft.entity.monster.EntityGiantZombie; import net.minecraft.entity.monster.EntityGiantZombie;
import net.minecraft.entity.monster.EntityGuardian;
import net.minecraft.entity.monster.EntityHusk; import net.minecraft.entity.monster.EntityHusk;
import net.minecraft.entity.monster.EntityIllusionIllager; import net.minecraft.entity.monster.EntityIllusionIllager;
import net.minecraft.entity.monster.EntityPigZombie; import net.minecraft.entity.monster.EntityPigZombie;
@ -55,9 +58,11 @@ public class PonyRenderManager {
// Preview on the select skin gui // Preview on the select skin gui
ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(manager)); ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(manager));
registerPlayerSkin(manager, PlayerModels.EARTH); for (PlayerModels i : PlayerModels.values()) {
registerPlayerSkin(manager, PlayerModels.PEGASUS); if (i != PlayerModels.HUMAN) {
registerPlayerSkin(manager, PlayerModels.ALICORN); registerPlayerSkin(manager, i);
}
}
} }
private void registerPlayerSkin(RenderManager manager, PlayerModels playerModel) { private void registerPlayerSkin(RenderManager manager, PlayerModels playerModel) {
@ -128,6 +133,15 @@ public class PonyRenderManager {
restoreRenderer(EntityVindicator.class); restoreRenderer(EntityVindicator.class);
restoreRenderer(EntityIllusionIllager.class); restoreRenderer(EntityIllusionIllager.class);
} }
if (config.guardians) {
pushNewRenderer(manager, EntityGuardian.class, new RenderPonyGuardian(manager));
pushNewRenderer(manager, EntityElderGuardian.class, new RenderPonyGuardian.Elder(manager));
MineLittlePony.logger.info("Guardians are now ponies.");
} else {
restoreRenderer(EntityGuardian.class);
restoreRenderer(EntityElderGuardian.class);
}
} }
/** /**
@ -137,11 +151,12 @@ public class PonyRenderManager {
* @param renderer The replacement value * @param renderer The replacement value
* @param <T> The entity type * @param <T> The entity type
*/ */
public <T extends Entity> void pushNewRenderer(RenderManager manager, Class<T> type, Render<T> renderer) { @SuppressWarnings("unchecked")
public <T extends Entity, V extends T> void pushNewRenderer(RenderManager manager, Class<V> type, Render<T> renderer) {
if (!renderMap.containsKey(type)) { if (!renderMap.containsKey(type)) {
renderMap.put(type, manager.getEntityClassRenderObject(type)); renderMap.put(type, manager.getEntityClassRenderObject(type));
} }
ModUtilities.addRenderer(type, renderer); ModUtilities.addRenderer((Class<T>)type, renderer);
} }
/** /**

View file

@ -11,6 +11,8 @@ import java.io.IOException;
/** /**
* In-Game options menu. * In-Game options menu.
*
* TODO: What a mess
*/ */
public class PonySettingPanel extends GuiScreen { public class PonySettingPanel extends GuiScreen {
@ -34,6 +36,7 @@ public class PonySettingPanel extends GuiScreen {
private static final String ZOMBIE_PIGMEN = MOB_PREFIX + "zombiepigmen"; private static final String ZOMBIE_PIGMEN = MOB_PREFIX + "zombiepigmen";
private static final String SKELETONS = MOB_PREFIX + "skeletons"; private static final String SKELETONS = MOB_PREFIX + "skeletons";
private static final String ILLAGERS = MOB_PREFIX + "illagers"; private static final String ILLAGERS = MOB_PREFIX + "illagers";
private static final String GUARDIANS = MOB_PREFIX + "guardians";
private static final int PONY_ID = 0; private static final int PONY_ID = 0;
private static final int HUMAN_ID = 1; private static final int HUMAN_ID = 1;
@ -48,6 +51,7 @@ public class PonySettingPanel extends GuiScreen {
private static final int ZOMBIE_PIGMEN_ID = 9; private static final int ZOMBIE_PIGMEN_ID = 9;
private static final int SKELETONS_ID = 10; private static final int SKELETONS_ID = 10;
private static final int ILLAGER_ID = 11; private static final int ILLAGER_ID = 11;
private static final int GUARDIAN_ID = 12;
private PonyConfig config; private PonyConfig config;
@ -63,15 +67,15 @@ public class PonySettingPanel extends GuiScreen {
@Override @Override
public void initGui() { public void initGui() {
final int LEFT = width / 10 + 16; final int LEFT = width / 10 + 16;
GuiCheckbox pony, human, both, hd, sizes, snuzzles, showscale, villager, zombie, pigmen, skeleton, illager; GuiCheckbox pony, human, both, hd, sizes, snuzzles, showscale, villager, zombie, pigmen, skeleton, illager, guardian;
int row = 32; int row = 32;
buttonList.add(pony = ponies = new GuiCheckbox(PONY_ID, LEFT, row += 15, I18n.format(PONY))); buttonList.add(pony = ponies = new GuiCheckbox(PONY_ID, LEFT, row += 15, I18n.format(PONY)));
buttonList.add(human = humans = new GuiCheckbox(HUMAN_ID, LEFT, row += 15, I18n.format(HUMAN))); buttonList.add(human = humans = new GuiCheckbox(HUMAN_ID, LEFT, row += 15, I18n.format(HUMAN)));
buttonList.add(both = this.both = new GuiCheckbox(BOTH_ID, LEFT, row += 15, I18n.format(BOTH))); buttonList.add(both = this.both = new GuiCheckbox(BOTH_ID, LEFT, row += 15, I18n.format(BOTH)));
row += 15; row += 15;
buttonList.add(hd = new GuiCheckbox(HD_ID, LEFT, row += 15, I18n.format(HD))); buttonList.add(hd = new GuiCheckbox(HD_ID, LEFT, row += 15, I18n.format(HD)));
buttonList.add(sizes = new GuiCheckbox(SIZES_ID, LEFT, row += 15, I18n.format(SIZES)));
buttonList.add(snuzzles = new GuiCheckbox(SNUZZLES_ID, LEFT, row += 15, I18n.format(SNUZZLES))); buttonList.add(snuzzles = new GuiCheckbox(SNUZZLES_ID, LEFT, row += 15, I18n.format(SNUZZLES)));
buttonList.add(sizes = new GuiCheckbox(SIZES_ID, LEFT, row += 15, I18n.format(SIZES)));
buttonList.add(showscale = new GuiCheckbox(SHOW_SCALE_ID, LEFT, row += 15, I18n.format(SHOW_SCALE))); buttonList.add(showscale = new GuiCheckbox(SHOW_SCALE_ID, LEFT, row += 15, I18n.format(SHOW_SCALE)));
final int RIGHT = width - width / 3; final int RIGHT = width - width / 3;
@ -81,6 +85,7 @@ public class PonySettingPanel extends GuiScreen {
buttonList.add(pigmen = new GuiCheckbox(ZOMBIE_PIGMEN_ID, RIGHT, row += 15, I18n.format(ZOMBIE_PIGMEN))); buttonList.add(pigmen = new GuiCheckbox(ZOMBIE_PIGMEN_ID, RIGHT, row += 15, I18n.format(ZOMBIE_PIGMEN)));
buttonList.add(skeleton = new GuiCheckbox(SKELETONS_ID, RIGHT, row += 15, I18n.format(SKELETONS))); buttonList.add(skeleton = new GuiCheckbox(SKELETONS_ID, RIGHT, row += 15, I18n.format(SKELETONS)));
buttonList.add(illager = new GuiCheckbox(ILLAGER_ID, RIGHT, row += 15, I18n.format(ILLAGERS))); buttonList.add(illager = new GuiCheckbox(ILLAGER_ID, RIGHT, row += 15, I18n.format(ILLAGERS)));
buttonList.add(guardian = new GuiCheckbox(GUARDIAN_ID, RIGHT, row += 15, I18n.format(GUARDIANS)));
switch (config.getPonyLevel()) { switch (config.getPonyLevel()) {
default: default:
@ -103,6 +108,7 @@ public class PonySettingPanel extends GuiScreen {
pigmen.checked = config.pigzombies; pigmen.checked = config.pigzombies;
skeleton.checked = config.skeletons; skeleton.checked = config.skeletons;
illager.checked = config.illagers; illager.checked = config.illagers;
guardian.checked = config.guardians;
} }
@Override @Override
@ -171,6 +177,9 @@ public class PonySettingPanel extends GuiScreen {
case ILLAGER_ID: case ILLAGER_ID:
config.illagers = checked; config.illagers = checked;
break; break;
case GUARDIAN_ID:
config.guardians = checked;
break;
} }
} }
} }

View file

@ -3,6 +3,7 @@ package com.minelittlepony.model;
import com.minelittlepony.model.armour.ModelPonyArmor; import com.minelittlepony.model.armour.ModelPonyArmor;
import com.minelittlepony.model.armour.PonyArmor; import com.minelittlepony.model.armour.PonyArmor;
import com.minelittlepony.model.capabilities.IModel; import com.minelittlepony.model.capabilities.IModel;
import com.minelittlepony.model.capabilities.IModelPart;
import com.minelittlepony.model.components.PonySnout; import com.minelittlepony.model.components.PonySnout;
import com.minelittlepony.model.components.PonyTail; import com.minelittlepony.model.components.PonyTail;
import com.minelittlepony.pony.data.IPonyData; import com.minelittlepony.pony.data.IPonyData;
@ -17,7 +18,6 @@ import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.EnumHandSide; import net.minecraft.util.EnumHandSide;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@ -52,12 +52,12 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
/** /**
* Flag indicating that this model is performing a rainboom (flight). * Flag indicating that this model is performing a rainboom (flight).
*/ */
public boolean rainboom; protected boolean rainboom;
public PlaneRenderer upperTorso; public PlaneRenderer upperTorso;
public PlaneRenderer neck; public PlaneRenderer neck;
public PonyTail tail; public IModelPart tail;
public PonySnout snout; public PonySnout snout;
public AbstractPonyModel(boolean arms) { public AbstractPonyModel(boolean arms) {
@ -69,6 +69,13 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
return new PonyArmor(new ModelPonyArmor(), new ModelPonyArmor()); return new PonyArmor(new ModelPonyArmor(), new ModelPonyArmor());
} }
/**
* Checks flying and speed conditions and sets rainboom to true if we're a species with wings and is going faaast.
*/
protected void checkRainboom(Entity entity, float swing) {
rainboom = isFlying() && swing >= 0.9999F;
}
/** /**
* Sets the model's various rotation angles. * Sets the model's various rotation angles.
* *
@ -82,6 +89,8 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
*/ */
@Override @Override
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) { public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
checkRainboom(entity, swing);
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity); super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
float headRotateAngleY = isSleeping ? 1.4f : headYaw / 57.29578F; float headRotateAngleY = isSleeping ? 1.4f : headYaw / 57.29578F;
@ -100,7 +109,9 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
rotateLook(move, swing, bodySwingRotation, ticks); rotateLook(move, swing, bodySwingRotation, ticks);
setLegs(move, swing, ticks, entity); setLegs(move, swing, ticks, entity);
holdItem(swing); if (!rainboom) {
holdItem(swing);
}
swingItem(entity); swingItem(entity);
if (isCrouching()) { if (isCrouching()) {
@ -202,7 +213,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
* *
*/ */
protected void setLegs(float move, float swing, float ticks, Entity entity) { protected void setLegs(float move, float swing, float ticks, Entity entity) {
if (isFlying(entity)) { if (isFlying()) {
rotateLegsInFlight(move, swing, ticks, entity); rotateLegsInFlight(move, swing, ticks, entity);
} else { } else {
rotateLegsOnGround(move, swing, ticks, entity); rotateLegsOnGround(move, swing, ticks, entity);
@ -224,8 +235,8 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
* *
*/ */
protected void rotateLegsInFlight(float move, float swing, float ticks, Entity entity) { protected void rotateLegsInFlight(float move, float swing, float ticks, Entity entity) {
float armX = MathHelper.sin(-swing / 2); float armX = rainboom ? ROTATE_270 : MathHelper.sin(-swing / 2);
float legX = MathHelper.sin(swing / 2); float legX = rainboom ? ROTATE_90 : MathHelper.sin(swing / 2);
bipedLeftArm.rotateAngleX = armX; bipedLeftArm.rotateAngleX = armX;
bipedRightArm.rotateAngleX = armX; bipedRightArm.rotateAngleX = armX;
@ -655,26 +666,23 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
} }
@Override @Override
public boolean isCrouching() { public IPonyData getMetadata() {
return isSneak && !isFlying; return metadata;
}
/**
* Checks flying and speed conditions and sets rainboom to true if we're a species with wings and is going faaast.
*/
protected void checkRainboom(Entity entity, float swing) {
rainboom = isFlying(entity) && swing >= 0.9999F;
} }
@Override @Override
public boolean isFlying(Entity entity) { public boolean isCrouching() {
return (isFlying && metadata.getRace().hasWings()) || return !rainboom && isSneak && !isFlying;
(entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying()); }
@Override
public boolean isGoingFast() {
return rainboom;
} }
@Override @Override
public boolean isFlying() { public boolean isFlying() {
return isFlying; return isFlying && canFly();
} }
@Override @Override
@ -723,11 +731,11 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
* @param scale Scaling factor used to render this model. Determined by the return value of {@link RenderLivingBase.prepareScale}. Usually {@code 0.0625F}. * @param scale Scaling factor used to render this model. Determined by the return value of {@link RenderLivingBase.prepareScale}. Usually {@code 0.0625F}.
*/ */
@Override @Override
public void render(Entity entityIn, float move, float swing, float ticks, float headYaw, float headPitch, float scale) { public void render(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
pushMatrix(); pushMatrix();
transform(BodyPart.HEAD); transform(BodyPart.HEAD);
renderHead(entityIn, move, swing, ticks, headYaw, headPitch, this.scale); renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
popMatrix(); popMatrix();
pushMatrix(); pushMatrix();
@ -737,7 +745,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
pushMatrix(); pushMatrix();
transform(BodyPart.BODY); transform(BodyPart.BODY);
renderBody(entityIn, move, swing, ticks, headYaw, headPitch, this.scale); renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
popMatrix(); popMatrix();
pushMatrix(); pushMatrix();

View file

@ -3,7 +3,10 @@ package com.minelittlepony.model;
import com.minelittlepony.model.player.ModelAlicorn; import com.minelittlepony.model.player.ModelAlicorn;
import com.minelittlepony.model.player.ModelEarthPony; import com.minelittlepony.model.player.ModelEarthPony;
import com.minelittlepony.model.player.ModelPegasus; import com.minelittlepony.model.player.ModelPegasus;
import com.minelittlepony.model.player.ModelUnicorn;
import com.minelittlepony.model.player.ModelZebra;
import com.minelittlepony.model.ponies.ModelIllagerPony; import com.minelittlepony.model.ponies.ModelIllagerPony;
import com.minelittlepony.model.ponies.ModelSeapony;
import com.minelittlepony.model.ponies.ModelSkeletonPony; import com.minelittlepony.model.ponies.ModelSkeletonPony;
import com.minelittlepony.model.ponies.ModelVillagerPony; import com.minelittlepony.model.ponies.ModelVillagerPony;
import com.minelittlepony.model.ponies.ModelWitchPony; import com.minelittlepony.model.ponies.ModelWitchPony;
@ -27,9 +30,17 @@ public final class PMAPI {
public static final ModelWrapper pegasus = new ModelWrapper(new ModelPegasus(false)); public static final ModelWrapper pegasus = new ModelWrapper(new ModelPegasus(false));
public static final ModelWrapper pegasusSmall = new ModelWrapper(new ModelPegasus(true)); public static final ModelWrapper pegasusSmall = new ModelWrapper(new ModelPegasus(true));
public static final ModelWrapper unicorn = new ModelWrapper(new ModelUnicorn(false));
public static final ModelWrapper unicornSmall = new ModelWrapper(new ModelUnicorn(true));
public static final ModelWrapper alicorn = new ModelWrapper(new ModelAlicorn(false)); public static final ModelWrapper alicorn = new ModelWrapper(new ModelAlicorn(false));
public static final ModelWrapper alicornSmall = new ModelWrapper(new ModelAlicorn(true)); public static final ModelWrapper alicornSmall = new ModelWrapper(new ModelAlicorn(true));
public static final ModelWrapper zebra = new ModelWrapper(new ModelZebra(false));
public static final ModelWrapper zebraSmall = new ModelWrapper(new ModelZebra(true));
public static final ModelWrapper seapony = new ModelWrapper(new ModelSeapony());
public static final ModelWrapper zombie = new ModelWrapper(new ModelZombiePony()); public static final ModelWrapper zombie = new ModelWrapper(new ModelZombiePony());
public static final ModelWrapper skeleton = new ModelWrapper(new ModelSkeletonPony()); public static final ModelWrapper skeleton = new ModelWrapper(new ModelSkeletonPony());
public static final ModelWrapper villager = new ModelWrapper(new ModelVillagerPony()); public static final ModelWrapper villager = new ModelWrapper(new ModelVillagerPony());

View file

@ -2,8 +2,7 @@ package com.minelittlepony.model.capabilities;
import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.armour.PonyArmor; import com.minelittlepony.model.armour.PonyArmor;
import com.minelittlepony.pony.data.IPonyData;
import net.minecraft.entity.Entity;
public interface IModel { public interface IModel {
@ -25,21 +24,30 @@ public interface IModel {
*/ */
PonyArmor createArmour(); PonyArmor createArmour();
IPonyData getMetadata();
/** /**
* Returns true if this model is on the ground and crouching. * Returns true if this model is on the ground and crouching.
*/ */
boolean isCrouching(); boolean isCrouching();
/**
* Returns true if the given entity can and is flying, or has an elytra.
*/
boolean isFlying(Entity entity);
/** /**
* Returns true if the model is flying. * Returns true if the model is flying.
*/ */
boolean isFlying(); boolean isFlying();
/**
* Returns true if we're flying really fast.
*/
boolean isGoingFast();
/**
* Returns true if this model is being applied to a race that has wings.
*/
default boolean canFly() {
return getMetadata().getRace().hasWings();
}
/** /**
* Returns true if the current model is a child or a child-like foal. * Returns true if the current model is a child or a child-like foal.
*/ */

View file

@ -0,0 +1,22 @@
package com.minelittlepony.model.capabilities;
public interface IModelPart {
/**
* Initialises all of the boxes in this modelpart.
* @param yOffset
* @param stretch
*/
void init(float yOffset, float stretch);
/**
* Sets the model's various rotation angles.
*
* See {@link AbstractPonyMode.setRotationAndAngle} for an explanation of the various parameters.
*/
void setRotationAndAngles(boolean rainboom, float move, float swing, float bodySwing, float ticks);
/**
* Renders this model component.
*/
void render(float scale);
}

View file

@ -4,10 +4,7 @@ public interface IModelPegasus extends IModel {
/** /**
* Returns true if the wings are spread. * Returns true if the wings are spread.
*/ */
boolean wingsAreOpen(); default boolean wingsAreOpen() {
return isFlying() || isCrouching();
/** }
* Returns true if this model is being applied to a race that has wings.
*/
boolean canFly();
} }

View file

@ -24,9 +24,9 @@ public class ModelWing {
} }
private void addClosedWing(float x, float y, float scale) { private void addClosedWing(float x, float y, float scale) {
folded.box(x, 5f, 2, 2, 6, 2, scale) folded.box(x, 5, 2, 2, 6, 2, scale)
.box(x, 5f, 4, 2, 8, 2, scale) .box(x, 5, 4, 2, 8, 2, scale)
.box(x, 5f, 6, 2, 6, 2, scale) .box(x, 5, 6, 2, 6, 2, scale)
.rotateAngleX = ROTATE_90; .rotateAngleX = ROTATE_90;
} }

View file

@ -5,9 +5,10 @@ import net.minecraft.util.math.MathHelper;
import static com.minelittlepony.model.PonyModelConstants.*; import static com.minelittlepony.model.PonyModelConstants.*;
import com.minelittlepony.model.AbstractPonyModel; import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.capabilities.IModelPart;
import com.minelittlepony.model.capabilities.IModelPegasus; import com.minelittlepony.model.capabilities.IModelPegasus;
public class PegasusWings { public class PegasusWings implements IModelPart {
private final IModelPegasus pegasus; private final IModelPegasus pegasus;
@ -21,7 +22,14 @@ public class PegasusWings {
rightWing = new ModelWing(model, true, -6f, yOffset, stretch, 16); rightWing = new ModelWing(model, true, -6f, yOffset, stretch, 16);
} }
public void setRotationAngles(float move, float swing, float ticks) {
@Override
public void init(float yOffset, float stretch) {
}
@Override
public void setRotationAndAngles(boolean rainboom, float move, float swing, float bodySwing, float ticks) {
float flap = 0; float flap = 0;
float progress = pegasus.getSwingAmount(); float progress = pegasus.getSwingAmount();
@ -54,6 +62,7 @@ public class PegasusWings {
return LEFT_WING_ROTATE_ANGLE_Z_SNEAK; return LEFT_WING_ROTATE_ANGLE_Z_SNEAK;
} }
@Override
public void render(float scale) { public void render(float scale) {
boolean standing = pegasus.wingsAreOpen(); boolean standing = pegasus.wingsAreOpen();
leftWing.render(standing, scale); leftWing.render(standing, scale);

View file

@ -20,6 +20,11 @@ public class PonySnout {
pony.bipedHead.addChild(mare); pony.bipedHead.addChild(mare);
} }
public void rotate(float x, float y, float z) {
mare.rotate(x, y, z);
stallion.rotate(x, y, z);
}
public void init(float yOffset, float stretch) { public void init(float yOffset, float stretch) {
mare.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z) mare.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)

View file

@ -6,9 +6,10 @@ import net.minecraft.util.math.MathHelper;
import static com.minelittlepony.model.PonyModelConstants.*; import static com.minelittlepony.model.PonyModelConstants.*;
import com.minelittlepony.model.AbstractPonyModel; import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.capabilities.IModelPart;
import com.minelittlepony.render.plane.PlaneRenderer; import com.minelittlepony.render.plane.PlaneRenderer;
public class PonyTail extends PlaneRenderer { public class PonyTail extends PlaneRenderer implements IModelPart {
private static final int SEGMENTS = 4; private static final int SEGMENTS = 4;
@ -21,17 +22,14 @@ public class PonyTail extends PlaneRenderer {
theModel = model; theModel = model;
} }
@Override
public void init(float yOffset, float stretch) { public void init(float yOffset, float stretch) {
for (int i = 0; i < SEGMENTS; i++) { for (int i = 0; i < SEGMENTS; i++) {
addChild(new TailSegment(theModel, i, yOffset, stretch)); addChild(new TailSegment(theModel, i, yOffset, stretch));
} }
} }
/** @Override
* Sets the model's various rotation angles.
*
* See {@link AbstractPonyMode.setRotationAndAngle} for an explanation of the various parameters.
*/
public void setRotationAndAngles(boolean rainboom, float move, float swing, float bodySwing, float ticks) { public void setRotationAndAngles(boolean rainboom, float move, float swing, float bodySwing, float ticks) {
rotateAngleZ = rainboom ? 0 : MathHelper.cos(move * 0.8F) * 0.2f * swing; rotateAngleZ = rainboom ? 0 : MathHelper.cos(move * 0.8F) * 0.2f * swing;
rotateAngleY = bodySwing; rotateAngleY = bodySwing;
@ -63,13 +61,13 @@ public class PonyTail extends PlaneRenderer {
tailStop = theModel.metadata.getTail().ordinal(); tailStop = theModel.metadata.getTail().ordinal();
} }
public void swingX(float ticks) { private void swingX(float ticks) {
float sinTickFactor = MathHelper.sin(ticks * 0.067f) * 0.05f; float sinTickFactor = MathHelper.sin(ticks * 0.067f) * 0.05f;
rotateAngleX += sinTickFactor; rotateAngleX += sinTickFactor;
rotateAngleY += sinTickFactor; rotateAngleY += sinTickFactor;
} }
public void rotateSneak() { private void rotateSneak() {
setRotationPoint(TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_SNEAK); setRotationPoint(TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_SNEAK);
rotateAngleX = -BODY_ROTATE_ANGLE_X_SNEAK + 0.1F; rotateAngleX = -BODY_ROTATE_ANGLE_X_SNEAK + 0.1F;
} }

View file

@ -0,0 +1,62 @@
package com.minelittlepony.model.components;
import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.capabilities.IModelPart;
import com.minelittlepony.render.PonyRenderer;
import com.minelittlepony.render.plane.PlaneRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.math.MathHelper;
import static com.minelittlepony.model.PonyModelConstants.*;
public class SeaponyTail implements IModelPart {
private static final float TAIL_ROTX = PI / 2;
private PonyRenderer tailBase;
private PlaneRenderer tailTip;
private PlaneRenderer tailFins;
public SeaponyTail(AbstractPonyModel model) {
tailBase = new PonyRenderer(model, 0, 38);
tailTip = new PlaneRenderer(model, 24, 0);
tailFins = new PlaneRenderer(model, 56, 20);
tailBase.addChild(tailTip);
tailTip.addChild(tailFins);
}
@Override
public void init(float yOffset, float stretch) {
tailBase.rotate(TAIL_ROTX, 0, 0).around(-2, 14, 8)
.box( 0, 0, 0, 4, 6, 4, stretch).flipX();
tailTip.rotate(0, 0, 0).around(1, 5, 1)
.box(0, 0, 0, 2, 6, 1, stretch);
tailFins.offset(1, 0, 4).rotate(-TAIL_ROTX, 0, 0)
.addTopPlane(-8, 0, 0, 8, 8, stretch)
.flipX().addTopPlane( 0, 0, 0, 8, 8, stretch);
}
@Override
public void setRotationAndAngles(boolean rainboom, float move, float swing, float bodySwing, float ticks) {
float rotation = MathHelper.sin(ticks * 0.536f) / 4;
tailBase.offset(0, -4, -2).around(-2, 10, 8);
tailBase.rotateAngleX = TAIL_ROTX + rotation;
tailTip.rotateAngleX = rotation;
tailFins.rotateAngleX = rotation - TAIL_ROTX;
}
@Override
public void render(float scale) {
GlStateManager.enableBlend();
tailBase.render(scale);
GlStateManager.disableBlend();
}
}

View file

@ -1,24 +1,13 @@
package com.minelittlepony.model.player; package com.minelittlepony.model.player;
import com.minelittlepony.model.components.UnicornHorn; import com.minelittlepony.model.components.PegasusWings;
import com.minelittlepony.render.PonyRenderer;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.math.MathHelper;
import com.minelittlepony.model.capabilities.IModelUnicorn; import com.minelittlepony.model.capabilities.IModelPegasus;
import static com.minelittlepony.model.PonyModelConstants.*; public class ModelAlicorn extends ModelUnicorn implements IModelPegasus {
/** public PegasusWings wings;
* Used for both unicorns and alicorns since there's no logical way to keep them distinct and not duplicate stuff.
*/
public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
public PonyRenderer unicornArmRight;
public PonyRenderer unicornArmLeft;
public UnicornHorn horn;
public ModelAlicorn(boolean smallArms) { public ModelAlicorn(boolean smallArms) {
super(smallArms); super(smallArms);
@ -27,138 +16,23 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
@Override @Override
public void init(float yOffset, float stretch) { public void init(float yOffset, float stretch) {
super.init(yOffset, stretch); super.init(yOffset, stretch);
horn = new UnicornHorn(this, yOffset, stretch); wings = new PegasusWings(this, yOffset, stretch);
} }
@Override @Override
protected void rotateLegsOnGround(float move, float swing, float ticks, Entity entity) { public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
super.rotateLegsOnGround(move, swing, ticks, entity); super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
unicornArmRight.rotateAngleY = 0; if (canFly()) {
unicornArmLeft.rotateAngleY = 0; wings.setRotationAndAngles(rainboom, move, swing, 0, ticks);
}
@Override
protected void adjustLegs(float move, float swing, float ticks) {
super.adjustLegs(move, swing, ticks);
unicornArmLeft.rotateAngleZ = 0;
unicornArmRight.rotateAngleZ = 0;
unicornArmLeft.rotateAngleX = 0;
unicornArmRight.rotateAngleX = 0;
}
@Override
protected void holdItem(float swing) {
if (canCast()) {
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
alignArmForAction(unicornArmLeft, leftArmPose, both, swing);
alignArmForAction(unicornArmRight, rightArmPose, both, swing);
} else {
super.holdItem(swing);
} }
} }
@Override @Override
protected void swingItem(Entity entity) { protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
EnumHandSide mainSide = getMainHand(entity); super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
if (canFly()) {
if (canCast() && getArmPoseForSide(mainSide) != ArmPose.EMPTY) { wings.render(scale);
if (swingProgress > -9990.0F && !isSleeping) {
swingArm(getUnicornArmForSide(mainSide));
}
} else {
super.swingItem(entity);
} }
} }
@Override
protected void swingArms(float ticks) {
if (isSleeping) return;
if (canCast()) {
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
float sin = MathHelper.sin(ticks * 0.067F) * 0.05F;
if (rightArmPose != ArmPose.EMPTY) {
unicornArmRight.rotateAngleZ += cos;
unicornArmRight.rotateAngleX += sin;
}
if (leftArmPose != ArmPose.EMPTY) {
unicornArmLeft.rotateAngleZ += cos;
unicornArmLeft.rotateAngleX += sin;
}
} else {
super.swingArms(ticks);
}
}
@Override
public PonyRenderer getUnicornArmForSide(EnumHandSide side) {
return side == EnumHandSide.LEFT ? unicornArmLeft : unicornArmRight;
}
@Override
public boolean canCast() {
return metadata.hasMagic();
}
@Override
public boolean isCasting() {
return rightArmPose != ArmPose.EMPTY || leftArmPose != ArmPose.EMPTY;
}
@Override
public int getMagicColor() {
return metadata.getGlowColor();
}
@Override
protected void sneakLegs() {
super.sneakLegs();
unicornArmRight.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
unicornArmLeft.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
}
@Override
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float ticks) {
if (canCast()) {
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmRight, ticks);
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmLeft, ticks);
} else {
super.aimBow(leftArm, rightArm, ticks);
}
}
@Override
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
if (canCast()) {
horn.render(scale);
if (isCasting()) {
horn.renderMagic(getMagicColor(), scale);
}
}
}
@Override
protected void initLegTextures() {
super.initLegTextures();
unicornArmLeft = new PonyRenderer(this, 40, 32).size(64, 64);
unicornArmRight = new PonyRenderer(this, 40, 32).size(64, 64);
}
@Override
protected void initLegPositions(float yOffset, float stretch) {
super.initLegPositions(yOffset, stretch);
float armY = THIRDP_ARM_CENTRE_Y - 6;
float armZ = THIRDP_ARM_CENTRE_Z - 2;
unicornArmLeft .box(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25F).around(5, yOffset + 2, 0);
unicornArmRight.box(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25F).around(-5, yOffset + 2, 0);
}
} }

View file

@ -3,8 +3,6 @@ package com.minelittlepony.model.player;
import com.minelittlepony.model.components.PegasusWings; import com.minelittlepony.model.components.PegasusWings;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import static com.minelittlepony.model.PonyModelConstants.*;
import com.minelittlepony.model.capabilities.IModelPegasus; import com.minelittlepony.model.capabilities.IModelPegasus;
public class ModelPegasus extends ModelEarthPony implements IModelPegasus { public class ModelPegasus extends ModelEarthPony implements IModelPegasus {
@ -21,62 +19,15 @@ public class ModelPegasus extends ModelEarthPony implements IModelPegasus {
wings = new PegasusWings(this, yOffset, stretch); wings = new PegasusWings(this, yOffset, stretch);
} }
@Override
public boolean isCrouching() {
return super.isCrouching() && !rainboom;
}
@Override @Override
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) { public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
checkRainboom(entity, swing);
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity); super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
wings.setRotationAndAngles(rainboom, move, swing, 0, ticks);
if (bipedCape != null) {
wings.setRotationAngles(move, swing, ticks);
}
}
@Override
protected void rotateLegsInFlight(float move, float swing, float ticks, Entity entity) {
if (rainboom) {
bipedLeftArm.rotateAngleX = ROTATE_270;
bipedRightArm.rotateAngleX = ROTATE_270;
bipedLeftLeg.rotateAngleX = ROTATE_90;
bipedRightLeg.rotateAngleX = ROTATE_90;
bipedLeftArm.rotateAngleY = -0.2F;
bipedLeftLeg.rotateAngleY = 0.2F;
bipedRightArm.rotateAngleY = 0.2F;
bipedRightLeg.rotateAngleY = -0.2F;
} else {
super.rotateLegsInFlight(move, swing, ticks, entity);
}
}
protected void holdItem(float swing) {
if (!rainboom) {
super.holdItem(swing);
}
} }
@Override @Override
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) { protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale); super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
if (canFly()) { wings.render(scale);
wings.render(scale);
}
}
@Override
public boolean wingsAreOpen() {
return isFlying || isCrouching();
}
@Override
public boolean canFly() {
return metadata.getRace().hasWings();
} }
} }

View file

@ -0,0 +1,164 @@
package com.minelittlepony.model.player;
import com.minelittlepony.model.components.UnicornHorn;
import com.minelittlepony.render.PonyRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.math.MathHelper;
import com.minelittlepony.model.capabilities.IModelUnicorn;
import static com.minelittlepony.model.PonyModelConstants.*;
/**
* Used for both unicorns and alicorns since there's no logical way to keep them distinct and not duplicate stuff.
*/
public class ModelUnicorn extends ModelEarthPony implements IModelUnicorn {
public PonyRenderer unicornArmRight;
public PonyRenderer unicornArmLeft;
public UnicornHorn horn;
public ModelUnicorn(boolean smallArms) {
super(smallArms);
}
@Override
public void init(float yOffset, float stretch) {
super.init(yOffset, stretch);
horn = new UnicornHorn(this, yOffset, stretch);
}
@Override
protected void rotateLegsOnGround(float move, float swing, float ticks, Entity entity) {
super.rotateLegsOnGround(move, swing, ticks, entity);
unicornArmRight.rotateAngleY = 0;
unicornArmLeft.rotateAngleY = 0;
}
@Override
protected void adjustLegs(float move, float swing, float ticks) {
super.adjustLegs(move, swing, ticks);
unicornArmLeft.rotateAngleZ = 0;
unicornArmRight.rotateAngleZ = 0;
unicornArmLeft.rotateAngleX = 0;
unicornArmRight.rotateAngleX = 0;
}
@Override
protected void holdItem(float swing) {
if (canCast()) {
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
alignArmForAction(unicornArmLeft, leftArmPose, both, swing);
alignArmForAction(unicornArmRight, rightArmPose, both, swing);
} else {
super.holdItem(swing);
}
}
@Override
protected void swingItem(Entity entity) {
EnumHandSide mainSide = getMainHand(entity);
if (canCast() && getArmPoseForSide(mainSide) != ArmPose.EMPTY) {
if (swingProgress > -9990.0F && !isSleeping) {
swingArm(getUnicornArmForSide(mainSide));
}
} else {
super.swingItem(entity);
}
}
@Override
protected void swingArms(float ticks) {
if (isSleeping) return;
if (canCast()) {
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
float sin = MathHelper.sin(ticks * 0.067F) * 0.05F;
if (rightArmPose != ArmPose.EMPTY) {
unicornArmRight.rotateAngleZ += cos;
unicornArmRight.rotateAngleX += sin;
}
if (leftArmPose != ArmPose.EMPTY) {
unicornArmLeft.rotateAngleZ += cos;
unicornArmLeft.rotateAngleX += sin;
}
} else {
super.swingArms(ticks);
}
}
@Override
public PonyRenderer getUnicornArmForSide(EnumHandSide side) {
return side == EnumHandSide.LEFT ? unicornArmLeft : unicornArmRight;
}
@Override
public boolean canCast() {
return metadata.hasMagic();
}
@Override
public boolean isCasting() {
return rightArmPose != ArmPose.EMPTY || leftArmPose != ArmPose.EMPTY;
}
@Override
public int getMagicColor() {
return metadata.getGlowColor();
}
@Override
protected void sneakLegs() {
super.sneakLegs();
unicornArmRight.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
unicornArmLeft.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
}
@Override
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float ticks) {
if (canCast()) {
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmRight, ticks);
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmLeft, ticks);
} else {
super.aimBow(leftArm, rightArm, ticks);
}
}
@Override
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
if (canCast()) {
horn.render(scale);
if (isCasting()) {
horn.renderMagic(getMagicColor(), scale);
}
}
}
@Override
protected void initLegTextures() {
super.initLegTextures();
unicornArmLeft = new PonyRenderer(this, 40, 32).size(64, 64);
unicornArmRight = new PonyRenderer(this, 40, 32).size(64, 64);
}
@Override
protected void initLegPositions(float yOffset, float stretch) {
super.initLegPositions(yOffset, stretch);
float armY = THIRDP_ARM_CENTRE_Y - 6;
float armZ = THIRDP_ARM_CENTRE_Z - 2;
unicornArmLeft .box(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25F).around(5, yOffset + 2, 0);
unicornArmRight.box(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25F).around(-5, yOffset + 2, 0);
}
}

View file

@ -0,0 +1,50 @@
package com.minelittlepony.model.player;
import com.minelittlepony.render.PonyRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
public class ModelZebra extends ModelEarthPony {
public PonyRenderer bristles;
public ModelZebra(boolean useSmallArms) {
super(useSmallArms);
}
@Override
protected void renderHead(Entity entity, float move, float swing, float age, float headYaw, float headPitch, float scale) {
GlStateManager.translate(0, -0.1F, 0);
super.renderHead(entity, move, swing, age, headYaw, headPitch, scale);
}
@Override
protected void renderNeck() {
GlStateManager.scale(1, 1.1F, 1);
super.renderNeck();
}
@Override
protected void initHeadTextures() {
super.initHeadTextures();
bristles = new PonyRenderer(this, 56, 32);
bipedHead.addChild(bristles);
}
@Override
protected void initHeadPositions(float yOffset, float stretch) {
super.initHeadPositions(yOffset, stretch);
bristles.offset(-1, -1, -3)
.box(0, -10, 2, 2, 6, 2, scale)
.box(0, -10, 4, 2, 8, 2, scale)
.box(0, -8, 6, 2, 6, 2, scale)
.rotateAngleX = 0.3F;
bristles.child(0).offset(-1.01F, 2, -7) //0.01 to prevent z-fighting
.box(0, -10, 4, 2, 8, 2, scale)
.box(0, -8, 6, 2, 6, 2, scale)
.rotateAngleX = -1F;
}
}

View file

@ -10,7 +10,9 @@ public enum PlayerModels {
@Deprecated HUMAN("default", "slim", () -> PMAPI.pony, () -> PMAPI.ponySmall), @Deprecated HUMAN("default", "slim", () -> PMAPI.pony, () -> PMAPI.ponySmall),
EARTH("earthpony", "slimearthpony", () -> PMAPI.earthpony, () -> PMAPI.earthponySmall), EARTH("earthpony", "slimearthpony", () -> PMAPI.earthpony, () -> PMAPI.earthponySmall),
PEGASUS("pegasus", "slimpegasus", () -> PMAPI.pegasus, () -> PMAPI.pegasusSmall), PEGASUS("pegasus", "slimpegasus", () -> PMAPI.pegasus, () -> PMAPI.pegasusSmall),
ALICORN("alicorn", "slimalicorn", () -> PMAPI.alicorn, () -> PMAPI.alicornSmall); UNICORN("unicorn", "slimunicorn", () -> PMAPI.unicorn, () -> PMAPI.unicornSmall),
ALICORN("alicorn", "slimalicorn", () -> PMAPI.alicorn, () -> PMAPI.alicornSmall),
ZEBRA("zebra", "slimzebra", () -> PMAPI.zebra, () -> PMAPI.zebraSmall);
private final ModelResolver normal, slim; private final ModelResolver normal, slim;

View file

@ -0,0 +1,145 @@
package com.minelittlepony.model.ponies;
import com.minelittlepony.model.components.SeaponyTail;
import com.minelittlepony.model.player.ModelUnicorn;
import com.minelittlepony.render.PonyRenderer;
import com.minelittlepony.render.plane.PlaneRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import static com.minelittlepony.model.PonyModelConstants.*;
public class ModelSeapony extends ModelUnicorn {
private static final float FIN_ROTY = PI / 6;
PonyRenderer bodyCenter;
PlaneRenderer leftFin;
PlaneRenderer centerFin;
PlaneRenderer rightFin;
public ModelSeapony() {
super(false);
textureHeight = 64;
}
@Override
protected void initLegTextures() {
super.initLegTextures();
// hide the back legs
bipedLeftLeg.showModel = false;
bipedRightLeg.showModel = false;
bipedLeftLegwear.showModel = false;
bipedRightLegwear.showModel = false;
centerFin = new PlaneRenderer(this, 58, 28);
leftFin = new PlaneRenderer(this, 56, 16);
rightFin = new PlaneRenderer(this, 56, 16);
}
@Override
protected void initLegPositions(float yOffset, float stretch) {
super.initLegPositions(yOffset, stretch);
centerFin.rotate(PI / 2 - 0.1F, 0, 0).around(0, 6, 9)
.addEastPlane(0, -6, 0, 12, 6, stretch);
leftFin.rotate(0, FIN_ROTY, 0).around(3, -6, 3)
.flipZ().addEastPlane(0, 0, 0, 12, 8, stretch);
rightFin.rotate(0, -FIN_ROTY, 0).around(-3, -6, 3)
.addWestPlane(0, 0, 0, 12, 8, stretch);
}
@Override
protected void initTailTextures() {
tail = new SeaponyTail(this);
}
@Override
protected void initBodyTextures() {
super.initBodyTextures();
bodyCenter = new PonyRenderer(this, 0, 48);
}
@Override
protected void initBodyPositions(float yOffset, float stretch) {
super.initBodyPositions(yOffset, stretch);
bodyCenter.around(0, 6, 1)
.box(-3, -1, 0, 6, 7, 9, stretch).flipX();
}
@Override
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
float finAngle = FIN_ROTY + MathHelper.cos(ticks / 10) / 5;
leftFin.rotateAngleY = finAngle;
rightFin.rotateAngleY = -finAngle;
centerFin.rotateAngleZ = MathHelper.cos(ticks / 10) / 5;
if (!entity.isInWater()) {
bipedLeftArm.rotateAngleX -= 0.5F;
bipedRightArm.rotateAngleX -= 0.5F;
}
if (!entity.isInWater() || entity.onGround) {
bipedLeftArm.rotateAngleY -= 0.5F;
bipedRightArm.rotateAngleY += 0.5F;
}
}
protected void fixSpecialRotationPoints(float move) {
bipedLeftArm.rotateAngleX -= 1.4F;
bipedLeftArm.rotateAngleY -= 0.3F;
bipedRightArm.rotateAngleX -= 1.4F;
bipedRightArm.rotateAngleY += 0.3F;
}
@Override
public void render(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
GlStateManager.pushMatrix();
GlStateManager.translate(0, 0.6F, 0);
super.render(entity, move, swing, ticks, headYaw, headPitch, scale);
GlStateManager.popMatrix();
}
@Override
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
bipedBody.render(scale);
bodyCenter.render(scale);
bipedBody.postRender(scale);
tail.render(scale);
GlStateManager.enableBlend();
leftFin.render(scale);
centerFin.render(scale);
rightFin.render(scale);
GlStateManager.disableBlend();
}
@Override
public boolean canCast() {
return true;
}
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
// hide the back legs
bipedLeftLeg.showModel = false;
bipedRightLeg.showModel = false;
bipedLeftLegwear.showModel = false;
bipedRightLegwear.showModel = false;
}
}

View file

@ -3,38 +3,73 @@ package com.minelittlepony.model.ponies;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityWitch; import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import static com.minelittlepony.model.PonyModelConstants.HEAD_RP_X; import static com.minelittlepony.model.PonyModelConstants.HEAD_RP_X;
import static com.minelittlepony.model.PonyModelConstants.HEAD_RP_Y; import static com.minelittlepony.model.PonyModelConstants.HEAD_RP_Y;
import static com.minelittlepony.model.PonyModelConstants.HEAD_RP_Z; import static com.minelittlepony.model.PonyModelConstants.HEAD_RP_Z;
import static com.minelittlepony.model.PonyModelConstants.PI;
import com.minelittlepony.model.player.ModelZebra;
import com.minelittlepony.render.PonyRenderer; import com.minelittlepony.render.PonyRenderer;
public class ModelWitchPony extends ModelVillagerPony { public class ModelWitchPony extends ModelZebra {
private static final ResourceLocation WITCH_TEXTURES = new ResourceLocation("textures/entity/witch.png"); private static final ResourceLocation WITCH_TEXTURES = new ResourceLocation("textures/entity/witch.png");
private PonyRenderer witchHat; private PonyRenderer witchHat;
public ModelWitchPony() { public ModelWitchPony() {
super(); super(false);
}
public void setLivingAnimations(EntityLivingBase entity, float move, float swing, float ticks) {
EntityWitch witch = ((EntityWitch) entity);
leftArmPose = ArmPose.EMPTY;
rightArmPose = witch.getHeldItemMainhand().isEmpty() ? ArmPose.EMPTY : ArmPose.ITEM;
} }
@Override @Override
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) { public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
rightArmPose = ArmPose.EMPTY;
leftArmPose = ((EntityWitch) entity).getHeldItemMainhand().isEmpty() ? ArmPose.EMPTY : ArmPose.ITEM;
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity); super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
if (leftArmPose != ArmPose.EMPTY) {
if (!canCast()) { if (((EntityWitch)entity).isDrinkingPotion()) {
bipedRightArm.rotateAngleX = -2 * (float)Math.PI/3; float noseRot = MathHelper.sin(entity.ticksExisted);
bipedRightArm.offsetZ = 0.1f;
} snout.rotate(noseRot * 4.5F * 0.02F, 0, noseRot * 2.5F * 0.02F);
unicornArmRight.offsetZ = -0.1f; } else {
snout.rotate(0, 0, 0);
} }
if (rightArmPose != ArmPose.EMPTY) {
float rot = (float)(Math.tan(ticks / 7) + Math.sin(ticks / 3));
if (rot > 1) rot = 1;
if (rot < -1) rot = -1;
float legDrinkingAngle = -1 * PI/3 + rot;
bipedRightArm.rotateAngleX = legDrinkingAngle;
bipedRightArmwear.rotateAngleX = legDrinkingAngle;
bipedRightArm.rotateAngleY = 0.1F;
bipedRightArmwear.rotateAngleY = 0.1F;
bipedRightArm.offsetZ = 0.1f;
bipedRightArmwear.offsetZ = 0.1f;
if (rot > 0) rot = 0;
bipedHead.rotateAngleX = -rot / 2;
bipedHeadwear.rotateAngleX = -rot / 2;
} else {
bipedRightArm.offsetZ = 0;
bipedRightArmwear.offsetZ = 0;
}
} }
@Override @Override

View file

@ -100,7 +100,7 @@ public class Pony {
//noinspection SimplifiableIfStatement //noinspection SimplifiableIfStatement
if (!getRace(false).hasWings()) return false; if (!getRace(false).hasWings()) return false;
return player.capabilities.isFlying || !(player.onGround || player.isRiding() || player.isOnLadder() || player.isInWater() || player.isElytraFlying()); return player.capabilities.isFlying || !(player.onGround || player.isRiding() || player.isOnLadder() || player.isInWater());
} }
public ModelWrapper getModel(boolean ignorePony) { public ModelWrapper getModel(boolean ignorePony) {

View file

@ -7,10 +7,10 @@ public enum PonyRace implements ITriggerPixelMapped<PonyRace> {
HUMAN(0, PlayerModels.HUMAN, false, false), HUMAN(0, PlayerModels.HUMAN, false, false),
EARTH(0xf9b131, PlayerModels.EARTH,false, false), EARTH(0xf9b131, PlayerModels.EARTH,false, false),
PEGASUS(0x88caf0, PlayerModels.PEGASUS, true, false), PEGASUS(0x88caf0, PlayerModels.PEGASUS, true, false),
UNICORN(0xd19fe4, PlayerModels.ALICORN, false, true), UNICORN(0xd19fe4, PlayerModels.UNICORN, false, true),
ALICORN(0xfef9fc, PlayerModels.ALICORN, true, true), ALICORN(0xfef9fc, PlayerModels.ALICORN, true, true),
CHANGELING(0x282b29, PlayerModels.ALICORN, true, true), CHANGELING(0x282b29, PlayerModels.ALICORN, true, true),
ZEBRA(0xd0cccf, PlayerModels.EARTH, false, false), ZEBRA(0xd0cccf, PlayerModels.ZEBRA, false, false),
REFORMED_CHANGELING(0xcaed5a, PlayerModels.ALICORN, true, true), REFORMED_CHANGELING(0xcaed5a, PlayerModels.ALICORN, true, true),
GRIFFIN(0xae9145, PlayerModels.PEGASUS, true, false), GRIFFIN(0xae9145, PlayerModels.PEGASUS, true, false),
HIPPOGRIFF(0xd6ddac, PlayerModels.PEGASUS, true, false); HIPPOGRIFF(0xd6ddac, PlayerModels.PEGASUS, true, false);

View file

@ -53,7 +53,7 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
@Override @Override
protected void preRenderCallback(T entity, float ticks) { protected void preRenderCallback(T entity, float ticks) {
playerModel.getModel().isSneak = entity.isSneaking(); playerModel.getModel().isSneak = entity.isSneaking();
playerModel.getModel().isFlying = !entity.onGround; playerModel.getModel().isFlying = !entity.onGround || entity.isElytraFlying();
playerModel.getModel().isSleeping = false; playerModel.getModel().isSleeping = false;
ResourceLocation loc = getEntityTexture(entity); ResourceLocation loc = getEntityTexture(entity);
@ -95,4 +95,24 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
} }
protected abstract ResourceLocation getTexture(T entity); protected abstract ResourceLocation getTexture(T entity);
public abstract static class Proxy<T extends EntityLiving> extends RenderPonyMob<T> {
public Proxy(RenderManager manager, ModelWrapper model) {
super(manager, model);
}
@Override
protected void addLayers() {
}
public void preRenderCallback(T entity, float ticks) {
super.preRenderCallback(entity, ticks);
}
public final ResourceLocation getTextureFor(T entity) {
return super.getEntityTexture(entity);
}
}
} }

View file

@ -98,7 +98,7 @@ public abstract class RenderPonyBase extends RenderPlayer implements IRenderPony
if (player.isEntityAlive() && player.isPlayerSleeping()) return; if (player.isEntityAlive() && player.isPlayerSleeping()) return;
if (ponyModel.rainboom) { if (ponyModel.isGoingFast()) {
transformPegasusFlight(player, motionX, motionY, motionZ, yaw, pitch, ticks); transformPegasusFlight(player, motionX, motionY, motionZ, yaw, pitch, ticks);
return; return;
} }

View file

@ -0,0 +1,72 @@
package com.minelittlepony.render.ponies;
import javax.annotation.Nonnull;
import com.minelittlepony.model.PMAPI;
import com.minelittlepony.render.RenderPonyMob;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderGuardian;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.monster.EntityElderGuardian;
import net.minecraft.entity.monster.EntityGuardian;
import net.minecraft.util.ResourceLocation;
public class RenderPonyGuardian extends RenderGuardian {
public static final ResourceLocation SEAPONY = new ResourceLocation("minelittlepony", "textures/entity/seapony.png");
private RenderPonyMob.Proxy<EntityGuardian> ponyRenderer;
public RenderPonyGuardian(RenderManager manager) {
super(manager);
mainModel = PMAPI.seapony.getModel();
ponyRenderer = new RenderPonyMob.Proxy<EntityGuardian>(manager, PMAPI.seapony) {
@Override
protected ResourceLocation getTexture(EntityGuardian entity) {
return RenderPonyGuardian.this.getTexture(entity);
}
};
}
@Override
@Nonnull
protected final ResourceLocation getEntityTexture(EntityGuardian entity) {
return ponyRenderer.getTextureFor(entity);
}
@Override
protected void preRenderCallback(EntityGuardian entity, float ticks) {
ponyRenderer.preRenderCallback(entity, ticks);
}
public void doRender(EntityGuardian entity, double x, double y, double z, float entityYaw, float partialTicks) {
float origin = entity.height;
// aligns the beam to their horns
entity.height = entity instanceof EntityElderGuardian ? 6 : 3;
super.doRender(entity, x, y, z, entityYaw, partialTicks);
// The beams in RenderGuardian leave lighting disabled, so we need to change it back. #MojangPls
GlStateManager.enableLighting();
entity.height = origin;
}
protected ResourceLocation getTexture(EntityGuardian entity) {
return SEAPONY;
}
public static class Elder extends RenderPonyGuardian {
public Elder(RenderManager manager) {
super(manager);
}
@Override
protected void preRenderCallback(EntityGuardian entity, float ticks) {
super.preRenderCallback(entity, ticks);
GlStateManager.scale(2.35F, 2.35F, 2.35F);
}
}
}

View file

@ -30,7 +30,8 @@ public class RenderPonyWitch extends RenderPonyMob<EntityWitch> {
GlStateManager.translate(-0.1F, 0.7F, 0); GlStateManager.translate(-0.1F, 0.7F, 0);
GlStateManager.rotate(110, 1, 0, 0); GlStateManager.rotate(110, 1, 0, 0);
} else { } else {
GlStateManager.translate(-0.2F, -0.3F, -0.7F); GlStateManager.translate(0, -0.3F, -0.8F);
GlStateManager.rotate(10, 1, 0, 0);
} }
} }
}; };

View file

@ -15,3 +15,4 @@ minelp.mobs.zombies=Ponify zombies
minelp.mobs.zombiepigmen=Ponify zombie pigmen minelp.mobs.zombiepigmen=Ponify zombie pigmen
minelp.mobs.skeletons=Ponify skeletons minelp.mobs.skeletons=Ponify skeletons
minelp.mobs.illagers=Ponify illagers minelp.mobs.illagers=Ponify illagers
minelp.mobs.guardians=Ponify guardians

View file

@ -7,13 +7,15 @@ minelp.options.ponylevel.humans=Seuls Humains
minelp.options.ponylevel.both=Deux minelp.options.ponylevel.both=Deux
minelp.options.options=Options Poney minelp.options.options=Options Poney
minelp.options.hd=Activer MineLP serveur de skin minelp.options.hd=Activer MineLP serveur de skin
minelp.options.sizes=Autoriser tous les différentes tailles de poney minelp.options.sizes=Autoriser tous les différentes tailles de poney
minelp.options.ponyarmor=Utiliser armure compatible de MineLP minelp.options.ponyarmor=Utiliser armure compatible de MineLP
minelp.options.snuzzles=Afficher museau sur les poneys minelp.options.snuzzles=Afficher museau sur les poneys
minelp.options.showscale=Utiliser échelle fidèle à MLP minelp.options.showscale=Utiliser échelle fidéle á MLP
minelp.mobs.title=Options de mobs minelp.mobs.title=Options de mobs
minelp.mobs.villagers=Ponifier villageois minelp.mobs.villagers=Ponifier villageois
minelp.mobs.zombies=Ponifier zombies minelp.mobs.zombies=Ponifier zombies
minelp.mobs.zombiepigmen=Ponifier zombie pigmen minelp.mobs.zombiepigmen=Ponifier cochon-zombie
minelp.mobs.skeletons=Ponifier squelettes minelp.mobs.skeletons=Ponifier squelettes
minelp.mobs.illagers=Ponifier illagers
minelp.mobs.guardians=Ponifier gardien

View file

@ -13,4 +13,4 @@ minelp.mobs.title=Пони-мобы
minelp.mobs.villagers=Пони-житель minelp.mobs.villagers=Пони-житель
minelp.mobs.zombies=Пони-зомби minelp.mobs.zombies=Пони-зомби
minelp.mobs.zombiepigmen=Пони-свинозомби minelp.mobs.zombiepigmen=Пони-свинозомби
minelp.mobs.skeletons=Пони-скелеты minelp.mobs.skeletons=Пони-скелеты

Binary file not shown.

After

Width:  |  Height:  |  Size: 709 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 620 B

After

Width:  |  Height:  |  Size: 769 B