mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 22:38:00 +01:00
Pony endermen
This commit is contained in:
parent
3c53d3e4ff
commit
6ea3ed2d75
15 changed files with 378 additions and 38 deletions
|
@ -38,6 +38,7 @@ public class PonyConfig extends SensibleConfig implements Exposable {
|
||||||
@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;
|
@Expose public boolean guardians = true;
|
||||||
|
@Expose public boolean endermen = 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.
|
||||||
|
|
|
@ -615,6 +615,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
preInitLegs();
|
preInitLegs();
|
||||||
preInitLegwear();
|
preInitLegwear();
|
||||||
|
|
||||||
|
int armLength = getArmLength();
|
||||||
int armWidth = getArmWidth();
|
int armWidth = getArmWidth();
|
||||||
int armDepth = getArmDepth();
|
int armDepth = getArmDepth();
|
||||||
|
|
||||||
|
@ -625,11 +626,11 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
float armY = THIRDP_ARM_CENTRE_Y;
|
float armY = THIRDP_ARM_CENTRE_Y;
|
||||||
float armZ = BODY_CENTRE_Z / 2 - 1 - armDepth;
|
float armZ = BODY_CENTRE_Z / 2 - 1 - armDepth;
|
||||||
|
|
||||||
bipedLeftArm .addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch);
|
bipedLeftArm .addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch);
|
||||||
bipedRightArm.addBox(armX - armWidth, armY, armZ, armWidth, 12, armDepth, stretch);
|
bipedRightArm.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch);
|
||||||
|
|
||||||
bipedLeftLeg .addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch);
|
bipedLeftLeg .addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch);
|
||||||
bipedRightLeg.addBox(armX - armWidth, armY, armZ, armWidth, 12, armDepth, stretch);
|
bipedRightLeg.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch);
|
||||||
|
|
||||||
bipedLeftArm .setRotationPoint( rarmX, yOffset + rarmY, 0);
|
bipedLeftArm .setRotationPoint( rarmX, yOffset + rarmY, 0);
|
||||||
bipedRightArm.setRotationPoint(-rarmX, yOffset + rarmY, 0);
|
bipedRightArm.setRotationPoint(-rarmX, yOffset + rarmY, 0);
|
||||||
|
@ -637,16 +638,16 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
bipedLeftLeg .setRotationPoint( rarmX, yOffset, 0);
|
bipedLeftLeg .setRotationPoint( rarmX, yOffset, 0);
|
||||||
bipedRightLeg.setRotationPoint(-rarmX, yOffset, 0);
|
bipedRightLeg.setRotationPoint(-rarmX, yOffset, 0);
|
||||||
|
|
||||||
bipedLeftArmwear.addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f);
|
bipedLeftArmwear.addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
|
||||||
bipedLeftArmwear.setRotationPoint(rarmX, yOffset + rarmY, 0);
|
bipedLeftArmwear.setRotationPoint(rarmX, yOffset + rarmY, 0);
|
||||||
|
|
||||||
bipedRightArmwear.addBox(armX - armWidth, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f);
|
bipedRightArmwear.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
|
||||||
bipedRightArmwear.setRotationPoint(-rarmX, yOffset + rarmY, 0);
|
bipedRightArmwear.setRotationPoint(-rarmX, yOffset + rarmY, 0);
|
||||||
|
|
||||||
bipedLeftLegwear.addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f);
|
bipedLeftLegwear.addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
|
||||||
bipedRightLegwear.setRotationPoint(rarmX, yOffset, 0);
|
bipedRightLegwear.setRotationPoint(rarmX, yOffset, 0);
|
||||||
|
|
||||||
bipedRightLegwear.addBox(armX - armWidth, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f);
|
bipedRightLegwear.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
|
||||||
bipedRightLegwear.setRotationPoint(-rarmX, yOffset, 0);
|
bipedRightLegwear.setRotationPoint(-rarmX, yOffset, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -658,6 +659,10 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected int getArmLength() {
|
||||||
|
return 12;
|
||||||
|
}
|
||||||
|
|
||||||
protected float getLegRotationX() {
|
protected float getLegRotationX() {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,5 @@ public class ModelMobPony extends ModelAlicorn {
|
||||||
|
|
||||||
arm.rotateAngleY = direction * (0.1F - swing * 0.6F);
|
arm.rotateAngleY = direction * (0.1F - swing * 0.6F);
|
||||||
arm.rotateAngleZ = cos;
|
arm.rotateAngleZ = cos;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.ModelUnicorn;
|
import com.minelittlepony.model.player.ModelUnicorn;
|
||||||
import com.minelittlepony.model.player.ModelZebra;
|
import com.minelittlepony.model.player.ModelZebra;
|
||||||
|
import com.minelittlepony.model.ponies.ModelEnderStallion;
|
||||||
import com.minelittlepony.model.ponies.ModelIllagerPony;
|
import com.minelittlepony.model.ponies.ModelIllagerPony;
|
||||||
import com.minelittlepony.model.ponies.ModelSeapony;
|
import com.minelittlepony.model.ponies.ModelSeapony;
|
||||||
import com.minelittlepony.model.ponies.ModelSkeletonPony;
|
import com.minelittlepony.model.ponies.ModelSkeletonPony;
|
||||||
|
@ -43,6 +44,7 @@ public final class PMAPI {
|
||||||
public static final ModelWrapper villager = new ModelWrapper(new ModelVillagerPony());
|
public static final ModelWrapper villager = new ModelWrapper(new ModelVillagerPony());
|
||||||
public static final ModelWrapper illager = new ModelWrapper(new ModelIllagerPony());
|
public static final ModelWrapper illager = new ModelWrapper(new ModelIllagerPony());
|
||||||
public static final ModelWrapper witch = new ModelWrapper(new ModelWitchPony());
|
public static final ModelWrapper witch = new ModelWrapper(new ModelWitchPony());
|
||||||
|
public static final ModelWrapper enderman = new ModelWrapper(new ModelEnderStallion());
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
for (Field field : PMAPI.class.getFields()) {
|
for (Field field : PMAPI.class.getFields()) {
|
||||||
|
|
|
@ -6,14 +6,18 @@ public interface IModelPart {
|
||||||
* @param yOffset
|
* @param yOffset
|
||||||
* @param stretch
|
* @param stretch
|
||||||
*/
|
*/
|
||||||
void init(float yOffset, float stretch);
|
default void init(float yOffset, float stretch) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the model's various rotation angles.
|
* Sets the model's various rotation angles.
|
||||||
*
|
*
|
||||||
* See {@link AbstractPonyMode.setRotationAndAngle} for an explanation of the various parameters.
|
* See {@link AbstractPonyMode.setRotationAndAngle} for an explanation of the various parameters.
|
||||||
*/
|
*/
|
||||||
void setRotationAndAngles(boolean rainboom, float move, float swing, float bodySwing, float ticks);
|
default void setRotationAndAngles(boolean rainboom, float move, float swing, float bodySwing, float ticks) {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders this model component.
|
* Renders this model component.
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class ModelPonyHead extends ModelHumanoidHead implements ICapitated {
|
||||||
|
|
||||||
if (metadata.hasMagic()) {
|
if (metadata.hasMagic()) {
|
||||||
skeletonHead.postRender(scale);
|
skeletonHead.postRender(scale);
|
||||||
horn.render(scale);
|
horn.renderPart(scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.minelittlepony.model.components;
|
package com.minelittlepony.model.components;
|
||||||
|
|
||||||
import com.minelittlepony.model.capabilities.ICapitated;
|
import com.minelittlepony.model.capabilities.ICapitated;
|
||||||
|
import com.minelittlepony.model.capabilities.IModelPart;
|
||||||
import com.minelittlepony.render.HornGlowRenderer;
|
import com.minelittlepony.render.HornGlowRenderer;
|
||||||
import com.minelittlepony.render.PonyRenderer;
|
import com.minelittlepony.render.PonyRenderer;
|
||||||
|
|
||||||
|
@ -10,10 +11,12 @@ import static org.lwjgl.opengl.GL11.*;
|
||||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||||
|
|
||||||
public class UnicornHorn {
|
public class UnicornHorn implements IModelPart {
|
||||||
|
|
||||||
private PonyRenderer horn;
|
protected PonyRenderer horn;
|
||||||
private HornGlowRenderer glow;
|
protected HornGlowRenderer glow;
|
||||||
|
|
||||||
|
protected boolean isVisible;
|
||||||
|
|
||||||
public <T extends ModelBase & ICapitated> UnicornHorn(T pony, float yOffset, float stretch) {
|
public <T extends ModelBase & ICapitated> UnicornHorn(T pony, float yOffset, float stretch) {
|
||||||
this(pony, yOffset, stretch, 0, 0, 0);
|
this(pony, yOffset, stretch, 0, 0, 0);
|
||||||
|
@ -34,11 +37,15 @@ public class UnicornHorn {
|
||||||
.setAlpha(0.2f).box(0, 0, 0, 1, 3, 1, stretch + 0.8F);
|
.setAlpha(0.2f).box(0, 0, 0, 1, 3, 1, stretch + 0.8F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(float scale) {
|
@Override
|
||||||
|
public void renderPart(float scale) {
|
||||||
|
if (isVisible) {
|
||||||
horn.render(scale);
|
horn.render(scale);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void renderMagic(int tint, float scale) {
|
public void renderMagic(int tint, float scale) {
|
||||||
|
if (isVisible) {
|
||||||
glPushAttrib(24577);
|
glPushAttrib(24577);
|
||||||
disableTexture2D();
|
disableTexture2D();
|
||||||
disableLighting();
|
disableLighting();
|
||||||
|
@ -46,7 +53,6 @@ public class UnicornHorn {
|
||||||
blendFunc(GL_SRC_ALPHA, GL_ONE);
|
blendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||||
|
|
||||||
horn.postRender(scale);
|
horn.postRender(scale);
|
||||||
|
|
||||||
glow.setTint(tint).render(scale);
|
glow.setTint(tint).render(scale);
|
||||||
|
|
||||||
enableTexture2D();
|
enableTexture2D();
|
||||||
|
@ -54,4 +60,9 @@ public class UnicornHorn {
|
||||||
disableBlend();
|
disableBlend();
|
||||||
popAttrib();
|
popAttrib();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVisible(boolean visible) {
|
||||||
|
isVisible = visible;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ public class ModelUnicorn extends ModelEarthPony implements IModelUnicorn {
|
||||||
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
|
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||||
|
|
||||||
if (canCast()) {
|
if (canCast()) {
|
||||||
horn.render(scale);
|
horn.renderPart(scale);
|
||||||
if (isCasting()) {
|
if (isCasting()) {
|
||||||
horn.renderMagic(getMagicColor(), scale);
|
horn.renderMagic(getMagicColor(), scale);
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,20 @@ public class ModelUnicorn extends ModelEarthPony implements IModelUnicorn {
|
||||||
unicornArmLeft = new PonyRenderer(this, 40, 32).size(64, 64);
|
unicornArmLeft = new PonyRenderer(this, 40, 32).size(64, 64);
|
||||||
unicornArmRight = new PonyRenderer(this, 40, 32).size(64, 64);
|
unicornArmRight = new PonyRenderer(this, 40, 32).size(64, 64);
|
||||||
|
|
||||||
unicornArmLeft .box(FIRSTP_ARM_CENTRE_X, THIRDP_ARM_CENTRE_Y, THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch + .25F).around(5, yOffset + 2, 0);
|
int armLength = getArmLength();
|
||||||
unicornArmRight.box(FIRSTP_ARM_CENTRE_X, THIRDP_ARM_CENTRE_Y, THIRDP_ARM_CENTRE_Z, 4, 12, 4, stretch + .25F).around(-5, yOffset + 2, 0);
|
int armWidth = getArmWidth();
|
||||||
|
int armDepth = getArmDepth();
|
||||||
|
|
||||||
|
float rarmX = getLegRotationX();
|
||||||
|
float rarmY = getArmRotationY();
|
||||||
|
|
||||||
|
float armX = THIRDP_ARM_CENTRE_X;
|
||||||
|
float armY = THIRDP_ARM_CENTRE_Y;
|
||||||
|
float armZ = BODY_CENTRE_Z / 2 - 1 - armDepth;
|
||||||
|
|
||||||
|
unicornArmLeft .box(armX, armY, armZ, armWidth, armLength, armDepth, stretch + .25F)
|
||||||
|
.around(rarmX, yOffset + rarmY, 0);
|
||||||
|
unicornArmRight.box(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch + .25F)
|
||||||
|
.around(-rarmX, yOffset + rarmY, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,164 @@
|
||||||
|
package com.minelittlepony.model.ponies;
|
||||||
|
|
||||||
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.components.PonySnout;
|
||||||
|
import com.minelittlepony.render.PonyRenderer;
|
||||||
|
|
||||||
|
import static com.minelittlepony.model.PonyModelConstants.HEAD_CENTRE_X;
|
||||||
|
import static com.minelittlepony.model.PonyModelConstants.HEAD_CENTRE_Y;
|
||||||
|
import static com.minelittlepony.model.PonyModelConstants.HEAD_CENTRE_Z;
|
||||||
|
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_Z;
|
||||||
|
import static com.minelittlepony.model.PonyModelConstants.LEFT_WING_ROTATE_ANGLE_Z_SNEAK;
|
||||||
|
|
||||||
|
public class ModelEnderStallion extends ModelSkeletonPony {
|
||||||
|
|
||||||
|
public boolean isCarrying;
|
||||||
|
public boolean isAttacking;
|
||||||
|
|
||||||
|
public boolean isAlicorn;
|
||||||
|
public boolean isBoss;
|
||||||
|
|
||||||
|
private PonyRenderer leftHorn;
|
||||||
|
private PonyRenderer rightHorn;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLivingAnimations(EntityLivingBase entity, float move, float swing, float ticks) {
|
||||||
|
rightArmPose = isCarrying ? ArmPose.BLOCK : ArmPose.EMPTY;
|
||||||
|
leftArmPose = rightArmPose;
|
||||||
|
|
||||||
|
isAlicorn = entity.getUniqueID().getLeastSignificantBits() % 3 == 0;
|
||||||
|
isBoss = !isAlicorn && entity.getUniqueID().getLeastSignificantBits() % 20 == 0;
|
||||||
|
|
||||||
|
leftHorn.isHidden = rightHorn.isHidden = !isBoss;
|
||||||
|
horn.setVisible(!isBoss);
|
||||||
|
|
||||||
|
tail.setVisible(false);
|
||||||
|
snout.isHidden = true;
|
||||||
|
bipedLeftArmwear.isHidden = true;
|
||||||
|
bipedRightArmwear.isHidden = true;
|
||||||
|
|
||||||
|
bipedLeftLegwear.isHidden = true;
|
||||||
|
bipedRightLegwear.isHidden = true;
|
||||||
|
|
||||||
|
leftHorn.rotateAngleX = 0.5F;
|
||||||
|
rightHorn.rotateAngleX = 0.5F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVisible(boolean visible) {
|
||||||
|
super.setVisible(visible);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
|
||||||
|
if (isAttacking) {
|
||||||
|
bipedHead.rotationPointY -= 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||||
|
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
GlStateManager.translate(0, -1.15F, 0);
|
||||||
|
super.render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canCast() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canFly() {
|
||||||
|
return isAlicorn;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initHead(float yOffset, float stretch) {
|
||||||
|
bipedHead = new PonyRenderer(this, 0, 0)
|
||||||
|
.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
|
||||||
|
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
|
||||||
|
.box(-4, -4, -4, 8, 8, 8, stretch)
|
||||||
|
.tex(12, 16).box(-4, -6, 1, 2, 2, 2, stretch)
|
||||||
|
.flip().box( 2, -6, 1, 2, 2, 2, stretch);
|
||||||
|
|
||||||
|
leftHorn = ((PonyRenderer)bipedHead).child().tex(0, 52);
|
||||||
|
leftHorn.tex(0, 52)
|
||||||
|
.rotate(0.1F, 0, -0.8F)
|
||||||
|
.offset(-2, -10, -3)
|
||||||
|
.box(0, 0, 0, 2, 6, 2, stretch)
|
||||||
|
.child()
|
||||||
|
.rotate(0, 0, 0.9F)
|
||||||
|
.around(-3.9F, -6, 0.001F)
|
||||||
|
.box(0, 0, 0, 2, 6, 2, stretch);
|
||||||
|
|
||||||
|
rightHorn = ((PonyRenderer)bipedHead).child().tex(0, 52);
|
||||||
|
rightHorn.tex(8, 52)
|
||||||
|
.rotate(0.1F, 0, 0.8F)
|
||||||
|
.offset(0, -10, -3)
|
||||||
|
.box(0, 0, 0, 2, 6, 2, stretch)
|
||||||
|
.child()
|
||||||
|
.rotate(0, 0, -0.9F)
|
||||||
|
.around(3.9F, -6, 0.001F)
|
||||||
|
.box(0, 0, 0, 2, 6, 2, stretch);
|
||||||
|
|
||||||
|
bipedHeadwear = new PonyRenderer(this, 32, 0)
|
||||||
|
.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
|
||||||
|
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
|
||||||
|
.box(-4, -4, -4, 8, 8, 8, stretch - 0.5F);
|
||||||
|
|
||||||
|
snout = new PonySnout(this);
|
||||||
|
snout.init(yOffset, stretch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void rotateArmHolding(ModelRenderer arm, float direction, float swingProgress, float ticks) {
|
||||||
|
arm.rotateAngleX = -0.3707964F;
|
||||||
|
arm.rotateAngleX += 0.4F + MathHelper.sin(ticks * 0.067F) / 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void preInitLegs() {
|
||||||
|
bipedLeftArm = new ModelRenderer(this, 0, 20);
|
||||||
|
bipedRightArm = new ModelRenderer(this, 0, 20);
|
||||||
|
|
||||||
|
bipedLeftLeg = new ModelRenderer(this, 0, 20);
|
||||||
|
bipedRightLeg = new ModelRenderer(this, 0, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean wingsAreOpen() {
|
||||||
|
return isAttacking;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float getLegRotationX() {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float getArmRotationY() {
|
||||||
|
return 14;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getArmLength() {
|
||||||
|
return 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getWingRotationFactor(float ticks) {
|
||||||
|
return MathHelper.sin(ticks) + LEFT_WING_ROTATE_ANGLE_Z_SNEAK;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.minelittlepony.render.layer;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||||
|
import net.minecraft.entity.EntityLiving;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||||
|
|
||||||
|
public class LayerEyeGlow<T extends EntityLiving> extends AbstractPonyLayer<T> {
|
||||||
|
|
||||||
|
private final ResourceLocation eyeTexture;
|
||||||
|
|
||||||
|
public <V extends RenderLiving<T> & IGlowingRenderer> LayerEyeGlow(V renderer) {
|
||||||
|
super(renderer);
|
||||||
|
eyeTexture = renderer.getEyeTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doPonyRender(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||||
|
getRenderer().bindTexture(eyeTexture);
|
||||||
|
|
||||||
|
enableBlend();
|
||||||
|
disableAlpha();
|
||||||
|
blendFunc(SourceFactor.ONE, DestFactor.ONE);
|
||||||
|
|
||||||
|
disableLighting();
|
||||||
|
depthMask(!entity.isInvisible());
|
||||||
|
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 61680, 0);
|
||||||
|
enableLighting();
|
||||||
|
|
||||||
|
color(1, 1, 1, 1);
|
||||||
|
|
||||||
|
Minecraft.getMinecraft().entityRenderer.setupFogColor(true);
|
||||||
|
|
||||||
|
getMainModel().render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||||
|
|
||||||
|
Minecraft.getMinecraft().entityRenderer.setupFogColor(false);
|
||||||
|
|
||||||
|
((RenderLiving<T>)getRenderer()).setLightmap(entity);
|
||||||
|
|
||||||
|
depthMask(true);
|
||||||
|
|
||||||
|
blendFunc(SourceFactor.ONE, DestFactor.ZERO);
|
||||||
|
disableBlend();
|
||||||
|
enableAlpha();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IGlowingRenderer {
|
||||||
|
ResourceLocation getEyeTexture();
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,16 +20,23 @@ public class LayerHeldPonyItem<T extends EntityLivingBase> extends AbstractPonyL
|
||||||
super(livingPony);
|
super(livingPony);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected ItemStack getLeftItem(T entity) {
|
||||||
|
boolean main = entity.getPrimaryHand() == EnumHandSide.LEFT;
|
||||||
|
|
||||||
|
return main ? entity.getHeldItemMainhand() : entity.getHeldItemOffhand();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ItemStack getRightItem(T entity) {
|
||||||
|
boolean main = entity.getPrimaryHand() == EnumHandSide.RIGHT;
|
||||||
|
|
||||||
|
return main ? entity.getHeldItemMainhand() : entity.getHeldItemOffhand();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doPonyRender(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
public void doPonyRender(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||||
|
|
||||||
boolean mainRight = entity.getPrimaryHand() == EnumHandSide.RIGHT;
|
ItemStack left = getLeftItem(entity);
|
||||||
|
ItemStack right = getRightItem(entity);
|
||||||
ItemStack itemMain = entity.getHeldItemMainhand();
|
|
||||||
ItemStack itemOff = entity.getHeldItemOffhand();
|
|
||||||
|
|
||||||
ItemStack left = mainRight ? itemOff : itemMain;
|
|
||||||
ItemStack right = mainRight ? itemMain : itemOff;
|
|
||||||
|
|
||||||
if (!left.isEmpty() || !right.isEmpty()) {
|
if (!left.isEmpty() || !right.isEmpty()) {
|
||||||
ModelBase model = getMainModel();
|
ModelBase model = getMainModel();
|
||||||
|
|
|
@ -60,6 +60,12 @@ public enum MobRenderers implements Setting {
|
||||||
pony.switchRenderer(state, manager, EntityGuardian.class, new RenderPonyGuardian(manager));
|
pony.switchRenderer(state, manager, EntityGuardian.class, new RenderPonyGuardian(manager));
|
||||||
pony.switchRenderer(state, manager, EntityElderGuardian.class, new RenderPonyGuardian.Elder(manager));
|
pony.switchRenderer(state, manager, EntityElderGuardian.class, new RenderPonyGuardian.Elder(manager));
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
ENDERMEN {
|
||||||
|
@Override
|
||||||
|
public void register(boolean state, PonyRenderManager pony, RenderManager manager) {
|
||||||
|
pony.switchRenderer(state, manager, EntityEnderman.class, new RenderEnderStallion(manager));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.minelittlepony.render.ponies;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.PMAPI;
|
||||||
|
import com.minelittlepony.model.ponies.ModelEnderStallion;
|
||||||
|
import com.minelittlepony.render.RenderPonyMob;
|
||||||
|
import com.minelittlepony.render.layer.LayerEyeGlow;
|
||||||
|
import com.minelittlepony.render.layer.LayerHeldPonyItem;
|
||||||
|
import com.minelittlepony.render.layer.LayerHeldPonyItemMagical;
|
||||||
|
import com.minelittlepony.render.layer.LayerEyeGlow.IGlowingRenderer;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.client.renderer.entity.layers.LayerArrow;
|
||||||
|
import net.minecraft.entity.monster.EntityEnderman;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class RenderEnderStallion extends RenderPonyMob<EntityEnderman> implements IGlowingRenderer {
|
||||||
|
|
||||||
|
public static final ResourceLocation ENDERMAN = new ResourceLocation("minelittlepony", "textures/entity/enderman/enderman_pony.png");
|
||||||
|
private static final ResourceLocation EYES = new ResourceLocation("minelittlepony", "textures/entity/enderman/enderman_pony_eyes.png");
|
||||||
|
|
||||||
|
private final Random rnd = new Random();
|
||||||
|
|
||||||
|
public RenderEnderStallion(RenderManager manager) {
|
||||||
|
super(manager, PMAPI.enderman);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addLayers() {
|
||||||
|
addLayer(createItemHoldingLayer());
|
||||||
|
addLayer(new LayerArrow(this));
|
||||||
|
addLayer(new LayerEyeGlow<>(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected LayerHeldPonyItem<EntityEnderman> createItemHoldingLayer() {
|
||||||
|
return new LayerHeldPonyItemMagical<EntityEnderman>(this) {
|
||||||
|
@Override
|
||||||
|
protected ItemStack getRightItem(EntityEnderman entity) {
|
||||||
|
IBlockState state = entity.getHeldBlockState();
|
||||||
|
if (state == null) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
return new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ResourceLocation getTexture(EntityEnderman entity) {
|
||||||
|
return ENDERMAN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doRender(EntityEnderman entity, double x, double y, double z, float entityYaw, float partialTicks) {
|
||||||
|
ModelEnderStallion modelenderman = (ModelEnderStallion)getMainModel();
|
||||||
|
|
||||||
|
modelenderman.isCarrying = entity.getHeldBlockState() != null;
|
||||||
|
modelenderman.isAttacking = entity.isScreaming();
|
||||||
|
|
||||||
|
if (entity.isScreaming()) {
|
||||||
|
x += rnd.nextGaussian() / 50;
|
||||||
|
z += rnd.nextGaussian() / 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.doRender(entity, x, y, z, entityYaw, partialTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getEyeTexture() {
|
||||||
|
return EYES;
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 972 B |
Binary file not shown.
After Width: | Height: | Size: 113 B |
Loading…
Reference in a new issue