mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-23 04:57:58 +01:00
Guardians are now seaponies!
This commit is contained in:
parent
cc6dfaf772
commit
93ec981628
14 changed files with 306 additions and 89 deletions
|
@ -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.
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -129,6 +132,14 @@ 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));
|
||||||
|
} else {
|
||||||
|
restoreRenderer(EntityGuardian.class);
|
||||||
|
restoreRenderer(EntityElderGuardian.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,11 +149,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -56,7 +57,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
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) {
|
||||||
|
@ -730,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();
|
||||||
|
@ -744,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();
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.minelittlepony.model.player.ModelEarthPony;
|
||||||
import com.minelittlepony.model.player.ModelPegasus;
|
import com.minelittlepony.model.player.ModelPegasus;
|
||||||
import com.minelittlepony.model.player.ModelZebra;
|
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;
|
||||||
|
@ -34,6 +35,8 @@ public final class PMAPI {
|
||||||
public static final ModelWrapper zebra = new ModelWrapper(new ModelZebra(false));
|
public static final ModelWrapper zebra = new ModelWrapper(new ModelZebra(false));
|
||||||
public static final ModelWrapper zebraSmall = new ModelWrapper(new ModelZebra(true));
|
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());
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -24,7 +24,7 @@ public class ModelAlicorn extends ModelUnicorn implements IModelPegasus {
|
||||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||||
|
|
||||||
if (canFly()) {
|
if (canFly()) {
|
||||||
wings.setRotationAngles(move, swing, ticks);
|
wings.setRotationAndAngles(rainboom, move, swing, 0, ticks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class ModelPegasus extends ModelEarthPony implements IModelPegasus {
|
||||||
@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) {
|
||||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||||
wings.setRotationAngles(move, swing, ticks);
|
wings.setRotationAndAngles(rainboom, move, swing, 0, ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,22 +1,25 @@
|
||||||
package com.minelittlepony.model.ponies;
|
package com.minelittlepony.model.ponies;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.components.SeaponyTail;
|
||||||
import com.minelittlepony.model.player.ModelUnicorn;
|
import com.minelittlepony.model.player.ModelUnicorn;
|
||||||
import com.minelittlepony.render.PonyRenderer;
|
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.entity.Entity;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||||
|
|
||||||
public class ModelSeapony extends ModelUnicorn {
|
public class ModelSeapony extends ModelUnicorn {
|
||||||
|
|
||||||
|
private static final float FIN_ROTY = PI / 6;
|
||||||
|
|
||||||
PonyRenderer bodyCenter;
|
PonyRenderer bodyCenter;
|
||||||
PonyRenderer bodyRear;
|
|
||||||
PonyRenderer bodyBack;
|
|
||||||
|
|
||||||
PonyRenderer tail;
|
PlaneRenderer leftFin;
|
||||||
PonyRenderer tailFin;
|
PlaneRenderer centerFin;
|
||||||
|
PlaneRenderer rightFin;
|
||||||
PonyRenderer leftFin;
|
|
||||||
PonyRenderer centerFin;
|
|
||||||
PonyRenderer rightFin;
|
|
||||||
|
|
||||||
public ModelSeapony() {
|
public ModelSeapony() {
|
||||||
super(false);
|
super(false);
|
||||||
|
@ -26,103 +29,117 @@ public class ModelSeapony extends ModelUnicorn {
|
||||||
@Override
|
@Override
|
||||||
protected void initLegTextures() {
|
protected void initLegTextures() {
|
||||||
super.initLegTextures();
|
super.initLegTextures();
|
||||||
|
|
||||||
// hide the back legs
|
// hide the back legs
|
||||||
bipedLeftLeg.showModel = false;
|
bipedLeftLeg.showModel = false;
|
||||||
bipedRightLeg.showModel = false;
|
bipedRightLeg.showModel = false;
|
||||||
bipedLeftLegwear.showModel = false;
|
bipedLeftLegwear.showModel = false;
|
||||||
bipedRightLegwear.showModel = false;
|
bipedRightLegwear.showModel = false;
|
||||||
|
|
||||||
centerFin = new PonyRenderer(this, 58, 36);
|
centerFin = new PlaneRenderer(this, 58, 28);
|
||||||
leftFin = new PonyRenderer(this, 56, 8);
|
leftFin = new PlaneRenderer(this, 56, 16);
|
||||||
rightFin = new PonyRenderer(this, 56, 8);
|
rightFin = new PlaneRenderer(this, 56, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initLegPositions(float yOffset, float stretch) {
|
protected void initLegPositions(float yOffset, float stretch) {
|
||||||
super.initLegPositions(yOffset, stretch);
|
super.initLegPositions(yOffset, stretch);
|
||||||
|
|
||||||
centerFin.around(0, 1, 9)
|
centerFin.rotate(PI / 2 - 0.1F, 0, 0).around(0, 6, 9)
|
||||||
.addBox(0, 0, 0, 0, 6, 6).flipX();
|
.addEastPlane(0, -6, 0, 12, 6, stretch);
|
||||||
|
|
||||||
leftFin.rotate(0, 0.5235988F, 0).around(3, -6, 3)
|
leftFin.rotate(0, FIN_ROTY, 0).around(3, -6, 3)
|
||||||
.addBox(0, 0, 0, 0, 12, 8).flipX();
|
.flipZ().addEastPlane(0, 0, 0, 12, 8, stretch);
|
||||||
|
|
||||||
rightFin.rotate(0, -0.5235988F, 0).around(-3, -6, 3)
|
rightFin.rotate(0, -FIN_ROTY, 0).around(-3, -6, 3)
|
||||||
.addBox(0, 0, 0, 0, 12, 8).flipX();
|
.addWestPlane(0, 0, 0, 12, 8, stretch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initTailTextures() {
|
protected void initTailTextures() {
|
||||||
tail = new PonyRenderer(this, 24, 0);
|
tail = new SeaponyTail(this);
|
||||||
tailFin = new PonyRenderer(this, 56, 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initTailPositions(float yOffset, float stretch) {
|
|
||||||
tail.rotate(1.570796F, 0, 0).around(-1, 12.5F, 14)
|
|
||||||
.addBox(0, 0, 0, 2, 6, 1).flipX();
|
|
||||||
tailFin.rotate(0, 0, -1.570796F).around(-2, 12, 18)
|
|
||||||
.addBox(0, -5, 0, 0, 14, 8).flipX();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initBodyTextures() {
|
protected void initBodyTextures() {
|
||||||
super.initBodyTextures();
|
super.initBodyTextures();
|
||||||
|
|
||||||
bodyCenter = new PonyRenderer(this, 0, 48);
|
bodyCenter = new PonyRenderer(this, 0, 48);
|
||||||
bodyBack = new PonyRenderer(this, 0, 16);
|
|
||||||
bodyRear = new PonyRenderer(this, 0, 38);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initBodyPositions(float yOffset, float stretch) {
|
protected void initBodyPositions(float yOffset, float stretch) {
|
||||||
super.initBodyPositions(yOffset, stretch);
|
super.initBodyPositions(yOffset, stretch);
|
||||||
|
|
||||||
bodyCenter.around(0, 6, 1)
|
bodyCenter.around(0, 6, 1)
|
||||||
.addBox(-3, -1, 0, 6, 7, 9).flipX();
|
.box(-3, -1, 0, 6, 7, 9, stretch).flipX();
|
||||||
|
|
||||||
bodyBack.around(-4, 2, -1)
|
|
||||||
.addBox(0, 0, 0, 8, 8, 4);
|
|
||||||
|
|
||||||
bodyRear.rotate(1.570796F, 0, 0).around(-2, 14, 8)
|
|
||||||
.addBox(0, 0, 0, 4, 6, 4).flipX();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
|
||||||
bipedBody.render(scale);
|
|
||||||
if (textureHeight == 64) {
|
|
||||||
bipedBodyWear.render(scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
bodyCenter.render(scale);
|
|
||||||
bodyRear.render(scale);
|
|
||||||
bodyBack.render(scale);
|
|
||||||
|
|
||||||
bipedBody.postRender(scale);
|
|
||||||
|
|
||||||
tail.render(scale);
|
|
||||||
tailFin.render(scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void renderLegs() {
|
|
||||||
super.renderLegs();
|
|
||||||
|
|
||||||
leftFin.render(scale);
|
|
||||||
centerFin.render(scale);
|
|
||||||
rightFin.render(scale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@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) {
|
||||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, 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
|
@Override
|
||||||
public boolean canFly() {
|
public void render(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||||
return false;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue