mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-18 18:44:22 +01:00
Change packages and use enums
This commit is contained in:
parent
658a48fe83
commit
8e173fc859
20 changed files with 160 additions and 164 deletions
|
@ -13,7 +13,7 @@ import com.minelittlepony.pony.data.PonySize;
|
||||||
import com.minelittlepony.render.AbstractPonyRenderer;
|
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;
|
||||||
import com.minelittlepony.transformation.PonyTransformation;
|
import com.minelittlepony.transform.PonyTransformation;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
import net.minecraft.client.model.ModelPlayer;
|
import net.minecraft.client.model.ModelPlayer;
|
||||||
|
@ -34,8 +34,7 @@ import static com.minelittlepony.model.PonyModelConstants.*;
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
|
|
||||||
public boolean isSleeping;
|
private boolean isSleeping;
|
||||||
|
|
||||||
private boolean isFlying;
|
private boolean isFlying;
|
||||||
private boolean isSwimming;
|
private boolean isSwimming;
|
||||||
private boolean headGear;
|
private boolean headGear;
|
||||||
|
@ -657,6 +656,16 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
return isFlying && canFly();
|
return isFlying && canFly();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSleeping() {
|
||||||
|
return isSleeping;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRiding() {
|
||||||
|
return isRiding;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSwimming() {
|
public boolean isSwimming() {
|
||||||
return isSwimming;
|
return isSwimming;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.minelittlepony.model.capabilities;
|
package com.minelittlepony.model.capabilities;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
|
||||||
public interface ICapitated {
|
public interface ICapitated {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.armour.PonyArmor;
|
import com.minelittlepony.model.armour.PonyArmor;
|
||||||
import com.minelittlepony.pony.data.IPonyData;
|
import com.minelittlepony.pony.data.IPonyData;
|
||||||
import com.minelittlepony.pony.data.PonyWearable;
|
import com.minelittlepony.pony.data.PonyWearable;
|
||||||
import com.minelittlepony.transformation.PonyTransformation;
|
import com.minelittlepony.transform.PonyTransformation;
|
||||||
|
|
||||||
public interface IModel extends ICapitated {
|
public interface IModel extends ICapitated {
|
||||||
|
|
||||||
|
@ -39,11 +39,21 @@ public interface IModel extends ICapitated {
|
||||||
*/
|
*/
|
||||||
boolean isFlying();
|
boolean isFlying();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this model is lying on a bed or bed-like object.
|
||||||
|
*/
|
||||||
|
boolean isSleeping();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this model is wimming underwater.
|
* Returns true if this model is wimming underwater.
|
||||||
*/
|
*/
|
||||||
boolean isSwimming();
|
boolean isSwimming();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this model is riding a boat, horse, or other animals.
|
||||||
|
*/
|
||||||
|
boolean isRiding();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if we're flying really fast.
|
* Returns true if we're flying really fast.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class ModelEarthPony extends AbstractPonyModel {
|
||||||
@Override
|
@Override
|
||||||
protected float getLegOutset() {
|
protected float getLegOutset() {
|
||||||
if (smallArms) {
|
if (smallArms) {
|
||||||
if (isSleeping) return 2.6f;
|
if (isSleeping()) return 2.6f;
|
||||||
if (isCrouching()) return 1;
|
if (isCrouching()) return 1;
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class ModelUnicorn extends ModelEarthPony implements IModelUnicorn {
|
||||||
EnumHandSide mainSide = getMainHand(entity);
|
EnumHandSide mainSide = getMainHand(entity);
|
||||||
|
|
||||||
if (canCast() && getArmPoseForSide(mainSide) != ArmPose.EMPTY) {
|
if (canCast() && getArmPoseForSide(mainSide) != ArmPose.EMPTY) {
|
||||||
if (swingProgress > -9990.0F && !isSleeping) {
|
if (swingProgress > -9990.0F && !isSleeping()) {
|
||||||
swingArm(getUnicornArmForSide(mainSide));
|
swingArm(getUnicornArmForSide(mainSide));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -87,7 +87,7 @@ public class ModelUnicorn extends ModelEarthPony implements IModelUnicorn {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void swingArms(float ticks) {
|
protected void swingArms(float ticks) {
|
||||||
if (isSleeping) return;
|
if (isSleeping()) return;
|
||||||
|
|
||||||
if (canCast()) {
|
if (canCast()) {
|
||||||
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class ModelSkeletonPony extends ModelMobPony {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float getLegOutset() {
|
protected float getLegOutset() {
|
||||||
if (isSleeping) return 2.6f;
|
if (isSleeping()) return 2.6f;
|
||||||
if (isCrouching()) return 0;
|
if (isCrouching()) return 0;
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package com.minelittlepony.pony.data;
|
package com.minelittlepony.pony.data;
|
||||||
|
|
||||||
import com.minelittlepony.MineLittlePony;
|
import com.minelittlepony.MineLittlePony;
|
||||||
import com.minelittlepony.transformation.*;
|
import com.minelittlepony.transform.PonyTransformation;
|
||||||
|
|
||||||
public enum PonySize implements ITriggerPixelMapped<PonySize> {
|
public enum PonySize implements ITriggerPixelMapped<PonySize> {
|
||||||
NORMAL(0, 0.4f, 1f, new TransformNormal()),
|
NORMAL(0, 0.4f, 1f, PonyTransformation.NORMAL),
|
||||||
LARGE(0xce3254, 0.5f, 0.8f, new TransformLarge()),
|
LARGE(0xce3254, 0.5f, 0.8f, PonyTransformation.LARGE),
|
||||||
FOAL(0xffbe53, 0.25f, 0.8f, new TransformFoal()),
|
FOAL(0xffbe53, 0.25f, 0.8f, PonyTransformation.FOAL),
|
||||||
TALL(0x534b76, 0.45f, 1f, new TransformTall());
|
TALL(0x534b76, 0.45f, 1f, PonyTransformation.TALL);
|
||||||
|
|
||||||
private int triggerValue;
|
private int triggerValue;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
@MethodsReturnNonnullByDefault
|
@MethodsReturnNonnullByDefault
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
package com.minelittlepony.transformation;
|
package com.minelittlepony.posture;
|
||||||
|
|
||||||
import mcp.MethodsReturnNonnullByDefault;
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
|
|
|
@ -19,7 +19,7 @@ import com.minelittlepony.render.layer.LayerPonyArmor;
|
||||||
import com.minelittlepony.render.layer.LayerPonyCape;
|
import com.minelittlepony.render.layer.LayerPonyCape;
|
||||||
import com.minelittlepony.render.layer.LayerPonyCustomHead;
|
import com.minelittlepony.render.layer.LayerPonyCustomHead;
|
||||||
import com.minelittlepony.render.layer.LayerPonyElytra;
|
import com.minelittlepony.render.layer.LayerPonyElytra;
|
||||||
import com.minelittlepony.transformation.PonyPosture;
|
import com.minelittlepony.transform.PonyPosture;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.minelittlepony.transformation;
|
package com.minelittlepony.transform;
|
||||||
|
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
|
|
|
@ -0,0 +1,114 @@
|
||||||
|
package com.minelittlepony.transform;
|
||||||
|
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.scale;
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.translate;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.BodyPart;
|
||||||
|
import com.minelittlepony.model.capabilities.IModel;
|
||||||
|
|
||||||
|
public enum PonyTransformation {
|
||||||
|
|
||||||
|
NORMAL {
|
||||||
|
@Override
|
||||||
|
public void transform(IModel model, BodyPart part) {
|
||||||
|
if (model.isSleeping()) translate(0, -0.61F, 0.25F);
|
||||||
|
|
||||||
|
switch (part) {
|
||||||
|
case NECK:
|
||||||
|
if (model.isCrouching()) translate(-0.03F, 0.03F, 0.1F);
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
LARGE {
|
||||||
|
@Override
|
||||||
|
public void transform(IModel model, BodyPart part) {
|
||||||
|
if (model.isSleeping()) translate(0, -0.98F, 0.2F);
|
||||||
|
|
||||||
|
switch (part) {
|
||||||
|
case NECK:
|
||||||
|
translate(0, -0.15F, -0.07F);
|
||||||
|
if (model.isCrouching()) translate(-0.03F, 0.16F, 0.07F);
|
||||||
|
break;
|
||||||
|
case HEAD:
|
||||||
|
translate(0, -0.17F, -0.04F);
|
||||||
|
if (model.isSleeping()) translate(0, 0, -0.1F);
|
||||||
|
if (model.isCrouching()) translate(0, 0.15F, 0);
|
||||||
|
break;
|
||||||
|
case BODY:
|
||||||
|
translate(0, -0.2F, -0.04F);
|
||||||
|
scale(1.15F, 1.2F, 1.2F);
|
||||||
|
break;
|
||||||
|
case TAIL:
|
||||||
|
translate(0, -0.2F, 0.08F);
|
||||||
|
break;
|
||||||
|
case LEGS:
|
||||||
|
translate(0, -0.14F, 0);
|
||||||
|
scale(1.15F, 1.12F, 1.15F);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
FOAL {
|
||||||
|
@Override
|
||||||
|
public void transform(IModel model, BodyPart part) {
|
||||||
|
if (model.isCrouching()) translate(0, -0.12F, 0);
|
||||||
|
if (model.isSleeping()) translate(0, -1.48F, 0.25F);
|
||||||
|
if (model.isRiding()) translate(0, -0.1F, 0);
|
||||||
|
|
||||||
|
switch (part) {
|
||||||
|
case NECK:
|
||||||
|
translate(0, 0.76F, 0);
|
||||||
|
scale(0.9F, 0.9F, 0.9F);
|
||||||
|
if (model.isCrouching()) translate(0, -0.01F, 0.15F);
|
||||||
|
break;
|
||||||
|
case HEAD:
|
||||||
|
translate(0, 0.76F, 0);
|
||||||
|
scale(0.9F, 0.9F, 0.9F);
|
||||||
|
break;
|
||||||
|
case BODY:
|
||||||
|
case TAIL:
|
||||||
|
translate(0, 0.76F, -0.04F);
|
||||||
|
scale(0.6F, 0.6F, 0.6F);
|
||||||
|
break;
|
||||||
|
case LEGS:
|
||||||
|
translate(0, 0.89F, 0);
|
||||||
|
scale(0.6F, 0.41F, 0.6F);
|
||||||
|
if (model.isCrouching()) translate(0, 0.12F, 0);
|
||||||
|
if (model.isGoingFast()) translate(0, -0.08F, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
TALL {
|
||||||
|
@Override
|
||||||
|
public void transform(IModel model, BodyPart part) {
|
||||||
|
if (model.isSleeping()) translate(0, -0.5F, 0.25F);
|
||||||
|
|
||||||
|
switch (part) {
|
||||||
|
case NECK:
|
||||||
|
translate(0, -0.09F, -0.01F);
|
||||||
|
scale(1, 1.1F, 1);
|
||||||
|
if (model.isCrouching()) translate(-0.02F, -0.02F, 0.1F);
|
||||||
|
break;
|
||||||
|
case HEAD:
|
||||||
|
translate(0, -0.15F, 0.01F);
|
||||||
|
if (model.isCrouching()) translate(0, 0.05F, 0);
|
||||||
|
break;
|
||||||
|
case BODY:
|
||||||
|
translate(0, -0.1F, 0);
|
||||||
|
break;
|
||||||
|
case TAIL:
|
||||||
|
translate(0, -0.1F, 0);
|
||||||
|
break;
|
||||||
|
case LEGS:
|
||||||
|
translate(0, -0.25F, 0.03F);
|
||||||
|
scale(1, 1.18F, 1);
|
||||||
|
if (model.isGoingFast()) translate(0, 0.05F, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public abstract void transform(IModel model, BodyPart part);
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.minelittlepony.transformation;
|
package com.minelittlepony.transform;
|
||||||
|
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.minelittlepony.transformation;
|
package com.minelittlepony.transform;
|
||||||
|
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.minelittlepony.transformation;
|
package com.minelittlepony.transform;
|
||||||
|
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
import com.minelittlepony.util.math.MathUtil;
|
import com.minelittlepony.util.math.MathUtil;
|
|
@ -0,0 +1,8 @@
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
package com.minelittlepony.transform;
|
||||||
|
|
||||||
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
package com.minelittlepony.transformation;
|
|
||||||
|
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
|
||||||
import com.minelittlepony.model.BodyPart;
|
|
||||||
|
|
||||||
public interface PonyTransformation {
|
|
||||||
void transform(AbstractPonyModel model, BodyPart part);
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
package com.minelittlepony.transformation;
|
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.scale;
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.translate;
|
|
||||||
|
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
|
||||||
import com.minelittlepony.model.BodyPart;
|
|
||||||
|
|
||||||
public class TransformFoal implements PonyTransformation {
|
|
||||||
@Override
|
|
||||||
public void transform(AbstractPonyModel model, BodyPart part) {
|
|
||||||
if (model.isCrouching()) translate(0, -0.12F, 0);
|
|
||||||
if (model.isSleeping) translate(0, -1.48F, 0.25F);
|
|
||||||
if (model.isRiding) translate(0, -0.1F, 0);
|
|
||||||
|
|
||||||
switch (part) {
|
|
||||||
case NECK:
|
|
||||||
translate(0, 0.76F, 0);
|
|
||||||
scale(0.9F, 0.9F, 0.9F);
|
|
||||||
if (model.isCrouching()) translate(0, -0.01F, 0.15F);
|
|
||||||
break;
|
|
||||||
case HEAD:
|
|
||||||
translate(0, 0.76F, 0);
|
|
||||||
scale(0.9F, 0.9F, 0.9F);
|
|
||||||
break;
|
|
||||||
case BODY:
|
|
||||||
case TAIL:
|
|
||||||
translate(0, 0.76F, -0.04F);
|
|
||||||
scale(0.6F, 0.6F, 0.6F);
|
|
||||||
break;
|
|
||||||
case LEGS:
|
|
||||||
translate(0, 0.89F, 0);
|
|
||||||
scale(0.6F, 0.41F, 0.6F);
|
|
||||||
if (model.isCrouching()) translate(0, 0.12F, 0);
|
|
||||||
if (model.isGoingFast()) translate(0, -0.08F, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package com.minelittlepony.transformation;
|
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.scale;
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.translate;
|
|
||||||
|
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
|
||||||
import com.minelittlepony.model.BodyPart;
|
|
||||||
|
|
||||||
public class TransformLarge implements PonyTransformation {
|
|
||||||
@Override
|
|
||||||
public void transform(AbstractPonyModel model, BodyPart part) {
|
|
||||||
if (model.isSleeping) translate(0, -0.98F, 0.2F);
|
|
||||||
|
|
||||||
switch (part) {
|
|
||||||
case NECK:
|
|
||||||
translate(0, -0.15F, -0.07F);
|
|
||||||
if (model.isCrouching()) translate(-0.03F, 0.16F, 0.07F);
|
|
||||||
break;
|
|
||||||
case HEAD:
|
|
||||||
translate(0, -0.17F, -0.04F);
|
|
||||||
if (model.isSleeping) translate(0, 0, -0.1F);
|
|
||||||
if (model.isCrouching()) translate(0, 0.15F, 0);
|
|
||||||
break;
|
|
||||||
case BODY:
|
|
||||||
translate(0, -0.2F, -0.04F);
|
|
||||||
scale(1.15F, 1.2F, 1.2F);
|
|
||||||
break;
|
|
||||||
case TAIL:
|
|
||||||
translate(0, -0.2F, 0.08F);
|
|
||||||
break;
|
|
||||||
case LEGS:
|
|
||||||
translate(0, -0.14F, 0);
|
|
||||||
scale(1.15F, 1.12F, 1.15F);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.minelittlepony.transformation;
|
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.translate;
|
|
||||||
|
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
|
||||||
import com.minelittlepony.model.BodyPart;
|
|
||||||
|
|
||||||
public class TransformNormal implements PonyTransformation {
|
|
||||||
@Override
|
|
||||||
public void transform(AbstractPonyModel model, BodyPart part) {
|
|
||||||
if (model.isSleeping) translate(0, -0.61F, 0.25F);
|
|
||||||
|
|
||||||
switch (part) {
|
|
||||||
case NECK:
|
|
||||||
if (model.isCrouching()) translate(-0.03F, 0.03F, 0.1F);
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package com.minelittlepony.transformation;
|
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.scale;
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.translate;
|
|
||||||
|
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
|
||||||
import com.minelittlepony.model.BodyPart;
|
|
||||||
|
|
||||||
public class TransformTall implements PonyTransformation {
|
|
||||||
@Override
|
|
||||||
public void transform(AbstractPonyModel model, BodyPart part) {
|
|
||||||
if (model.isSleeping) translate(0, -0.5F, 0.25F);
|
|
||||||
|
|
||||||
switch (part) {
|
|
||||||
case NECK:
|
|
||||||
translate(0, -0.09F, -0.01F);
|
|
||||||
scale(1, 1.1F, 1);
|
|
||||||
if (model.isCrouching()) translate(-0.02F, -0.02F, 0.1F);
|
|
||||||
break;
|
|
||||||
case HEAD:
|
|
||||||
translate(0, -0.15F, 0.01F);
|
|
||||||
if (model.isCrouching()) translate(0, 0.05F, 0);
|
|
||||||
break;
|
|
||||||
case BODY:
|
|
||||||
translate(0, -0.1F, 0);
|
|
||||||
break;
|
|
||||||
case TAIL:
|
|
||||||
translate(0, -0.1F, 0);
|
|
||||||
break;
|
|
||||||
case LEGS:
|
|
||||||
translate(0, -0.25F, 0.03F);
|
|
||||||
scale(1, 1.18F, 1);
|
|
||||||
if (model.isGoingFast()) translate(0, 0.05F, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue