mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-23 04:57:58 +01:00
Break ModelPlayerPony into each different race
This commit is contained in:
parent
6335e206d9
commit
12ec6c1302
33 changed files with 411 additions and 314 deletions
|
@ -2,18 +2,13 @@ package com.minelittlepony;
|
||||||
|
|
||||||
import com.mumfrey.liteloader.util.ModUtilities;
|
import com.mumfrey.liteloader.util.ModUtilities;
|
||||||
import net.minecraft.client.model.ModelBiped;
|
import net.minecraft.client.model.ModelBiped;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
|
||||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.client.ForgeHooksClient;
|
import net.minecraftforge.client.ForgeHooksClient;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proxy class for accessing forge fields and methods.
|
* Proxy class for accessing forge fields and methods.
|
||||||
|
@ -54,12 +49,4 @@ public class ForgeProxy {
|
||||||
return ForgeHooksClient.getArmorModel(entity, item, slot, def);
|
return ForgeHooksClient.getArmorModel(entity, item, slot, def);
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Optional<Function<RenderManager,LayerRenderer<EntityPlayer>>> createShoulderLayer() {
|
|
||||||
if (forgeLoaded) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
return Optional.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.util.Map;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.minelittlepony.hdskins.gui.EntityPonyModel;
|
import com.minelittlepony.hdskins.gui.EntityPonyModel;
|
||||||
import com.minelittlepony.hdskins.gui.RenderPonyModel;
|
import com.minelittlepony.hdskins.gui.RenderPonyModel;
|
||||||
import com.minelittlepony.model.PMAPI;
|
import com.minelittlepony.model.player.PlayerModels;
|
||||||
import com.minelittlepony.render.player.RenderPonyPlayer;
|
import com.minelittlepony.render.player.RenderPonyPlayer;
|
||||||
import com.minelittlepony.render.ponies.RenderPonyIllager;
|
import com.minelittlepony.render.ponies.RenderPonyIllager;
|
||||||
import com.minelittlepony.render.ponies.RenderPonyPigman;
|
import com.minelittlepony.render.ponies.RenderPonyPigman;
|
||||||
|
@ -52,9 +52,14 @@ public class PonyRenderManager {
|
||||||
// Preview on the select skin gui
|
// Preview on the select skin gui
|
||||||
ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(rm));
|
ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(rm));
|
||||||
|
|
||||||
new RenderPonyPlayer(rm, false, "pony", PMAPI.pony);
|
registerPlayerSkin(rm, PlayerModels.EARTH);
|
||||||
new RenderPonyPlayer(rm, true, "slimpony", PMAPI.ponySmall);
|
registerPlayerSkin(rm, PlayerModels.PEGASUS);
|
||||||
//TODO: Add skin types for each species? May require model break up.
|
registerPlayerSkin(rm, PlayerModels.ALICORN);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void registerPlayerSkin(RenderManager rm, PlayerModels playerModel) {
|
||||||
|
new RenderPonyPlayer(rm, false, playerModel.getId(false), playerModel.getModel(false));
|
||||||
|
new RenderPonyPlayer(rm, true, playerModel.getId(true), playerModel.getModel(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -36,6 +36,10 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> {
|
||||||
|
|
||||||
Pony thePony = MineLittlePony.getInstance().getManager().getPony(loc, playermodel.profile.getId());
|
Pony thePony = MineLittlePony.getInstance().getManager().getPony(loc, playermodel.profile.getId());
|
||||||
|
|
||||||
|
if (thePony.getRace(false).isHuman()) {
|
||||||
|
return super.getEntityModel(playermodel);
|
||||||
|
}
|
||||||
|
|
||||||
ModelWrapper pm = thePony.getModel(true);
|
ModelWrapper pm = thePony.getModel(true);
|
||||||
pm.apply(thePony.getMetadata());
|
pm.apply(thePony.getMetadata());
|
||||||
|
|
||||||
|
@ -44,7 +48,7 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LayerRenderer<EntityLivingBase> getElytraLayer() {
|
protected LayerRenderer<EntityLivingBase> getElytraLayer() {
|
||||||
return new AbstractPonyLayer<EntityPonyModel>(this, super.getElytraLayer()) {
|
return new AbstractPonyLayer<EntityPonyModel>(this) {
|
||||||
final PonyElytra modelElytra = new PonyElytra();
|
final PonyElytra modelElytra = new PonyElytra();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -74,24 +74,10 @@ public abstract class AbstractPonyModel extends ModelPlayer {
|
||||||
*/
|
*/
|
||||||
protected abstract void initPositions(float yOffset, float stretch);
|
protected abstract void initPositions(float yOffset, float stretch);
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setRotationAngles(float move, float swing, float age, float headYaw, float headPitch, float scale, Entity entity) {
|
|
||||||
if (doCancelRender()) {
|
|
||||||
super.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArmPose getArmPoseForSide(EnumHandSide side) {
|
public ArmPose getArmPoseForSide(EnumHandSide side) {
|
||||||
return side == EnumHandSide.RIGHT ? rightArmPose : leftArmPose;
|
return side == EnumHandSide.RIGHT ? rightArmPose : leftArmPose;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the default minecraft handling should be used.
|
|
||||||
*/
|
|
||||||
protected boolean doCancelRender() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this model is on the ground and crouching.
|
* Returns true if this model is on the ground and crouching.
|
||||||
*/
|
*/
|
||||||
|
@ -99,6 +85,13 @@ public abstract class AbstractPonyModel extends ModelPlayer {
|
||||||
return isSneak && !isFlying;
|
return isSneak && !isFlying;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks flying and speed conditions and sets rainboom to true if we're a species with wings and is going faaast.
|
||||||
|
*/
|
||||||
|
protected void checkRainboom(Entity entity, float swing) {
|
||||||
|
rainboom = isFlying(entity) && swing >= 0.9999F;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the given entity can and is flying, or has an elytra.
|
* Returns true if the given entity can and is flying, or has an elytra.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,27 +1,33 @@
|
||||||
package com.minelittlepony.model;
|
package com.minelittlepony.model;
|
||||||
|
|
||||||
import com.minelittlepony.model.ponies.ModelPlayerPony;
|
import com.minelittlepony.model.player.ModelAlicorn;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common class for all humanoid (ponioid?) non-player enemies.
|
* Common class for all humanoid (ponioid?) non-player enemies.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ModelMobPony extends ModelPlayerPony {
|
public class ModelMobPony extends ModelAlicorn {
|
||||||
|
|
||||||
public ModelMobPony() {
|
public ModelMobPony() {
|
||||||
super(false);
|
super(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void rotateLegs(float move, float swing, float tick, Entity entity) {
|
protected void adjustLegs(float move, float swing, float tick) {
|
||||||
super.rotateLegs(move, swing, tick, entity);
|
super.adjustLegs(move, swing, tick);
|
||||||
|
|
||||||
rotateRightArm(move, tick);
|
rotateRightArm(move, tick);
|
||||||
rotateLeftArm(move, tick);
|
rotateLeftArm(move, tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the angle is to the right?
|
||||||
|
*/
|
||||||
|
public boolean islookAngleRight(float move) {
|
||||||
|
return MathHelper.sin(move / 20f) < 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to update the left arm's final rotation.
|
* Called to update the left arm's final rotation.
|
||||||
* Subclasses may replace it with their own implementations.
|
* Subclasses may replace it with their own implementations.
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package com.minelittlepony.model;
|
package com.minelittlepony.model;
|
||||||
|
|
||||||
import com.minelittlepony.model.ponies.ModelHumanPlayer;
|
import com.minelittlepony.model.player.ModelAlicorn;
|
||||||
|
import com.minelittlepony.model.player.ModelEarthPony;
|
||||||
|
import com.minelittlepony.model.player.ModelPegasus;
|
||||||
import com.minelittlepony.model.ponies.ModelIllagerPony;
|
import com.minelittlepony.model.ponies.ModelIllagerPony;
|
||||||
import com.minelittlepony.model.ponies.ModelPlayerPony;
|
|
||||||
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.ModelZombiePony;
|
import com.minelittlepony.model.ponies.ModelZombiePony;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
@ -15,17 +17,23 @@ import java.lang.reflect.Field;
|
||||||
*/
|
*/
|
||||||
public final class PMAPI {
|
public final class PMAPI {
|
||||||
|
|
||||||
public static final ModelWrapper
|
public static final ModelWrapper pony = new ModelWrapper(new ModelAlicorn(false));
|
||||||
pony = new ModelWrapper(new ModelPlayerPony(false)),
|
public static final ModelWrapper ponySmall = new ModelWrapper(new ModelAlicorn(true));
|
||||||
ponySmall = new ModelWrapper(new ModelPlayerPony(true)),
|
|
||||||
|
|
||||||
human = new ModelWrapper(new ModelHumanPlayer(false)),
|
public static final ModelWrapper earthpony = new ModelWrapper(new ModelEarthPony(false));
|
||||||
humanSmall = new ModelWrapper(new ModelHumanPlayer(true)),
|
public static final ModelWrapper earthponySmall = new ModelWrapper(new ModelEarthPony(true));
|
||||||
|
|
||||||
zombie = new ModelWrapper(new ModelZombiePony()),
|
public static final ModelWrapper pegasus = new ModelWrapper(new ModelPegasus(false));
|
||||||
skeleton = new ModelWrapper(new ModelSkeletonPony()),
|
public static final ModelWrapper pegasusSmall = new ModelWrapper(new ModelPegasus(true));
|
||||||
villager = new ModelWrapper(new ModelVillagerPony()),
|
|
||||||
illager = new ModelWrapper(new ModelIllagerPony());
|
public static final ModelWrapper alicorn = new ModelWrapper(new ModelAlicorn(false));
|
||||||
|
public static final ModelWrapper alicornSmall = new ModelWrapper(new ModelAlicorn(true));
|
||||||
|
|
||||||
|
public static final ModelWrapper zombie = new ModelWrapper(new ModelZombiePony());
|
||||||
|
public static final ModelWrapper skeleton = new ModelWrapper(new ModelSkeletonPony());
|
||||||
|
public static final ModelWrapper villager = new ModelWrapper(new ModelVillagerPony());
|
||||||
|
public static final ModelWrapper illager = new ModelWrapper(new ModelIllagerPony());
|
||||||
|
public static final ModelWrapper witch = new ModelWrapper(new ModelWitchPony());
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
for (Field field : PMAPI.class.getFields()) {
|
for (Field field : PMAPI.class.getFields()) {
|
||||||
|
|
|
@ -179,14 +179,8 @@ public class ModelPonyArmor extends ModelMobPony {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void rotateLegs(float move, float swing, float tick, Entity entity) {
|
protected void setLegs(float move, float swing, float tick, Entity entity) {
|
||||||
super.rotateLegs(move, swing, tick, entity);
|
super.setLegs(move, swing, tick, entity);
|
||||||
syncLegs();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void adjustLegs() {
|
|
||||||
super.adjustLegs();
|
|
||||||
syncLegs();
|
syncLegs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.minelittlepony.model.armour;
|
package com.minelittlepony.model.armour;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Armour for skeleton ponies.
|
* Armour for skeleton ponies.
|
||||||
*
|
*
|
||||||
|
@ -9,9 +7,9 @@ import net.minecraft.entity.Entity;
|
||||||
public class ModelSkeletonPonyArmor extends ModelPonyArmor {
|
public class ModelSkeletonPonyArmor extends ModelPonyArmor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void rotateLegs(float move, float swing, float tick, Entity entity) {
|
protected void adjustLegs(float move, float swing, float tick) {
|
||||||
super.rotateLegs(move, swing, tick, entity);
|
|
||||||
aimBow(leftArmPose, rightArmPose, tick);
|
aimBow(leftArmPose, rightArmPose, tick);
|
||||||
|
super.adjustLegs(move, swing, tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,20 +1,13 @@
|
||||||
package com.minelittlepony.model.armour;
|
package com.minelittlepony.model.armour;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
|
||||||
|
|
||||||
public class ModelZombiePonyArmor extends ModelPonyArmor {
|
public class ModelZombiePonyArmor extends ModelPonyArmor {
|
||||||
|
|
||||||
private boolean isRight(float move) {
|
|
||||||
return MathHelper.sin(move / 20f) < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copied from ModelZombiePony
|
// Copied from ModelZombiePony
|
||||||
@Override
|
@Override
|
||||||
protected void rotateRightArm(float move, float tick) {
|
protected void rotateRightArm(float move, float tick) {
|
||||||
if (rightArmPose != ArmPose.EMPTY) return;
|
if (rightArmPose != ArmPose.EMPTY) return;
|
||||||
|
|
||||||
if (isRight(move)) {
|
if (islookAngleRight(move)) {
|
||||||
rotateArmHolding(bipedRightArm, 1, swingProgress, tick);
|
rotateArmHolding(bipedRightArm, 1, swingProgress, tick);
|
||||||
} else {
|
} else {
|
||||||
rotateArmHolding(bipedLeftArm, -1, swingProgress, tick);
|
rotateArmHolding(bipedLeftArm, -1, swingProgress, tick);
|
||||||
|
@ -29,10 +22,11 @@ public class ModelZombiePonyArmor extends ModelPonyArmor {
|
||||||
@Override
|
@Override
|
||||||
protected void fixSpecialRotationPoints(float move) {
|
protected void fixSpecialRotationPoints(float move) {
|
||||||
if (rightArmPose != ArmPose.EMPTY) return;
|
if (rightArmPose != ArmPose.EMPTY) return;
|
||||||
boolean right = isRight(move);
|
|
||||||
float xchange = right ? 0.5f : -0.5f;
|
|
||||||
ModelRenderer arm = right ? bipedRightArm : bipedLeftArm;
|
|
||||||
|
|
||||||
shiftRotationPoint(arm, xchange, 1.5f, 3);
|
if (islookAngleRight(move)) {
|
||||||
|
shiftRotationPoint(bipedRightArm, 0.5F, 1.5F, 3);
|
||||||
|
} else {
|
||||||
|
shiftRotationPoint(bipedLeftArm, -0.5F, 1.5F, 3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,23 +3,33 @@ package com.minelittlepony.model.armour;
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
import com.minelittlepony.pony.data.IPonyData;
|
import com.minelittlepony.pony.data.IPonyData;
|
||||||
|
|
||||||
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
|
|
||||||
public class PonyArmor {
|
public class PonyArmor {
|
||||||
|
|
||||||
public final AbstractPonyModel chestplate;
|
public final AbstractPonyModel chestplate;
|
||||||
public final AbstractPonyModel armour;
|
public final AbstractPonyModel leggings;
|
||||||
|
|
||||||
public PonyArmor(AbstractPonyModel chest, AbstractPonyModel body) {
|
public PonyArmor(AbstractPonyModel chest, AbstractPonyModel body) {
|
||||||
chestplate = chest;
|
chestplate = chest;
|
||||||
armour = body;
|
leggings = body;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void apply(IPonyData meta) {
|
public void apply(IPonyData meta) {
|
||||||
chestplate.metadata = meta;
|
chestplate.metadata = meta;
|
||||||
armour.metadata = meta;
|
leggings.metadata = meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
chestplate.init(0, 1);
|
chestplate.init(0, 1);
|
||||||
armour.init(0, 0.5f);
|
leggings.init(0, 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbstractPonyModel getArmorForSlot(EntityEquipmentSlot slot) {
|
||||||
|
if (slot == EntityEquipmentSlot.LEGS) {
|
||||||
|
return leggings;
|
||||||
|
}
|
||||||
|
|
||||||
|
return chestplate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.minelittlepony.model.capabilities;
|
||||||
|
|
||||||
|
public interface IModelPegasus {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.minelittlepony.model.capabilities;
|
||||||
|
|
||||||
|
import com.minelittlepony.render.PonyRenderer;
|
||||||
|
|
||||||
|
import net.minecraft.util.EnumHandSide;
|
||||||
|
|
||||||
|
public interface IModelUnicorn {
|
||||||
|
PonyRenderer getUnicornArmForSide(EnumHandSide side);
|
||||||
|
|
||||||
|
boolean isCasting();
|
||||||
|
}
|
152
src/main/java/com/minelittlepony/model/player/ModelAlicorn.java
Normal file
152
src/main/java/com/minelittlepony/model/player/ModelAlicorn.java
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
package com.minelittlepony.model.player;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.components.UnicornHorn;
|
||||||
|
import com.minelittlepony.render.PonyRenderer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.EnumHandSide;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.capabilities.IModelUnicorn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for both unicorns and alicorns since there's no logical way to keep them distinct and not duplicate stuff.
|
||||||
|
*/
|
||||||
|
public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
||||||
|
|
||||||
|
public PonyRenderer unicornArmRight;
|
||||||
|
public PonyRenderer unicornArmLeft;
|
||||||
|
|
||||||
|
public UnicornHorn horn;
|
||||||
|
|
||||||
|
public ModelAlicorn(boolean smallArms) {
|
||||||
|
super(smallArms);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(float yOffset, float stretch) {
|
||||||
|
super.init(yOffset, stretch);
|
||||||
|
horn = new UnicornHorn(this, yOffset, stretch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void rotateLegsOnGround(float move, float swing, float tick, Entity entity) {
|
||||||
|
super.rotateLegsOnGround(move, swing, tick, entity);
|
||||||
|
|
||||||
|
unicornArmRight.rotateAngleY = 0;
|
||||||
|
unicornArmLeft.rotateAngleY = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void adjustLegs(float move, float swing, float tick) {
|
||||||
|
super.adjustLegs(move, swing, tick);
|
||||||
|
|
||||||
|
unicornArmLeft.rotateAngleZ = 0;
|
||||||
|
unicornArmRight.rotateAngleZ = 0;
|
||||||
|
|
||||||
|
unicornArmLeft.rotateAngleX = 0;
|
||||||
|
unicornArmRight.rotateAngleX = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void holdItem(float swing) {
|
||||||
|
if (metadata.hasMagic()) {
|
||||||
|
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
|
||||||
|
|
||||||
|
alignArmForAction(unicornArmLeft, leftArmPose, both, swing);
|
||||||
|
alignArmForAction(unicornArmRight, rightArmPose, both, swing);
|
||||||
|
} else {
|
||||||
|
super.holdItem(swing);
|
||||||
|
}
|
||||||
|
|
||||||
|
horn.setUsingMagic(leftArmPose != ArmPose.EMPTY || rightArmPose != ArmPose.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void swingItem(Entity entity, float swingProgress) {
|
||||||
|
if (metadata.hasMagic()) {
|
||||||
|
if (swingProgress > -9990.0F && !isSleeping) {
|
||||||
|
EnumHandSide mainSide = getMainHand(entity);
|
||||||
|
|
||||||
|
if (getArmPoseForSide(mainSide) == ArmPose.EMPTY) return;
|
||||||
|
swingArm(getUnicornArmForSide(mainSide));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
super.swingItem(entity, swingProgress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void swingArms(float tick) {
|
||||||
|
if (isSleeping) return;
|
||||||
|
|
||||||
|
if (!metadata.hasMagic()) {
|
||||||
|
super.swingArms(tick);
|
||||||
|
} else {
|
||||||
|
float cos = MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
|
||||||
|
float sin = MathHelper.sin(tick * 0.067F) * 0.05F;
|
||||||
|
|
||||||
|
if (rightArmPose != ArmPose.EMPTY) {
|
||||||
|
unicornArmRight.rotateAngleZ += cos;
|
||||||
|
unicornArmRight.rotateAngleX += sin;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (leftArmPose != ArmPose.EMPTY) {
|
||||||
|
unicornArmLeft.rotateAngleZ += cos;
|
||||||
|
unicornArmLeft.rotateAngleX += sin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PonyRenderer getUnicornArmForSide(EnumHandSide side) {
|
||||||
|
return side == EnumHandSide.LEFT ? unicornArmLeft : unicornArmRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCasting() {
|
||||||
|
return metadata.hasMagic();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void sneakLegs() {
|
||||||
|
super.sneakLegs();
|
||||||
|
unicornArmRight.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
|
||||||
|
unicornArmLeft.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float tick) {
|
||||||
|
if (!metadata.hasMagic()) {
|
||||||
|
super.aimBow(leftArm, rightArm, tick);
|
||||||
|
} else if (leftArm == ArmPose.BOW_AND_ARROW || rightArm == ArmPose.BOW_AND_ARROW) {
|
||||||
|
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmRight, tick, true);
|
||||||
|
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmLeft, tick, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void renderHead(Entity entity, float move, float swing, float age, float headYaw, float headPitch, float scale) {
|
||||||
|
super.renderHead(entity, move, swing, age, headYaw, headPitch, scale);
|
||||||
|
horn.render(entity, move, swing, age, headYaw, headPitch, scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initLegTextures() {
|
||||||
|
super.initLegTextures();
|
||||||
|
unicornArmLeft = new PonyRenderer(this, 40, 32).size(64, 64);
|
||||||
|
unicornArmRight = new PonyRenderer(this, 40, 32).size(64, 64);
|
||||||
|
boxList.remove(unicornArmRight);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initLegPositions(float yOffset, float stretch) {
|
||||||
|
super.initLegPositions(yOffset, stretch);
|
||||||
|
float armY = THIRDP_ARM_CENTRE_Y - 6;
|
||||||
|
float armZ = THIRDP_ARM_CENTRE_Z - 2;
|
||||||
|
|
||||||
|
unicornArmLeft .box(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25f).around(5, yOffset + 2, 0);
|
||||||
|
unicornArmRight.box(FIRSTP_ARM_CENTRE_X - 2, armY, armZ, 4, 12, 4, stretch + .25f).around(-5, yOffset + 2, 0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,13 +1,11 @@
|
||||||
package com.minelittlepony.model.ponies;
|
package com.minelittlepony.model.player;
|
||||||
|
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
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.components.PegasusWings;
|
|
||||||
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.model.components.UnicornHorn;
|
|
||||||
import com.minelittlepony.render.PonyRenderer;
|
import com.minelittlepony.render.PonyRenderer;
|
||||||
import com.minelittlepony.render.plane.PlaneRenderer;
|
import com.minelittlepony.render.plane.PlaneRenderer;
|
||||||
|
|
||||||
|
@ -21,7 +19,7 @@ import static net.minecraft.client.renderer.GlStateManager.popMatrix;
|
||||||
import static net.minecraft.client.renderer.GlStateManager.pushMatrix;
|
import static net.minecraft.client.renderer.GlStateManager.pushMatrix;
|
||||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||||
|
|
||||||
public class ModelPlayerPony extends AbstractPonyModel {
|
public class ModelEarthPony extends AbstractPonyModel {
|
||||||
|
|
||||||
private final boolean smallArms;
|
private final boolean smallArms;
|
||||||
|
|
||||||
|
@ -30,15 +28,10 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
public PlaneRenderer upperTorso;
|
public PlaneRenderer upperTorso;
|
||||||
public PlaneRenderer neck;
|
public PlaneRenderer neck;
|
||||||
|
|
||||||
public PonyRenderer unicornArmRight;
|
|
||||||
public PonyRenderer unicornArmLeft;
|
|
||||||
|
|
||||||
public PonyTail tail;
|
public PonyTail tail;
|
||||||
public PonySnout snout;
|
public PonySnout snout;
|
||||||
public UnicornHorn horn;
|
|
||||||
public PegasusWings wings;
|
|
||||||
|
|
||||||
public ModelPlayerPony(boolean smallArms) {
|
public ModelEarthPony(boolean smallArms) {
|
||||||
super(smallArms);
|
super(smallArms);
|
||||||
this.smallArms = smallArms;
|
this.smallArms = smallArms;
|
||||||
}
|
}
|
||||||
|
@ -52,15 +45,12 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
public void init(float yOffset, float stretch) {
|
public void init(float yOffset, float stretch) {
|
||||||
super.init(yOffset, stretch);
|
super.init(yOffset, stretch);
|
||||||
snout = new PonySnout(this, yOffset, stretch);
|
snout = new PonySnout(this, yOffset, stretch);
|
||||||
horn = new UnicornHorn(this, yOffset, stretch);
|
|
||||||
wings = new PegasusWings(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);
|
||||||
|
|
||||||
checkRainboom(entity, swing);
|
|
||||||
rotateHead(headYaw, headPitch);
|
rotateHead(headYaw, headPitch);
|
||||||
|
|
||||||
float bodySwingRotation = 0;
|
float bodySwingRotation = 0;
|
||||||
|
@ -74,7 +64,7 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
holdItem(swing);
|
holdItem(swing);
|
||||||
swingItem(entity, swingProgress);
|
swingItem(entity, swingProgress);
|
||||||
|
|
||||||
if (isCrouching() && !rainboom) {
|
if (isCrouching()) {
|
||||||
adjustBody(BODY_ROTATE_ANGLE_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK);
|
adjustBody(BODY_ROTATE_ANGLE_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK);
|
||||||
sneakLegs();
|
sneakLegs();
|
||||||
setHead(0, 6, -2);
|
setHead(0, 6, -2);
|
||||||
|
@ -112,7 +102,6 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0;
|
bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0;
|
||||||
|
|
||||||
snout.setGender(metadata.getGender());
|
snout.setGender(metadata.getGender());
|
||||||
wings.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,13 +128,6 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
copyModelAngles(bipedBody, bipedBodyWear);
|
copyModelAngles(bipedBody, bipedBodyWear);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks flying and speed conditions and sets rainboom to true if we're a species with wings and is going faaast.
|
|
||||||
*/
|
|
||||||
protected void checkRainboom(Entity entity, float swing) {
|
|
||||||
rainboom = isFlying(entity) && swing >= 0.9999F;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the head rotation angle.
|
* Sets the head rotation angle.
|
||||||
*/
|
*/
|
||||||
|
@ -180,49 +162,46 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setLegs(float move, float swing, float tick, Entity entity) {
|
protected void setLegs(float move, float swing, float tick, Entity entity) {
|
||||||
rotateLegs(move, swing, tick, entity);
|
if (isFlying(entity)) {
|
||||||
adjustLegs();
|
rotateLegsInFlight(move, swing, tick, entity);
|
||||||
|
} else {
|
||||||
|
rotateLegsOnGround(move, swing, tick, entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
bipedLeftArm.rotateAngleZ = 0;
|
||||||
|
bipedRightArm.rotateAngleZ = 0;
|
||||||
|
|
||||||
|
adjustLegs(move, swing, tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void rotateLegs(float move, float swing, float tick, Entity entity) {
|
protected void rotateLegsInFlight(float move, float swing, float tick, Entity entity) {
|
||||||
float leftArm;
|
float armX = MathHelper.sin(-swing / 2);
|
||||||
float rightArm;
|
float legX = MathHelper.sin(swing / 2);
|
||||||
float leftLeg;
|
|
||||||
float rightLeg;
|
|
||||||
|
|
||||||
|
bipedLeftArm.rotateAngleX = armX;
|
||||||
|
bipedRightArm.rotateAngleX = armX;
|
||||||
|
|
||||||
if (isFlying(entity)) {
|
bipedLeftLeg.rotateAngleX = legX;
|
||||||
if (rainboom) {
|
bipedRightLeg.rotateAngleX = legX;
|
||||||
rightArm = leftArm = ROTATE_270;
|
|
||||||
rightLeg = leftLeg = ROTATE_90;
|
|
||||||
} else {
|
|
||||||
rightArm = leftArm = MathHelper.sin(-swing / 2);
|
|
||||||
rightLeg = leftLeg = MathHelper.sin(swing / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
bipedLeftLeg.rotateAngleY = bipedRightArm.rotateAngleY = 0.2F;
|
bipedLeftArm.rotateAngleY = -0.2F;
|
||||||
bipedLeftArm.rotateAngleY = bipedRightLeg.rotateAngleY = -0.2F;
|
bipedLeftLeg.rotateAngleY = 0.2F;
|
||||||
} else {
|
|
||||||
float pi = PI * (float) Math.pow(swing, 16);
|
|
||||||
|
|
||||||
float mve = move * 0.6662F; // magic number ahoy
|
bipedRightArm.rotateAngleY = 0.2F;
|
||||||
float srt = swing / 4;
|
bipedRightLeg.rotateAngleY = -0.2F;
|
||||||
|
}
|
||||||
|
|
||||||
leftArm = MathHelper.cos(mve + pi) * srt;
|
protected void rotateLegsOnGround(float move, float swing, float tick, Entity entity) {
|
||||||
rightArm = MathHelper.cos(mve + PI + pi / 2) * srt;
|
float pi = PI * (float) Math.pow(swing, 16);
|
||||||
|
|
||||||
leftLeg = MathHelper.cos(mve + PI - (pi * 0.4f)) * srt;
|
float mve = move * 0.6662F; // magic number ahoy
|
||||||
rightLeg = MathHelper.cos(mve + pi * 0.2f) * srt;
|
float srt = swing / 4;
|
||||||
|
|
||||||
bipedLeftArm.rotateAngleY = 0;
|
float leftArm = MathHelper.cos(mve + pi) * srt;
|
||||||
bipedRightArm.rotateAngleY = 0;
|
float rightArm = MathHelper.cos(mve + PI + pi / 2) * srt;
|
||||||
|
|
||||||
bipedLeftLeg.rotateAngleY = 0;
|
float leftLeg = MathHelper.cos(mve + PI - (pi * 0.4f)) * srt;
|
||||||
bipedRightLeg.rotateAngleY = 0;
|
float rightLeg = MathHelper.cos(mve + pi * 0.2f) * srt;
|
||||||
|
|
||||||
unicornArmRight.rotateAngleY = 0;
|
|
||||||
unicornArmLeft.rotateAngleY = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bipedLeftArm.rotateAngleX = leftArm;
|
bipedLeftArm.rotateAngleX = leftArm;
|
||||||
bipedRightArm.rotateAngleX = rightArm;
|
bipedRightArm.rotateAngleX = rightArm;
|
||||||
|
@ -230,14 +209,11 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
bipedLeftLeg.rotateAngleX = leftLeg;
|
bipedLeftLeg.rotateAngleX = leftLeg;
|
||||||
bipedRightLeg.rotateAngleX = rightLeg;
|
bipedRightLeg.rotateAngleX = rightLeg;
|
||||||
|
|
||||||
bipedLeftArm.rotateAngleZ = 0;
|
bipedLeftArm.rotateAngleY = 0;
|
||||||
bipedRightArm.rotateAngleZ = 0;
|
bipedRightArm.rotateAngleY = 0;
|
||||||
|
|
||||||
unicornArmLeft.rotateAngleZ = 0;
|
bipedLeftLeg.rotateAngleY = 0;
|
||||||
unicornArmRight.rotateAngleZ = 0;
|
bipedRightLeg.rotateAngleY = 0;
|
||||||
|
|
||||||
unicornArmLeft.rotateAngleX = 0;
|
|
||||||
unicornArmRight.rotateAngleX = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getLegOutset() {
|
private float getLegOutset() {
|
||||||
|
@ -246,11 +222,15 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void adjustLegs() {
|
protected float getLegSpread() {
|
||||||
|
return rainboom ? 2 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void adjustLegs(float move, float swing, float tick) {
|
||||||
float sin = MathHelper.sin(bipedBody.rotateAngleY) * 5;
|
float sin = MathHelper.sin(bipedBody.rotateAngleY) * 5;
|
||||||
float cos = MathHelper.cos(bipedBody.rotateAngleY) * 5;
|
float cos = MathHelper.cos(bipedBody.rotateAngleY) * 5;
|
||||||
|
|
||||||
float spread = rainboom ? 2 : 1;
|
float spread = getLegSpread();
|
||||||
|
|
||||||
bipedRightArm.rotationPointZ = spread + sin;
|
bipedRightArm.rotationPointZ = spread + sin;
|
||||||
|
|
||||||
|
@ -278,23 +258,14 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
bipedRightLeg.rotationPointZ = bipedLeftLeg.rotationPointZ = 10;
|
bipedRightLeg.rotationPointZ = bipedLeftLeg.rotationPointZ = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void holdItem(float swing) {
|
protected void holdItem(float swing) {
|
||||||
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
|
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
|
||||||
|
|
||||||
if (!rainboom && !metadata.hasMagic()) {
|
alignArmForAction(bipedLeftArm, leftArmPose, both, swing);
|
||||||
alignArmForAction(bipedLeftArm, leftArmPose, both, swing);
|
alignArmForAction(bipedRightArm, rightArmPose, both, swing);
|
||||||
alignArmForAction(bipedRightArm, rightArmPose, both, swing);
|
|
||||||
} else if (metadata.hasMagic()) {
|
|
||||||
alignArmForAction(unicornArmLeft, leftArmPose, both, swing);
|
|
||||||
alignArmForAction(unicornArmRight, rightArmPose, both, swing);
|
|
||||||
}
|
|
||||||
|
|
||||||
horn.setUsingMagic(leftArmPose != ArmPose.EMPTY || rightArmPose != ArmPose.EMPTY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void alignArmForAction(ModelRenderer arm, ArmPose pose, boolean both, float swing) {
|
protected void alignArmForAction(ModelRenderer arm, ArmPose pose, boolean both, float swing) {
|
||||||
switch (pose) {
|
switch (pose) {
|
||||||
case ITEM:
|
case ITEM:
|
||||||
float swag = 1;
|
float swag = 1;
|
||||||
|
@ -324,15 +295,11 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
|
|
||||||
if (getArmPoseForSide(mainSide) == ArmPose.EMPTY) return;
|
if (getArmPoseForSide(mainSide) == ArmPose.EMPTY) return;
|
||||||
|
|
||||||
if (metadata.hasMagic()) {
|
swingArm(getArmForSide(mainSide));
|
||||||
swingArm(getUnicornArmForSide(mainSide));
|
|
||||||
} else {
|
|
||||||
swingArm(getArmForSide(mainSide));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void swingArm(ModelRenderer arm) {
|
protected void swingArm(ModelRenderer arm) {
|
||||||
float swing = 1 - (float)Math.pow(1 - swingProgress, 3);
|
float swing = 1 - (float)Math.pow(1 - swingProgress, 3);
|
||||||
|
|
||||||
float deltaX = MathHelper.sin(swing * PI);
|
float deltaX = MathHelper.sin(swing * PI);
|
||||||
|
@ -352,24 +319,13 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
float sin = MathHelper.sin(tick * 0.067F) * 0.05F;
|
float sin = MathHelper.sin(tick * 0.067F) * 0.05F;
|
||||||
|
|
||||||
if (rightArmPose != ArmPose.EMPTY) {
|
if (rightArmPose != ArmPose.EMPTY) {
|
||||||
|
bipedRightArm.rotateAngleZ += cos;
|
||||||
if (metadata.hasMagic()) {
|
bipedRightArm.rotateAngleX += sin;
|
||||||
unicornArmRight.rotateAngleZ += cos;
|
|
||||||
unicornArmRight.rotateAngleX += sin;
|
|
||||||
} else {
|
|
||||||
bipedRightArm.rotateAngleZ += cos;
|
|
||||||
bipedRightArm.rotateAngleX += sin;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leftArmPose != ArmPose.EMPTY) {
|
if (leftArmPose != ArmPose.EMPTY) {
|
||||||
if (metadata.hasMagic()) {
|
bipedLeftArm.rotateAngleZ += cos;
|
||||||
unicornArmLeft.rotateAngleZ += cos;
|
bipedLeftArm.rotateAngleX += sin;
|
||||||
unicornArmLeft.rotateAngleX += sin;
|
|
||||||
} else {
|
|
||||||
bipedLeftArm.rotateAngleZ += cos;
|
|
||||||
bipedLeftArm.rotateAngleX += sin;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,17 +348,10 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
neck.setRotationPoint(NECK_ROT_X + rotateAngleX, rotationPointY, rotationPointZ);
|
neck.setRotationPoint(NECK_ROT_X + rotateAngleX, rotationPointY, rotationPointZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PonyRenderer getUnicornArmForSide(EnumHandSide side) {
|
|
||||||
return side == EnumHandSide.LEFT ? unicornArmLeft : unicornArmRight;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Aligns legs to a sneaky position.
|
* Aligns legs to a sneaky position.
|
||||||
*/
|
*/
|
||||||
protected void sneakLegs() {
|
protected void sneakLegs() {
|
||||||
unicornArmRight.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
|
|
||||||
unicornArmLeft.rotateAngleX += SNEAK_LEG_X_ROTATION_ADJUSTMENT;
|
|
||||||
|
|
||||||
bipedRightArm.rotateAngleX -= SNEAK_LEG_X_ROTATION_ADJUSTMENT;
|
bipedRightArm.rotateAngleX -= SNEAK_LEG_X_ROTATION_ADJUSTMENT;
|
||||||
bipedLeftArm.rotateAngleX -= SNEAK_LEG_X_ROTATION_ADJUSTMENT;
|
bipedLeftArm.rotateAngleX -= SNEAK_LEG_X_ROTATION_ADJUSTMENT;
|
||||||
|
|
||||||
|
@ -425,14 +374,8 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
|
|
||||||
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float tick) {
|
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float tick) {
|
||||||
if (leftArm == ArmPose.BOW_AND_ARROW || rightArm == ArmPose.BOW_AND_ARROW) {
|
if (leftArm == ArmPose.BOW_AND_ARROW || rightArm == ArmPose.BOW_AND_ARROW) {
|
||||||
|
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(bipedRightArm, tick, false);
|
||||||
if (metadata.hasMagic()) {
|
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(bipedLeftArm, tick, false);
|
||||||
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmRight, tick, true);
|
|
||||||
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmLeft, tick, false);
|
|
||||||
} else {
|
|
||||||
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(bipedRightArm, tick, false);
|
|
||||||
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(bipedLeftArm, tick, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,7 +419,6 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
bipedHead.render(scale);
|
bipedHead.render(scale);
|
||||||
bipedHeadwear.render(scale);
|
bipedHeadwear.render(scale);
|
||||||
bipedHead.postRender(scale);
|
bipedHead.postRender(scale);
|
||||||
horn.render(entity, move, swing, age, headYaw, headPitch, scale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void renderNeck() {
|
protected void renderNeck() {
|
||||||
|
@ -491,7 +433,6 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
}
|
}
|
||||||
upperTorso.render(scale);
|
upperTorso.render(scale);
|
||||||
bipedBody.postRender(scale);
|
bipedBody.postRender(scale);
|
||||||
wings.render(entity, move, swing, age, headYaw, headPitch, scale);
|
|
||||||
tail.render(metadata.getTail(), scale);
|
tail.render(metadata.getTail(), scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,11 +490,6 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
|
|
||||||
bipedLeftLegwear = new ModelRenderer(this, 0, 48);
|
bipedLeftLegwear = new ModelRenderer(this, 0, 48);
|
||||||
bipedRightLegwear = new ModelRenderer(this, 0, 32);
|
bipedRightLegwear = new ModelRenderer(this, 0, 32);
|
||||||
|
|
||||||
unicornArmLeft = new PonyRenderer(this, 40, 32).size(64, 64);
|
|
||||||
unicornArmRight = new PonyRenderer(this, 40, 32).size(64, 64);
|
|
||||||
|
|
||||||
boxList.remove(unicornArmRight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -672,9 +608,6 @@ public class ModelPlayerPony extends AbstractPonyModel {
|
||||||
bipedRightLegwear.addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f);
|
bipedRightLegwear.addBox(armX, armY, armZ, armWidth, 12, armDepth, stretch + 0.25f);
|
||||||
bipedRightLegwear.setRotationPoint(-3, yOffset, 0);
|
bipedRightLegwear.setRotationPoint(-3, yOffset, 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.minelittlepony.model.player;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.components.PegasusWings;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
|
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.capabilities.IModelPegasus;
|
||||||
|
|
||||||
|
public class ModelPegasus extends ModelEarthPony implements IModelPegasus {
|
||||||
|
public PegasusWings wings;
|
||||||
|
|
||||||
|
public ModelPegasus(boolean smallArms) {
|
||||||
|
super(smallArms);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(float yOffset, float stretch) {
|
||||||
|
super.init(yOffset, stretch);
|
||||||
|
wings = new PegasusWings(this, yOffset, stretch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCrouching() {
|
||||||
|
return super.isCrouching() && !rainboom;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRotationAngles(float move, float swing, float age, float headYaw, float headPitch, float scale, Entity entity) {
|
||||||
|
checkRainboom(entity, swing);
|
||||||
|
|
||||||
|
super.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
||||||
|
|
||||||
|
if (bipedCape != null) {
|
||||||
|
wings.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void rotateLegsInFlight(float move, float swing, float tick, Entity entity) {
|
||||||
|
if (rainboom) {
|
||||||
|
bipedLeftArm.rotateAngleX = ROTATE_270;
|
||||||
|
bipedRightArm.rotateAngleX = ROTATE_270;
|
||||||
|
|
||||||
|
bipedLeftLeg.rotateAngleX = ROTATE_90;
|
||||||
|
bipedRightLeg.rotateAngleX = ROTATE_90;
|
||||||
|
|
||||||
|
bipedLeftArm.rotateAngleY = -0.2F;
|
||||||
|
bipedLeftLeg.rotateAngleY = 0.2F;
|
||||||
|
|
||||||
|
bipedRightArm.rotateAngleY = 0.2F;
|
||||||
|
bipedRightLeg.rotateAngleY = -0.2F;
|
||||||
|
} else {
|
||||||
|
super.rotateLegsInFlight(move, swing, tick, entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void renderBody(Entity entity, float move, float swing, float age, float headYaw, float headPitch, float scale) {
|
||||||
|
super.renderBody(entity, move, swing, age, headYaw, headPitch, scale);
|
||||||
|
wings.render(entity, move, swing, age, headYaw, headPitch, scale);
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,8 +4,13 @@ import com.minelittlepony.model.PMAPI;
|
||||||
import com.minelittlepony.model.ModelWrapper;
|
import com.minelittlepony.model.ModelWrapper;
|
||||||
|
|
||||||
public enum PlayerModels {
|
public enum PlayerModels {
|
||||||
HUMAN("default", "slim", () -> PMAPI.human, () -> PMAPI.humanSmall),
|
/**
|
||||||
PONY("pony", "slimpony", () -> PMAPI.pony, () -> PMAPI.ponySmall);
|
* @deprecated Will be removed in a later revision
|
||||||
|
*/
|
||||||
|
@Deprecated HUMAN("default", "slim", () -> PMAPI.pony, () -> PMAPI.ponySmall),
|
||||||
|
EARTH("earthpony", "slimearthpony", () -> PMAPI.earthpony, () -> PMAPI.earthponySmall),
|
||||||
|
PEGASUS("pegasus", "slimpegasus", () -> PMAPI.pegasus, () -> PMAPI.pegasusSmall),
|
||||||
|
ALICORN("alicorn", "slimalicorn", () -> PMAPI.alicorn, () -> PMAPI.alicornSmall);
|
||||||
|
|
||||||
private final ModelResolver normal, slim;
|
private final ModelResolver normal, slim;
|
||||||
|
|
||||||
|
@ -20,11 +25,11 @@ public enum PlayerModels {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelWrapper getModel(boolean slim) {
|
public ModelWrapper getModel(boolean slim) {
|
||||||
return slim ? this.slim.resolve() : normal.resolve();
|
return slim ? this.slim.resolve() : normal.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId(boolean useSlimArms) {
|
public String getId(boolean useSlimArms) {
|
||||||
return useSlimArms ? slimKey : normalKey;
|
return useSlimArms ? slimKey : normalKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
package com.minelittlepony.model.ponies;
|
|
||||||
|
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
|
||||||
import com.minelittlepony.model.BodyPart;
|
|
||||||
import com.minelittlepony.model.armour.PonyArmor;
|
|
||||||
|
|
||||||
public class ModelHumanPlayer extends AbstractPonyModel {
|
|
||||||
|
|
||||||
public ModelHumanPlayer(boolean smallArms) {
|
|
||||||
super(smallArms);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean doCancelRender() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void transform(BodyPart part) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initTextures() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initPositions(float yOffset, float stretch) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PonyArmor createArmour() {
|
|
||||||
return new PonyArmor(new ModelHumanPlayer(false), new ModelHumanPlayer(false));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,12 +1,14 @@
|
||||||
package com.minelittlepony.model.ponies;
|
package com.minelittlepony.model.ponies;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.player.ModelAlicorn;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.monster.AbstractIllager;
|
import net.minecraft.entity.monster.AbstractIllager;
|
||||||
import net.minecraft.util.EnumHandSide;
|
import net.minecraft.util.EnumHandSide;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
public class ModelIllagerPony extends ModelPlayerPony {
|
public class ModelIllagerPony extends ModelAlicorn {
|
||||||
|
|
||||||
public ModelIllagerPony() {
|
public ModelIllagerPony() {
|
||||||
super(false);
|
super(false);
|
||||||
|
@ -14,8 +16,8 @@ public class ModelIllagerPony extends ModelPlayerPony {
|
||||||
|
|
||||||
@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);
|
||||||
|
|
||||||
AbstractIllager illager = (AbstractIllager) entity;
|
AbstractIllager illager = (AbstractIllager) entity;
|
||||||
AbstractIllager.IllagerArmPose pose = illager.getArmPose();
|
AbstractIllager.IllagerArmPose pose = illager.getArmPose();
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import com.minelittlepony.model.armour.PonyArmor;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelBiped;
|
import net.minecraft.client.model.ModelBiped;
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.monster.AbstractSkeleton;
|
import net.minecraft.entity.monster.AbstractSkeleton;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
|
@ -46,8 +45,8 @@ public class ModelSkeletonPony extends ModelMobPony {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void rotateLegs(float move, float swing, float ticks, Entity entity) {
|
protected void adjustLegs(float move, float swing, float ticks) {
|
||||||
super.rotateLegs(move, swing, ticks, entity);
|
super.adjustLegs(move, swing, ticks);
|
||||||
aimBow(leftArmPose, rightArmPose, ticks);
|
aimBow(leftArmPose, rightArmPose, ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,10 @@ import net.minecraft.entity.passive.EntityVillager;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||||
|
|
||||||
|
import com.minelittlepony.model.player.ModelAlicorn;
|
||||||
import com.minelittlepony.render.plane.PlaneRenderer;
|
import com.minelittlepony.render.plane.PlaneRenderer;
|
||||||
|
|
||||||
public class ModelVillagerPony extends ModelPlayerPony {
|
public class ModelVillagerPony extends ModelAlicorn {
|
||||||
|
|
||||||
public PlaneRenderer bag, apron, trinket;
|
public PlaneRenderer bag, apron, trinket;
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,6 @@ 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 net.minecraft.util.math.MathHelper;
|
|
||||||
|
|
||||||
public class ModelZombiePony extends ModelMobPony {
|
public class ModelZombiePony extends ModelMobPony {
|
||||||
|
|
||||||
public ModelZombiePony() {
|
public ModelZombiePony() {
|
||||||
|
@ -17,15 +15,11 @@ public class ModelZombiePony extends ModelMobPony {
|
||||||
return new PonyArmor(new ModelZombiePonyArmor(), new ModelZombiePonyArmor());
|
return new PonyArmor(new ModelZombiePonyArmor(), new ModelZombiePonyArmor());
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRight(float move) {
|
|
||||||
return MathHelper.sin(move / 20) < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void rotateRightArm(float move, float tick) {
|
protected void rotateRightArm(float move, float tick) {
|
||||||
if (rightArmPose != ArmPose.EMPTY) return;
|
if (rightArmPose != ArmPose.EMPTY) return;
|
||||||
|
|
||||||
if (isRight(move)) {
|
if (islookAngleRight(move)) {
|
||||||
rotateArmHolding(bipedRightArm, 1, swingProgress, tick);
|
rotateArmHolding(bipedRightArm, 1, swingProgress, tick);
|
||||||
} else {
|
} else {
|
||||||
rotateArmHolding(bipedLeftArm, -1, swingProgress, tick);
|
rotateArmHolding(bipedLeftArm, -1, swingProgress, tick);
|
||||||
|
@ -34,18 +28,17 @@ public class ModelZombiePony extends ModelMobPony {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void rotateLeftArm(float move, float tick) {
|
protected void rotateLeftArm(float move, float tick) {
|
||||||
|
// zombies are unidexterous.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void fixSpecialRotationPoints(float move) {
|
protected void fixSpecialRotationPoints(float move) {
|
||||||
if (rightArmPose != ArmPose.EMPTY) return;
|
if (rightArmPose != ArmPose.EMPTY) return;
|
||||||
|
|
||||||
if (isRight(move)) {
|
if (islookAngleRight(move)) {
|
||||||
shiftRotationPoint(bipedRightArm, 0.5F, 1.5F, 3);
|
shiftRotationPoint(bipedRightArm, 0.5F, 1.5F, 3);
|
||||||
} else {
|
} else {
|
||||||
shiftRotationPoint(bipedLeftArm, -0.5F, 1.5F, 3);
|
shiftRotationPoint(bipedLeftArm, -0.5F, 1.5F, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,15 @@ import com.minelittlepony.model.player.PlayerModels;
|
||||||
public enum PonyRace implements ITriggerPixelMapped<PonyRace> {
|
public enum PonyRace implements ITriggerPixelMapped<PonyRace> {
|
||||||
|
|
||||||
HUMAN(0, PlayerModels.HUMAN, false, false),
|
HUMAN(0, PlayerModels.HUMAN, false, false),
|
||||||
EARTH(0xf9b131, PlayerModels.PONY,false, false),
|
EARTH(0xf9b131, PlayerModels.EARTH,false, false),
|
||||||
PEGASUS(0x88caf0, PlayerModels.PONY, true, false),
|
PEGASUS(0x88caf0, PlayerModels.PEGASUS, true, false),
|
||||||
UNICORN(0xd19fe4, PlayerModels.PONY, false, true),
|
UNICORN(0xd19fe4, PlayerModels.ALICORN, false, true),
|
||||||
ALICORN(0xfef9fc, PlayerModels.PONY, true, true),
|
ALICORN(0xfef9fc, PlayerModels.ALICORN, true, true),
|
||||||
CHANGELING(0x282b29, PlayerModels.PONY, true, true),
|
CHANGELING(0x282b29, PlayerModels.ALICORN, true, true),
|
||||||
ZEBRA(0xd0cccf, PlayerModels.PONY, false, false),
|
ZEBRA(0xd0cccf, PlayerModels.EARTH, false, false),
|
||||||
REFORMED_CHANGELING(0xcaed5a, PlayerModels.PONY, true, true),
|
REFORMED_CHANGELING(0xcaed5a, PlayerModels.ALICORN, true, true),
|
||||||
GRIFFIN(0xae9145, PlayerModels.PONY, true, false),
|
GRIFFIN(0xae9145, PlayerModels.PEGASUS, true, false),
|
||||||
HIPPOGRIFF(0xd6ddac, PlayerModels.PONY, true, false);
|
HIPPOGRIFF(0xd6ddac, PlayerModels.PEGASUS, true, false);
|
||||||
|
|
||||||
private boolean wings;
|
private boolean wings;
|
||||||
private boolean horn;
|
private boolean horn;
|
||||||
|
|
|
@ -2,7 +2,6 @@ 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.ponies.ModelHumanPlayer;
|
|
||||||
|
|
||||||
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;
|
||||||
|
@ -12,24 +11,16 @@ import net.minecraft.entity.EntityLivingBase;
|
||||||
public abstract class AbstractPonyLayer<T extends EntityLivingBase> implements LayerRenderer<EntityLivingBase> {
|
public abstract class AbstractPonyLayer<T extends EntityLivingBase> implements LayerRenderer<EntityLivingBase> {
|
||||||
|
|
||||||
private final RenderLivingBase<T> renderer;
|
private final RenderLivingBase<T> renderer;
|
||||||
private LayerRenderer<? super T> layer;
|
|
||||||
|
|
||||||
public AbstractPonyLayer(RenderLivingBase<T> renderer, LayerRenderer<? super T> humanLayer) {
|
public AbstractPonyLayer(RenderLivingBase<T> renderer) {
|
||||||
this.renderer = renderer;
|
this.renderer = renderer;
|
||||||
this.layer = humanLayer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public final void doRenderLayer(EntityLivingBase entity, float move, float swing, float ticks, float age, float headYaw, float headPitch, float scale) {
|
public final void doRenderLayer(EntityLivingBase entity, float move, float swing, float ticks, float age, float headYaw, float headPitch, float scale) {
|
||||||
ModelBase model = renderer.getMainModel();
|
// render the pony layer
|
||||||
if (model instanceof ModelHumanPlayer) {
|
doPonyRender((T)entity, move, swing, ticks, age, headYaw, headPitch, scale);
|
||||||
// render the human layer
|
|
||||||
layer.doRenderLayer((T)entity, move, swing, ticks, age, headYaw, headPitch, scale);
|
|
||||||
} else {
|
|
||||||
// render the pony layer
|
|
||||||
doPonyRender((T)entity, move, swing, ticks, age, headYaw, headPitch, scale);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void doPonyRender(T entity, float move, float swing, float ticks, float age, float headYaw, float headPitch, float scale);
|
protected abstract void doPonyRender(T entity, float move, float swing, float ticks, float age, float headYaw, float headPitch, float scale);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.minelittlepony.render.layer;
|
package com.minelittlepony.render.layer;
|
||||||
|
|
||||||
import com.minelittlepony.ForgeProxy;
|
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
|
|
||||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
|
@ -8,12 +7,9 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.entity.Render;
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.client.renderer.entity.layers.LayerEntityOnShoulder;
|
|
||||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityList;
|
import net.minecraft.entity.EntityList;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -26,7 +22,7 @@ public class LayerEntityOnPonyShoulder extends AbstractPonyLayer<AbstractClientP
|
||||||
private EntityLivingBase rightEntity;
|
private EntityLivingBase rightEntity;
|
||||||
|
|
||||||
public LayerEntityOnPonyShoulder(RenderManager manager, RenderLivingBase<AbstractClientPlayer> renderer) {
|
public LayerEntityOnPonyShoulder(RenderManager manager, RenderLivingBase<AbstractClientPlayer> renderer) {
|
||||||
super(renderer, getForgeLayer(manager));
|
super(renderer);
|
||||||
renderManager = manager;
|
renderManager = manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,10 +78,4 @@ public class LayerEntityOnPonyShoulder extends AbstractPonyLayer<AbstractClientP
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static LayerRenderer<EntityPlayer> getForgeLayer(RenderManager manager) {
|
|
||||||
return ForgeProxy.createShoulderLayer()
|
|
||||||
.orElse(LayerEntityOnShoulder::new)
|
|
||||||
.apply(manager);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import net.minecraft.client.model.ModelBiped;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||||
import net.minecraft.client.renderer.entity.layers.LayerHeldItem;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumHandSide;
|
import net.minecraft.util.EnumHandSide;
|
||||||
|
@ -17,7 +16,7 @@ import static net.minecraft.client.renderer.GlStateManager.*;
|
||||||
public class LayerHeldPonyItem<T extends EntityLivingBase> extends AbstractPonyLayer<T> {
|
public class LayerHeldPonyItem<T extends EntityLivingBase> extends AbstractPonyLayer<T> {
|
||||||
|
|
||||||
public LayerHeldPonyItem(RenderLivingBase<T> livingPony) {
|
public LayerHeldPonyItem(RenderLivingBase<T> livingPony) {
|
||||||
super(livingPony, new LayerHeldItem(livingPony));
|
super(livingPony);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,8 +10,8 @@ import static net.minecraft.client.renderer.GlStateManager.translate;
|
||||||
import org.lwjgl.opengl.GL14;
|
import org.lwjgl.opengl.GL14;
|
||||||
|
|
||||||
import com.minelittlepony.ducks.IRenderItem;
|
import com.minelittlepony.ducks.IRenderItem;
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.capabilities.IModelUnicorn;
|
||||||
import com.minelittlepony.model.ponies.ModelPlayerPony;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
@ -30,7 +30,7 @@ public class LayerHeldPonyItemMagical<T extends EntityLivingBase> extends LayerH
|
||||||
|
|
||||||
private boolean isUnicorn() {
|
private boolean isUnicorn() {
|
||||||
ModelBase model = getMainModel();
|
ModelBase model = getMainModel();
|
||||||
return model instanceof AbstractPonyModel && ((AbstractPonyModel) model).metadata.hasMagic();
|
return model instanceof IModelUnicorn && ((IModelUnicorn) model).isCasting();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void preItemRender(T entity, ItemStack drop, TransformType transform, EnumHandSide hand) {
|
protected void preItemRender(T entity, ItemStack drop, TransformType transform, EnumHandSide hand) {
|
||||||
|
@ -52,7 +52,7 @@ public class LayerHeldPonyItemMagical<T extends EntityLivingBase> extends LayerH
|
||||||
*/
|
*/
|
||||||
protected void renderArm(EnumHandSide side) {
|
protected void renderArm(EnumHandSide side) {
|
||||||
if (isUnicorn()) {
|
if (isUnicorn()) {
|
||||||
this.<ModelPlayerPony>getMainModel().getUnicornArmForSide(side).postRender(0.0625F);
|
((IModelUnicorn)getMainModel()).getUnicornArmForSide(side).postRender(0.0625F);
|
||||||
} else {
|
} else {
|
||||||
super.renderArm(side);
|
super.renderArm(side);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||||
import net.minecraft.client.renderer.entity.layers.LayerBipedArmor;
|
|
||||||
import net.minecraft.client.resources.ResourcePackRepository;
|
import net.minecraft.client.resources.ResourcePackRepository;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
|
@ -39,7 +38,7 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
||||||
private ModelWrapper pony;
|
private ModelWrapper pony;
|
||||||
|
|
||||||
public LayerPonyArmor(RenderLivingBase<T> renderer) {
|
public LayerPonyArmor(RenderLivingBase<T> renderer) {
|
||||||
super(renderer, new LayerBipedArmor(renderer));
|
super(renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,12 +59,7 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
||||||
|
|
||||||
ItemArmor itemarmor = (ItemArmor) itemstack.getItem();
|
ItemArmor itemarmor = (ItemArmor) itemstack.getItem();
|
||||||
|
|
||||||
AbstractPonyModel modelbase;
|
AbstractPonyModel modelbase = pony.getArmor().getArmorForSlot(armorSlot);
|
||||||
if (armorSlot == EntityEquipmentSlot.LEGS) {
|
|
||||||
modelbase = pony.getArmor().armour;
|
|
||||||
} else {
|
|
||||||
modelbase = pony.getArmor().chestplate;
|
|
||||||
}
|
|
||||||
modelbase = getArmorModel(entity, itemstack, armorSlot, modelbase);
|
modelbase = getArmorModel(entity, itemstack, armorSlot, modelbase);
|
||||||
modelbase.setModelAttributes(pony.getModel());
|
modelbase.setModelAttributes(pony.getModel());
|
||||||
modelbase.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
modelbase.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
||||||
|
@ -167,7 +161,6 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderEnchantment(T entity, ModelBase model, float move, float swing, float ticks, float age, float headYaw, float headPitch, float scale) {
|
private void renderEnchantment(T entity, ModelBase model, float move, float swing, float ticks, float age, float headYaw, float headPitch, float scale) {
|
||||||
|
|
||||||
getRenderer().bindTexture(ENCHANTED_ITEM_GLINT_RES);
|
getRenderer().bindTexture(ENCHANTED_ITEM_GLINT_RES);
|
||||||
|
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
|
|
|
@ -6,8 +6,6 @@ import com.minelittlepony.model.ModelWrapper;
|
||||||
|
|
||||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
|
||||||
import net.minecraft.client.renderer.entity.layers.LayerCape;
|
|
||||||
import net.minecraft.entity.player.EnumPlayerModelParts;
|
import net.minecraft.entity.player.EnumPlayerModelParts;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
|
@ -21,7 +19,7 @@ import static com.minelittlepony.model.PonyModelConstants.PI;
|
||||||
public class LayerPonyCape extends AbstractPonyLayer<AbstractClientPlayer> {
|
public class LayerPonyCape extends AbstractPonyLayer<AbstractClientPlayer> {
|
||||||
|
|
||||||
public LayerPonyCape(RenderLivingBase<AbstractClientPlayer> entity) {
|
public LayerPonyCape(RenderLivingBase<AbstractClientPlayer> entity) {
|
||||||
super(entity, new LayerCape((RenderPlayer) entity));
|
super(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.minelittlepony.ducks.IRenderPony;
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.ModelWrapper;
|
import com.minelittlepony.model.ModelWrapper;
|
||||||
import com.minelittlepony.model.ponies.ModelPlayerPony;
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||||
|
@ -46,7 +45,7 @@ public class LayerPonyCustomHead<T extends EntityLivingBase> implements LayerRen
|
||||||
model.transform(BodyPart.HEAD);
|
model.transform(BodyPart.HEAD);
|
||||||
model.bipedHead.postRender(0.0625f);
|
model.bipedHead.postRender(0.0625f);
|
||||||
|
|
||||||
if (model instanceof ModelPlayerPony) {
|
if (model instanceof AbstractPonyModel) {
|
||||||
translate(0, 0.2F, 0);
|
translate(0, 0.2F, 0);
|
||||||
} else {
|
} else {
|
||||||
translate(0, 0, 0.15F);
|
translate(0, 0, 0.15F);
|
||||||
|
|
|
@ -7,7 +7,6 @@ import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||||
import net.minecraft.client.renderer.entity.layers.LayerArmorBase;
|
import net.minecraft.client.renderer.entity.layers.LayerArmorBase;
|
||||||
import net.minecraft.client.renderer.entity.layers.LayerElytra;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EnumPlayerModelParts;
|
import net.minecraft.entity.player.EnumPlayerModelParts;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
|
@ -23,7 +22,7 @@ public class LayerPonyElytra<T extends EntityLivingBase> extends AbstractPonyLay
|
||||||
private PonyElytra modelElytra = new PonyElytra();
|
private PonyElytra modelElytra = new PonyElytra();
|
||||||
|
|
||||||
public LayerPonyElytra(RenderLivingBase<T> rp) {
|
public LayerPonyElytra(RenderLivingBase<T> rp) {
|
||||||
super(rp, new LayerElytra(rp));
|
super(rp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,10 +5,9 @@ import com.minelittlepony.ducks.IRenderManager;
|
||||||
import com.minelittlepony.ducks.IRenderPony;
|
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.ponies.ModelPlayerPony;
|
|
||||||
import com.minelittlepony.pony.data.Pony;
|
import com.minelittlepony.pony.data.Pony;
|
||||||
import com.minelittlepony.render.layer.LayerEntityOnPonyShoulder;
|
import com.minelittlepony.render.layer.LayerEntityOnPonyShoulder;
|
||||||
import com.minelittlepony.render.layer.LayerHeldPonyItem;
|
import com.minelittlepony.render.layer.LayerHeldPonyItemMagical;
|
||||||
import com.minelittlepony.render.layer.LayerPonyArmor;
|
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;
|
||||||
|
@ -45,7 +44,7 @@ public abstract class RenderPonyBase extends RenderPlayer implements IRenderPony
|
||||||
|
|
||||||
protected void addExtraLayers() {
|
protected void addExtraLayers() {
|
||||||
addLayer(new LayerPonyArmor<>(this));
|
addLayer(new LayerPonyArmor<>(this));
|
||||||
addLayer(new LayerHeldPonyItem<>(this));
|
addLayer(new LayerHeldPonyItemMagical<>(this));
|
||||||
addLayer(new LayerArrow(this));
|
addLayer(new LayerArrow(this));
|
||||||
addLayer(new LayerPonyCape(this));
|
addLayer(new LayerPonyCape(this));
|
||||||
addLayer(new LayerPonyCustomHead<>(this));
|
addLayer(new LayerPonyCustomHead<>(this));
|
||||||
|
@ -108,7 +107,7 @@ public abstract class RenderPonyBase extends RenderPlayer implements IRenderPony
|
||||||
|
|
||||||
if (player.isEntityAlive() && player.isPlayerSleeping()) return;
|
if (player.isEntityAlive() && player.isPlayerSleeping()) return;
|
||||||
|
|
||||||
if (((ModelPlayerPony) ponyModel).rainboom) {
|
if (ponyModel.rainboom) {
|
||||||
transformPegasusFlight(player, motionX, motionY, motionZ, yaw, pitch, ticks);
|
transformPegasusFlight(player, motionX, motionY, motionZ, yaw, pitch, ticks);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,4 +51,6 @@ public class RenderPonyPlayer extends RenderPonyBase {
|
||||||
GlStateManager.rotate(ponyModel.motionPitch, 1, 0, 0);
|
GlStateManager.rotate(ponyModel.motionPitch, 1, 0, 0);
|
||||||
GlStateManager.rotate(((IPonyAnimationHolder)player).getStrafeAmount(ticks), 0, 0, 1);
|
GlStateManager.rotate(((IPonyAnimationHolder)player).getStrafeAmount(ticks), 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: transformSwimming()
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class RenderPonySkeleton<Skeleton extends AbstractSkeleton> extends Rende
|
||||||
addLayer(new LayerBipedArmor(this) {
|
addLayer(new LayerBipedArmor(this) {
|
||||||
@Override
|
@Override
|
||||||
protected void initArmor() {
|
protected void initArmor() {
|
||||||
modelLeggings = getPlayerModel().getArmor().armour;
|
modelLeggings = getPlayerModel().getArmor().leggings;
|
||||||
modelArmor = getPlayerModel().getArmor().chestplate;
|
modelArmor = getPlayerModel().getArmor().chestplate;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue