mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 22:38:00 +01:00
Move some things for consistency
This commit is contained in:
parent
7fbc14ca01
commit
4b27e432b9
15 changed files with 110 additions and 67 deletions
|
@ -60,11 +60,6 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
initPositions(yOffset, stretch);
|
initPositions(yOffset, stretch);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new pony armour to go with this model. Called on startup by a model wrapper.
|
|
||||||
*/
|
|
||||||
public abstract PonyArmor createArmour();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads texture values.
|
* Loads texture values.
|
||||||
*/
|
*/
|
||||||
|
@ -141,11 +136,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
arm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
|
arm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.1F;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Applies a transform particular to a certain body part.
|
|
||||||
*
|
|
||||||
* FIXME: Too long! Is there a better way to do this?
|
|
||||||
*/
|
|
||||||
public void transform(BodyPart part) {
|
public void transform(BodyPart part) {
|
||||||
if (isRiding) translate(0, -0.6F, -0.2F);
|
if (isRiding) translate(0, -0.6F, -0.2F);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.minelittlepony.model.armour;
|
package com.minelittlepony.model.armour;
|
||||||
|
|
||||||
|
import com.minelittlepony.render.AbstractPonyRenderer;
|
||||||
|
|
||||||
public class ModelZombiePonyArmor extends ModelPonyArmor {
|
public class ModelZombiePonyArmor extends ModelPonyArmor {
|
||||||
|
|
||||||
// Copied from ModelZombiePony
|
// Copied from ModelZombiePony
|
||||||
|
@ -24,9 +26,9 @@ public class ModelZombiePonyArmor extends ModelPonyArmor {
|
||||||
if (rightArmPose != ArmPose.EMPTY) return;
|
if (rightArmPose != ArmPose.EMPTY) return;
|
||||||
|
|
||||||
if (islookAngleRight(move)) {
|
if (islookAngleRight(move)) {
|
||||||
shiftRotationPoint(bipedRightArm, 0.5F, 1.5F, 3);
|
AbstractPonyRenderer.shiftRotationPoint(bipedRightArm, 0.5F, 1.5F, 3);
|
||||||
} else {
|
} else {
|
||||||
shiftRotationPoint(bipedLeftArm, -0.5F, 1.5F, 3);
|
AbstractPonyRenderer.shiftRotationPoint(bipedLeftArm, -0.5F, 1.5F, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,31 @@
|
||||||
package com.minelittlepony.model.capabilities;
|
package com.minelittlepony.model.capabilities;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.BodyPart;
|
||||||
|
import com.minelittlepony.model.armour.PonyArmor;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
public interface IModel {
|
public interface IModel {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up this model's initial values, like a constructor...
|
||||||
|
* @param yOffset YPosition for this model. Always 0.
|
||||||
|
* @param stretch Scaling factor for this model. Ranges above or below 0 (no change).
|
||||||
|
*/
|
||||||
|
void init(float yOffset, float stretch);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies a transform particular to a certain body part.
|
||||||
|
*/
|
||||||
|
void transform(BodyPart part);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new pony armour to go with this model. Called on startup by a model wrapper.
|
||||||
|
*/
|
||||||
|
PonyArmor createArmour();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this model is on the ground and crouching.
|
* Returns true if this model is on the ground and crouching.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,4 +17,9 @@ public interface IModelUnicorn extends IModel {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean isCasting();
|
boolean isCasting();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the preferred magic color for this mode.
|
||||||
|
*/
|
||||||
|
int getMagicColor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,13 @@ public class PonySnout {
|
||||||
private PlaneRenderer mare;
|
private PlaneRenderer mare;
|
||||||
private PlaneRenderer stallion;
|
private PlaneRenderer stallion;
|
||||||
|
|
||||||
public PonySnout(AbstractPonyModel pony, float yOffset, float stretch) {
|
public PonySnout(AbstractPonyModel pony) {
|
||||||
mare = new PlaneRenderer(pony);
|
mare = new PlaneRenderer(pony);
|
||||||
|
stallion = new PlaneRenderer(pony);
|
||||||
|
pony.bipedHead.addChild(stallion);
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
.tex(10, 14) .addBackPlane(-2, 2, -5, 4, 2, stretch)
|
.tex(10, 14) .addBackPlane(-2, 2, -5, 4, 2, stretch)
|
||||||
|
@ -26,9 +31,6 @@ public class PonySnout {
|
||||||
.tex(14, 14) .addEastPlane( 2, 2, -5, 2, 1, stretch)
|
.tex(14, 14) .addEastPlane( 2, 2, -5, 2, 1, stretch)
|
||||||
.tex(11, 12) .addWestPlane(-1, 1, -5, 1, 1, stretch)
|
.tex(11, 12) .addWestPlane(-1, 1, -5, 1, 1, stretch)
|
||||||
.tex(12, 12) .addEastPlane( 1, 1, -5, 1, 1, stretch);
|
.tex(12, 12) .addEastPlane( 1, 1, -5, 1, 1, stretch);
|
||||||
pony.bipedHead.addChild(mare);
|
|
||||||
|
|
||||||
stallion = new PlaneRenderer(pony);
|
|
||||||
stallion.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
|
stallion.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)
|
||||||
.tex(10, 13) .addBackPlane(-2, 1, -5, 4, 3, stretch)
|
.tex(10, 13) .addBackPlane(-2, 1, -5, 4, 3, stretch)
|
||||||
|
@ -36,7 +38,6 @@ public class PonySnout {
|
||||||
.tex(18, 7).addBottomPlane(-2, 4, -5, 4, 1, stretch)
|
.tex(18, 7).addBottomPlane(-2, 4, -5, 4, 1, stretch)
|
||||||
.tex(10, 13) .addWestPlane(-2, 1, -5, 3, 1, stretch)
|
.tex(10, 13) .addWestPlane(-2, 1, -5, 3, 1, stretch)
|
||||||
.tex(13, 13) .addEastPlane( 2, 1, -5, 3, 1, stretch);
|
.tex(13, 13) .addEastPlane( 2, 1, -5, 3, 1, stretch);
|
||||||
pony.bipedHead.addChild(stallion);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGender(PonyGender gender) {
|
public void setGender(PonyGender gender) {
|
||||||
|
|
|
@ -112,6 +112,11 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
||||||
return rightArmPose != ArmPose.EMPTY || leftArmPose != ArmPose.EMPTY;
|
return rightArmPose != ArmPose.EMPTY || leftArmPose != ArmPose.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMagicColor() {
|
||||||
|
return metadata.getGlowColor();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void sneakLegs() {
|
protected void sneakLegs() {
|
||||||
super.sneakLegs();
|
super.sneakLegs();
|
||||||
|
@ -136,7 +141,7 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
||||||
if (canCast()) {
|
if (canCast()) {
|
||||||
horn.render(scale);
|
horn.render(scale);
|
||||||
if (isCasting()) {
|
if (isCasting()) {
|
||||||
horn.renderMagic(metadata.getGlowColor(), scale);
|
horn.renderMagic(getMagicColor(), scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +151,6 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
||||||
super.initLegTextures();
|
super.initLegTextures();
|
||||||
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);
|
||||||
boxList.remove(unicornArmRight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -155,7 +159,7 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
||||||
float armY = THIRDP_ARM_CENTRE_Y - 6;
|
float armY = THIRDP_ARM_CENTRE_Y - 6;
|
||||||
float armZ = THIRDP_ARM_CENTRE_Z - 2;
|
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);
|
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);
|
unicornArmRight.box(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25F).around(-5, yOffset + 2, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.minelittlepony.model.armour.ModelPonyArmor;
|
||||||
import com.minelittlepony.model.armour.PonyArmor;
|
import com.minelittlepony.model.armour.PonyArmor;
|
||||||
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.render.AbstractPonyRenderer;
|
||||||
import com.minelittlepony.render.PonyRenderer;
|
import com.minelittlepony.render.PonyRenderer;
|
||||||
import com.minelittlepony.render.plane.PlaneRenderer;
|
import com.minelittlepony.render.plane.PlaneRenderer;
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ public class ModelEarthPony extends AbstractPonyModel {
|
||||||
|
|
||||||
private final boolean smallArms;
|
private final boolean smallArms;
|
||||||
|
|
||||||
public ModelRenderer bipedCape;
|
public PonyRenderer bipedCape;
|
||||||
|
|
||||||
public PlaneRenderer upperTorso;
|
public PlaneRenderer upperTorso;
|
||||||
public PlaneRenderer neck;
|
public PlaneRenderer neck;
|
||||||
|
@ -41,12 +42,6 @@ public class ModelEarthPony extends AbstractPonyModel {
|
||||||
return new PonyArmor(new ModelPonyArmor(), new ModelPonyArmor());
|
return new PonyArmor(new ModelPonyArmor(), new ModelPonyArmor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(float yOffset, float stretch) {
|
|
||||||
super.init(yOffset, stretch);
|
|
||||||
snout = new PonySnout(this, yOffset, stretch);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRotationAngles(float move, float swing, float age, float headYaw, float headPitch, float scale, Entity entity) {
|
public void setRotationAngles(float move, float swing, float age, float headYaw, float headPitch, float scale, Entity entity) {
|
||||||
super.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
super.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
||||||
|
@ -366,10 +361,10 @@ public class ModelEarthPony extends AbstractPonyModel {
|
||||||
|
|
||||||
setHead(1, 2, isSneak ? -1 : 1);
|
setHead(1, 2, isSneak ? -1 : 1);
|
||||||
|
|
||||||
shiftRotationPoint(bipedRightArm, 0, 2, 6);
|
AbstractPonyRenderer.shiftRotationPoint(bipedRightArm, 0, 2, 6);
|
||||||
shiftRotationPoint(bipedLeftArm, 0, 2, 6);
|
AbstractPonyRenderer.shiftRotationPoint(bipedLeftArm, 0, 2, 6);
|
||||||
shiftRotationPoint(bipedRightLeg, 0, 2, -8);
|
AbstractPonyRenderer.shiftRotationPoint(bipedRightLeg, 0, 2, -8);
|
||||||
shiftRotationPoint(bipedLeftLeg, 0, 2, -8);
|
AbstractPonyRenderer.shiftRotationPoint(bipedLeftLeg, 0, 2, -8);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float tick) {
|
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float tick) {
|
||||||
|
@ -383,7 +378,7 @@ public class ModelEarthPony extends AbstractPonyModel {
|
||||||
arm.rotateAngleX = ROTATE_270 + bipedHead.rotateAngleX;
|
arm.rotateAngleX = ROTATE_270 + bipedHead.rotateAngleX;
|
||||||
arm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
|
arm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
|
||||||
arm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F;
|
arm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F;
|
||||||
if (shift) shiftRotationPoint(arm, 0, 0, 1);
|
if (shift) AbstractPonyRenderer.shiftRotationPoint(arm, 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fixSpecialRotationPoints(float move) {
|
protected void fixSpecialRotationPoints(float move) {
|
||||||
|
@ -467,6 +462,7 @@ public class ModelEarthPony extends AbstractPonyModel {
|
||||||
bipedCape = new PonyRenderer(this, 0, 0).size(64, 32);
|
bipedCape = new PonyRenderer(this, 0, 0).size(64, 32);
|
||||||
bipedHead = new PonyRenderer(this, 0, 0);
|
bipedHead = new PonyRenderer(this, 0, 0);
|
||||||
bipedHeadwear = new PonyRenderer(this, 32, 0);
|
bipedHeadwear = new PonyRenderer(this, 32, 0);
|
||||||
|
snout = new PonySnout(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initBodyTextures() {
|
protected void initBodyTextures() {
|
||||||
|
@ -507,6 +503,8 @@ public class ModelEarthPony extends AbstractPonyModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initHeadPositions(float yOffset, float stretch) {
|
protected void initHeadPositions(float yOffset, float stretch) {
|
||||||
|
snout.init(yOffset, stretch);
|
||||||
|
|
||||||
bipedCape.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, stretch);
|
bipedCape.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, stretch);
|
||||||
|
|
||||||
((PonyRenderer)bipedHead).offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
|
((PonyRenderer)bipedHead).offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.minelittlepony.model.ponies;
|
||||||
import com.minelittlepony.model.ModelMobPony;
|
import com.minelittlepony.model.ModelMobPony;
|
||||||
import com.minelittlepony.model.armour.ModelZombiePonyArmor;
|
import com.minelittlepony.model.armour.ModelZombiePonyArmor;
|
||||||
import com.minelittlepony.model.armour.PonyArmor;
|
import com.minelittlepony.model.armour.PonyArmor;
|
||||||
|
import com.minelittlepony.render.AbstractPonyRenderer;
|
||||||
|
|
||||||
public class ModelZombiePony extends ModelMobPony {
|
public class ModelZombiePony extends ModelMobPony {
|
||||||
|
|
||||||
|
@ -32,9 +33,9 @@ public class ModelZombiePony extends ModelMobPony {
|
||||||
if (rightArmPose != ArmPose.EMPTY) return;
|
if (rightArmPose != ArmPose.EMPTY) return;
|
||||||
|
|
||||||
if (islookAngleRight(move)) {
|
if (islookAngleRight(move)) {
|
||||||
shiftRotationPoint(bipedRightArm, 0.5F, 1.5F, 3);
|
AbstractPonyRenderer.shiftRotationPoint(bipedRightArm, 0.5F, 1.5F, 3);
|
||||||
} else {
|
} else {
|
||||||
shiftRotationPoint(bipedLeftArm, -0.5F, 1.5F, 3);
|
AbstractPonyRenderer.shiftRotationPoint(bipedLeftArm, -0.5F, 1.5F, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,15 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
|
||||||
return (T) this;
|
return (T) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adjusts the rotation center of the given renderer by the given amounts in each direction.
|
||||||
|
*/
|
||||||
|
public static void shiftRotationPoint(ModelRenderer renderer, float x, float y, float z) {
|
||||||
|
renderer.rotationPointX += x;
|
||||||
|
renderer.rotationPointY += y;
|
||||||
|
renderer.rotationPointZ += z;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets this renderer's rotation angles.
|
* Sets this renderer's rotation angles.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,13 +2,13 @@ package com.minelittlepony.render;
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.color;
|
import static net.minecraft.client.renderer.GlStateManager.color;
|
||||||
|
|
||||||
|
import com.minelittlepony.util.coordinates.Color;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
|
|
||||||
public class HornGlowRenderer extends AbstractPonyRenderer<HornGlowRenderer> {
|
public class HornGlowRenderer extends AbstractPonyRenderer<HornGlowRenderer> {
|
||||||
|
|
||||||
float red;
|
int tint;
|
||||||
float green;
|
|
||||||
float blue;
|
|
||||||
float alpha = 1;
|
float alpha = 1;
|
||||||
|
|
||||||
public HornGlowRenderer(ModelBase model, int x, int y) {
|
public HornGlowRenderer(ModelBase model, int x, int y) {
|
||||||
|
@ -22,15 +22,13 @@ public class HornGlowRenderer extends AbstractPonyRenderer<HornGlowRenderer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public HornGlowRenderer setTint(int tint) {
|
public HornGlowRenderer setTint(int tint) {
|
||||||
red = (tint >> 16 & 255) / 255.0F;
|
this.tint = tint;
|
||||||
green = (tint >> 8 & 255) / 255.0F;
|
|
||||||
blue = (tint & 255) / 255.0F;
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyTint(float alpha) {
|
public void applyTint(float alpha) {
|
||||||
color(red, green, blue, alpha);
|
Color.glColor(tint, alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.minelittlepony.render.layer;
|
||||||
|
|
||||||
import com.minelittlepony.ducks.IRenderPony;
|
import com.minelittlepony.ducks.IRenderPony;
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
|
import com.minelittlepony.model.capabilities.IModel;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||||
|
@ -33,8 +34,9 @@ public abstract class AbstractPonyLayer<T extends EntityLivingBase> implements L
|
||||||
return ((IRenderPony) getRenderer()).getPlayerModel().getModel();
|
return ((IRenderPony) getRenderer()).getPlayerModel().getModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractPonyModel getPonyModel() {
|
@SuppressWarnings("unchecked")
|
||||||
return getMainModel();
|
public <M extends IModel> M getPonyModel() {
|
||||||
|
return (M)getMainModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -7,13 +7,11 @@ import static net.minecraft.client.renderer.GlStateManager.pushMatrix;
|
||||||
import static net.minecraft.client.renderer.GlStateManager.scale;
|
import static net.minecraft.client.renderer.GlStateManager.scale;
|
||||||
import static net.minecraft.client.renderer.GlStateManager.translate;
|
import static net.minecraft.client.renderer.GlStateManager.translate;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL14;
|
|
||||||
|
|
||||||
import com.minelittlepony.ducks.IRenderItem;
|
import com.minelittlepony.ducks.IRenderItem;
|
||||||
import com.minelittlepony.model.capabilities.IModelUnicorn;
|
import com.minelittlepony.model.capabilities.IModelUnicorn;
|
||||||
|
import com.minelittlepony.util.coordinates.Color;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.ModelBase;
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.RenderItem;
|
import net.minecraft.client.renderer.RenderItem;
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||||
|
@ -29,10 +27,10 @@ public class LayerHeldPonyItemMagical<T extends EntityLivingBase> extends LayerH
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isUnicorn() {
|
protected boolean isUnicorn() {
|
||||||
ModelBase model = getMainModel();
|
return getMainModel() instanceof IModelUnicorn && this.<IModelUnicorn>getPonyModel().canCast();
|
||||||
return model instanceof IModelUnicorn && ((IModelUnicorn) model).canCast();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void preItemRender(T entity, ItemStack drop, TransformType transform, EnumHandSide hand) {
|
protected void preItemRender(T entity, ItemStack drop, TransformType transform, EnumHandSide hand) {
|
||||||
if (isUnicorn()) {
|
if (isUnicorn()) {
|
||||||
GlStateManager.translate(hand == EnumHandSide.LEFT ? -0.6F : 0.1F, 1, -0.5F);
|
GlStateManager.translate(hand == EnumHandSide.LEFT ? -0.6F : 0.1F, 1, -0.5F);
|
||||||
|
@ -41,18 +39,17 @@ public class LayerHeldPonyItemMagical<T extends EntityLivingBase> extends LayerH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void postItemRender(T entity, ItemStack drop, TransformType transform, EnumHandSide hand) {
|
protected void postItemRender(T entity, ItemStack drop, TransformType transform, EnumHandSide hand) {
|
||||||
if (isUnicorn()) {
|
if (isUnicorn()) {
|
||||||
renderItemGlow(entity, drop, transform, hand, getPonyModel().metadata.getGlowColor());
|
renderItemGlow(entity, drop, transform, hand, this.<IModelUnicorn>getPonyModel().getMagicColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Renders the main arm
|
|
||||||
*/
|
|
||||||
protected void renderArm(EnumHandSide side) {
|
protected void renderArm(EnumHandSide side) {
|
||||||
if (isUnicorn()) {
|
if (isUnicorn()) {
|
||||||
((IModelUnicorn)getMainModel()).getUnicornArmForSide(side).postRender(0.0625F);
|
this.<IModelUnicorn>getPonyModel().getUnicornArmForSide(side).postRender(0.0625F);
|
||||||
} else {
|
} else {
|
||||||
super.renderArm(side);
|
super.renderArm(side);
|
||||||
}
|
}
|
||||||
|
@ -63,15 +60,10 @@ public class LayerHeldPonyItemMagical<T extends EntityLivingBase> extends LayerH
|
||||||
// enchantments mess up the rendering
|
// enchantments mess up the rendering
|
||||||
drop = stackWithoutEnchantment(drop);
|
drop = stackWithoutEnchantment(drop);
|
||||||
|
|
||||||
float red = (glowColor >> 16 & 255) / 255.0F;
|
|
||||||
float green = (glowColor >> 8 & 255) / 255.0F;
|
|
||||||
float blue = (glowColor & 255) / 255.0F;
|
|
||||||
float alpha = 0.2F;
|
|
||||||
|
|
||||||
pushMatrix();
|
pushMatrix();
|
||||||
disableLighting();
|
disableLighting();
|
||||||
|
|
||||||
GL14.glBlendColor(red, green, blue, alpha);
|
Color.glColor(glowColor, 0.2F);
|
||||||
|
|
||||||
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
|
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
|
||||||
((IRenderItem) renderItem).useTransparency(true);
|
((IRenderItem) renderItem).useTransparency(true);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.minelittlepony.ducks.IRenderPony;
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
import com.minelittlepony.model.ModelWrapper;
|
import com.minelittlepony.model.ModelWrapper;
|
||||||
import com.minelittlepony.model.armour.ModelPonyArmor;
|
import com.minelittlepony.model.armour.ModelPonyArmor;
|
||||||
|
import com.minelittlepony.util.coordinates.Color;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
|
@ -69,11 +70,7 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
||||||
|
|
||||||
getRenderer().bindTexture(armors.getFirst());
|
getRenderer().bindTexture(armors.getFirst());
|
||||||
if (itemarmor.getArmorMaterial() == ArmorMaterial.LEATHER) {
|
if (itemarmor.getArmorMaterial() == ArmorMaterial.LEATHER) {
|
||||||
int color = itemarmor.getColor(itemstack);
|
Color.glColor(itemarmor.getColor(itemstack), 1);
|
||||||
float r = (color >> 16 & 255) / 255.0F;
|
|
||||||
float g = (color >> 8 & 255) / 255.0F;
|
|
||||||
float b = (color & 255) / 255.0F;
|
|
||||||
GlStateManager.color(r, g, b, 1);
|
|
||||||
modelbase.render(entity, move, swing, age, headYaw, headPitch, scale);
|
modelbase.render(entity, move, swing, age, headYaw, headPitch, scale);
|
||||||
armors = getArmorTexture(entity, itemstack, armorSlot, "overlay");
|
armors = getArmorTexture(entity, itemstack, armorSlot, "overlay");
|
||||||
getRenderer().bindTexture(armors.getFirst());
|
getRenderer().bindTexture(armors.getFirst());
|
||||||
|
|
|
@ -63,10 +63,10 @@ public class ModelPlane extends Box<PlaneRenderer> {
|
||||||
if (face == Face.DOWN) {
|
if (face == Face.DOWN) {
|
||||||
quad = quad(textureX, w, textureY, d, eus, wus, wun, eun);
|
quad = quad(textureX, w, textureY, d, eus, wus, wun, eun);
|
||||||
}
|
}
|
||||||
if (face == Face.SOUTH) { // East/Left (was South)
|
if (face == Face.SOUTH) {
|
||||||
quad = quad(textureX, w, textureY, h, eds, wds, wus, eus);
|
quad = quad(textureX, w, textureY, h, eds, wds, wus, eus);
|
||||||
}
|
}
|
||||||
if (face == Face.NORTH) { // West/Right (was North)
|
if (face == Face.NORTH) {
|
||||||
quad = quad(textureX, w, textureY, h, wdn, edn, eun, wun);
|
quad = quad(textureX, w, textureY, h, wdn, edn, eun, wun);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
21
src/main/java/com/minelittlepony/util/coordinates/Color.java
Normal file
21
src/main/java/com/minelittlepony/util/coordinates/Color.java
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package com.minelittlepony.util.coordinates;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
|
||||||
|
public interface Color {
|
||||||
|
public static float r(int color) {
|
||||||
|
return (color >> 16 & 255) / 255F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float g(int color) {
|
||||||
|
return (color >> 8 & 255) / 255F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float b(int color) {
|
||||||
|
return (color & 255) / 255F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void glColor(int color, float alpha) {
|
||||||
|
GlStateManager.color(Color.r(color), Color.g(color), Color.b(color), alpha);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue