mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
One last codestyle commit to clean stuff up I missed, correct and document some names, and add TODO items for everything that needs to be done.
This commit is contained in:
parent
4513f1c443
commit
df5d18d350
48 changed files with 440 additions and 256 deletions
|
@ -23,13 +23,11 @@ public class MineLittlePony {
|
|||
|
||||
public static final Logger logger = LogManager.getLogger("MineLittlePony");
|
||||
|
||||
public static final String
|
||||
MOD_NAME = "Mine Little Pony",
|
||||
MOD_VERSION = "@VERSION@";
|
||||
public static final String MOD_NAME = "Mine Little Pony";
|
||||
public static final String MOD_VERSION = "@VERSION@";
|
||||
|
||||
private static final String
|
||||
SKIN_SERVER_URL = "minelpskins.voxelmodpack.com",
|
||||
GATEWAY_URL = "minelpskinmanager.voxelmodpack.com";
|
||||
private static final String SKIN_SERVER_URL = "minelpskins.voxelmodpack.com";
|
||||
private static final String GATEWAY_URL = "minelpskinmanager.voxelmodpack.com";
|
||||
|
||||
private static final KeyBinding SETTINGS_GUI = new KeyBinding("Settings", Keyboard.KEY_F9, "Mine Little Pony");
|
||||
|
||||
|
|
|
@ -143,8 +143,8 @@ public class PonyManager implements IResourceManagerReloadListener {
|
|||
/**
|
||||
* De-registers a pony from the cache.
|
||||
*/
|
||||
public Pony removePony(ResourceLocation location) {
|
||||
return poniesCache.remove(location);
|
||||
public Pony removePony(ResourceLocation resource) {
|
||||
return poniesCache.remove(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -44,20 +44,16 @@ public class PonyRenderManager {
|
|||
|
||||
private final Map<Class<? extends Entity>, Render<?>> renderMap = Maps.newHashMap();
|
||||
|
||||
public PonyRenderManager() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers all new player skin types. (currently only pony and slimpony).
|
||||
*/
|
||||
public void initialisePlayerRenderers(RenderManager rm) {
|
||||
public void initialisePlayerRenderers(RenderManager manager) {
|
||||
// Preview on the select skin gui
|
||||
ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(rm));
|
||||
ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(manager));
|
||||
|
||||
registerPlayerSkin(rm, PlayerModels.EARTH);
|
||||
registerPlayerSkin(rm, PlayerModels.PEGASUS);
|
||||
registerPlayerSkin(rm, PlayerModels.ALICORN);
|
||||
registerPlayerSkin(manager, PlayerModels.EARTH);
|
||||
registerPlayerSkin(manager, PlayerModels.PEGASUS);
|
||||
registerPlayerSkin(manager, PlayerModels.ALICORN);
|
||||
}
|
||||
|
||||
protected void registerPlayerSkin(RenderManager manager, PlayerModels playerModel) {
|
||||
|
@ -72,12 +68,12 @@ public class PonyRenderManager {
|
|||
/**
|
||||
* Registers all entity model replacements. (except for players).
|
||||
*/
|
||||
public void initializeMobRenderers(RenderManager rm, PonyConfig config) {
|
||||
public void initializeMobRenderers(RenderManager manager, PonyConfig config) {
|
||||
|
||||
if (config.villagers) {
|
||||
pushNewRenderer(rm, EntityVillager.class, new RenderPonyVillager(rm));
|
||||
pushNewRenderer(rm, EntityWitch.class, new RenderPonyWitch(rm));
|
||||
pushNewRenderer(rm, EntityZombieVillager.class, new RenderPonyZombieVillager(rm));
|
||||
pushNewRenderer(manager, EntityVillager.class, new RenderPonyVillager(manager));
|
||||
pushNewRenderer(manager, EntityWitch.class, new RenderPonyWitch(manager));
|
||||
pushNewRenderer(manager, EntityZombieVillager.class, new RenderPonyZombieVillager(manager));
|
||||
MineLittlePony.logger.info("Villagers are now ponies.");
|
||||
} else {
|
||||
restoreRenderer(EntityVillager.class);
|
||||
|
@ -86,9 +82,9 @@ public class PonyRenderManager {
|
|||
}
|
||||
|
||||
if (config.zombies) {
|
||||
pushNewRenderer(rm, EntityZombie.class, new RenderPonyZombie<>(rm));
|
||||
pushNewRenderer(rm, EntityHusk.class, new RenderPonyZombie.Husk(rm));
|
||||
pushNewRenderer(rm, EntityGiantZombie.class, new RenderPonyZombie.Giant(rm));
|
||||
pushNewRenderer(manager, EntityZombie.class, new RenderPonyZombie<>(manager));
|
||||
pushNewRenderer(manager, EntityHusk.class, new RenderPonyZombie.Husk(manager));
|
||||
pushNewRenderer(manager, EntityGiantZombie.class, new RenderPonyZombie.Giant(manager));
|
||||
MineLittlePony.logger.info("Zombies are now ponies.");
|
||||
} else {
|
||||
restoreRenderer(EntityZombie.class);
|
||||
|
@ -97,16 +93,16 @@ public class PonyRenderManager {
|
|||
}
|
||||
|
||||
if (config.pigzombies) {
|
||||
pushNewRenderer(rm, EntityPigZombie.class, new RenderPonyPigman(rm));
|
||||
pushNewRenderer(manager, EntityPigZombie.class, new RenderPonyPigman(manager));
|
||||
MineLittlePony.logger.info("Zombie pigmen are now ponies.");
|
||||
} else {
|
||||
restoreRenderer(EntityPigZombie.class);
|
||||
}
|
||||
|
||||
if (config.skeletons) {
|
||||
pushNewRenderer(rm, EntitySkeleton.class, new RenderPonySkeleton<>(rm));
|
||||
pushNewRenderer(rm, EntityStray.class, new RenderPonySkeleton.Stray(rm));
|
||||
pushNewRenderer(rm, EntityWitherSkeleton.class, new RenderPonySkeleton.Wither(rm));
|
||||
pushNewRenderer(manager, EntitySkeleton.class, new RenderPonySkeleton<>(manager));
|
||||
pushNewRenderer(manager, EntityStray.class, new RenderPonySkeleton.Stray(manager));
|
||||
pushNewRenderer(manager, EntityWitherSkeleton.class, new RenderPonySkeleton.Wither(manager));
|
||||
MineLittlePony.logger.info("Skeletons are now ponies.");
|
||||
} else {
|
||||
restoreRenderer(EntitySkeleton.class);
|
||||
|
@ -115,10 +111,10 @@ public class PonyRenderManager {
|
|||
}
|
||||
|
||||
if (config.illagers) {
|
||||
pushNewRenderer(rm, EntityVex.class, new RenderPonyVex(rm));
|
||||
pushNewRenderer(rm, EntityEvoker.class, new RenderPonyIllager.Evoker(rm));
|
||||
pushNewRenderer(rm, EntityVindicator.class, new RenderPonyIllager.Vindicator(rm));
|
||||
pushNewRenderer(rm, EntityIllusionIllager.class, new RenderPonyIllager.Illusionist(rm));
|
||||
pushNewRenderer(manager, EntityVex.class, new RenderPonyVex(manager));
|
||||
pushNewRenderer(manager, EntityEvoker.class, new RenderPonyIllager.Evoker(manager));
|
||||
pushNewRenderer(manager, EntityVindicator.class, new RenderPonyIllager.Vindicator(manager));
|
||||
pushNewRenderer(manager, EntityIllusionIllager.class, new RenderPonyIllager.Illusionist(manager));
|
||||
MineLittlePony.logger.info("Illagers are now ponies.");
|
||||
} else {
|
||||
restoreRenderer(EntityVex.class);
|
||||
|
|
|
@ -8,6 +8,9 @@ public interface IPlayerInfo {
|
|||
*/
|
||||
boolean usesSlimArms();
|
||||
|
||||
/**
|
||||
* Quick cast back to the original type.
|
||||
*/
|
||||
default NetworkPlayerInfo unwrap() {
|
||||
return (NetworkPlayerInfo)this;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,6 @@ public class EntityPonyModel extends EntityPlayerModel {
|
|||
|
||||
// Fixes the preview model swinging the wrong arm.
|
||||
// Who's maintaining HDSkins anyway?
|
||||
this.swingingHand = EnumHand.MAIN_HAND;
|
||||
swingingHand = EnumHand.MAIN_HAND;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.minelittlepony.MineLittlePony;
|
|||
import com.minelittlepony.PonyManager;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||
import com.voxelmodpack.hdskins.gui.EntityPlayerModel;
|
||||
import com.voxelmodpack.hdskins.gui.GuiSkins;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -25,18 +26,18 @@ public class GuiSkinsMineLP extends GuiSkins {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onSetLocalSkin(MinecraftProfileTexture.Type type) {
|
||||
protected void onSetLocalSkin(Type type) {
|
||||
MineLittlePony.logger.debug("Invalidating old local skin, checking updated local skin");
|
||||
if (type == MinecraftProfileTexture.Type.SKIN) {
|
||||
if (type == Type.SKIN) {
|
||||
ponyManager.removePony(localPlayer.getSkinTexture());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSetRemoteSkin(MinecraftProfileTexture.Type type, ResourceLocation location, MinecraftProfileTexture profileTexture) {
|
||||
protected void onSetRemoteSkin(Type type, ResourceLocation resource, MinecraftProfileTexture profileTexture) {
|
||||
MineLittlePony.logger.debug("Invalidating old remote skin, checking updated remote skin");
|
||||
if (type == MinecraftProfileTexture.Type.SKIN) {
|
||||
ponyManager.removePony(location);
|
||||
if (type == Type.SKIN) {
|
||||
ponyManager.removePony(resource);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> {
|
|||
|
||||
boolean renderingAsHuman = false;
|
||||
|
||||
public RenderPonyModel(RenderManager renderer) {
|
||||
super(renderer);
|
||||
public RenderPonyModel(RenderManager manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,7 +63,7 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> {
|
|||
final ModelElytra modelElytra = new ModelElytra();
|
||||
|
||||
@Override
|
||||
public void doPonyRender(EntityPonyModel entity, float swing, float swingAmount, float ticks, float age, float yaw, float head, float scale) {
|
||||
public void doPonyRender(EntityPonyModel entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
|
||||
if (itemstack.getItem() == Items.ELYTRA) {
|
||||
|
@ -79,8 +79,8 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> {
|
|||
GlStateManager.translate(0, 0.25F, 0.125F);
|
||||
}
|
||||
|
||||
model.setRotationAngles(swing, swingAmount, age, yaw, head, scale, entity);
|
||||
model.render(entity, swing, swingAmount, age, yaw, head, scale);
|
||||
model.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
model.render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
|
|
@ -9,10 +9,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.PonyManager;
|
||||
import com.minelittlepony.ducks.IPlayerInfo;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
@Mixin(NetworkPlayerInfo.class)
|
||||
public abstract class MixinNetworkPlayerInfo implements IPlayerInfo {
|
||||
|
@ -20,12 +18,6 @@ public abstract class MixinNetworkPlayerInfo implements IPlayerInfo {
|
|||
@Shadow
|
||||
private String skinType;
|
||||
|
||||
@Shadow
|
||||
public abstract ResourceLocation getLocationSkin();
|
||||
|
||||
@Shadow
|
||||
public abstract GameProfile getGameProfile();
|
||||
|
||||
@Inject(method = "getSkinType()Ljava/lang/String;", at = @At("RETURN"), cancellable = true)
|
||||
private void getSkinType(CallbackInfoReturnable<String> info) {
|
||||
info.setReturnValue(MineLittlePony.getInstance().getManager().getPony(unwrap()).getRace(false).getModel().getId(usesSlimArms()));
|
||||
|
@ -33,7 +25,7 @@ public abstract class MixinNetworkPlayerInfo implements IPlayerInfo {
|
|||
|
||||
@Override
|
||||
public boolean usesSlimArms() {
|
||||
if (skinType == null) return PonyManager.isSlimSkin(getGameProfile().getId());
|
||||
if (skinType == null) return PonyManager.isSlimSkin(unwrap().getGameProfile().getId());
|
||||
return "slim".equals(skinType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,9 +69,20 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
return new PonyArmor(new ModelPonyArmor(), new ModelPonyArmor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the model's various rotation angles.
|
||||
*
|
||||
* @param move Entity motion parameter - i.e. velocity in no specific direction used in bipeds to calculate step amount.
|
||||
* @param swing Degree to which each 'limb' swings.
|
||||
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}.
|
||||
* @param headYaw Horizontal head motion in radians.
|
||||
* @param headPitch Vertical head motion in radians.
|
||||
* @param scale Scaling factor used to render this model. Determined by the return value of {@link RenderLivingBase.prepareScale}. Usually {@code 0.0625F}.
|
||||
* @param entity The entity we're being called for.
|
||||
*/
|
||||
@Override
|
||||
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);
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
|
||||
float headRotateAngleY = isSleeping ? 1.4f : headYaw / 57.29578F;
|
||||
float headRotateAngleX = isSleeping ? 0.1f : headPitch / 57.29578F;
|
||||
|
@ -86,11 +97,11 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(swingProgress) * PI * 2) * 0.2F;
|
||||
}
|
||||
|
||||
rotateLook(move, swing, bodySwingRotation, age);
|
||||
rotateLook(move, swing, bodySwingRotation, ticks);
|
||||
|
||||
setLegs(move, swing, age, entity);
|
||||
setLegs(move, swing, ticks, entity);
|
||||
holdItem(swing);
|
||||
swingItem(entity, swingProgress);
|
||||
swingItem(entity);
|
||||
|
||||
if (isCrouching()) {
|
||||
adjustBody(BODY_ROTATE_ANGLE_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK);
|
||||
|
@ -115,13 +126,13 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
|
||||
bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||
bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||
swingArms(age);
|
||||
swingArms(ticks);
|
||||
setHead(0, 0, 0);
|
||||
}
|
||||
|
||||
if (isSleeping) ponySleep();
|
||||
|
||||
aimBow(leftArmPose, rightArmPose, age);
|
||||
aimBow(leftArmPose, rightArmPose, ticks);
|
||||
fixSpecialRotationPoints(move);
|
||||
|
||||
animateWears();
|
||||
|
@ -137,6 +148,14 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
setHead(0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the model's various rotation angles.
|
||||
*
|
||||
* @param move Entity motion parameter - i.e. velocity in no specific direction used in bipeds to calculate step amount.
|
||||
* @param swing Degree to which each 'limb' swings.
|
||||
* @param bodySwing Horizontal (Y) body rotation.
|
||||
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}.
|
||||
*/
|
||||
protected void rotateLook(float move, float swing, float bodySwing, float ticks) {
|
||||
tail.setRotationAndAngles(rainboom, move, swing, bodySwing, ticks);
|
||||
bodySwing /= 5;
|
||||
|
@ -155,7 +174,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the head rotation angle.
|
||||
* Sets the head rotation point.
|
||||
*/
|
||||
protected void setHead(float posX, float posY, float posZ) {
|
||||
bipedHead.setRotationPoint(posX, posY, posZ);
|
||||
|
@ -165,28 +184,46 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
/**
|
||||
* Called to update the head rotation.
|
||||
*
|
||||
* @param x New rotation X
|
||||
* @param y New rotation Y
|
||||
* @param x New rotation X
|
||||
* @param y New rotation Y
|
||||
*/
|
||||
protected void updateHeadRotation(float x, float y) {
|
||||
bipedHeadwear.rotateAngleY = bipedHead.rotateAngleY = y;
|
||||
bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX = x;
|
||||
}
|
||||
|
||||
protected void setLegs(float move, float swing, float tick, Entity entity) {
|
||||
/**
|
||||
*
|
||||
* Used to set the legs rotation based on walking/crouching animations.
|
||||
*
|
||||
* Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles}
|
||||
*
|
||||
* TODO: This can be merged into adjustLegs
|
||||
*
|
||||
*/
|
||||
protected void setLegs(float move, float swing, float ticks, Entity entity) {
|
||||
if (isFlying(entity)) {
|
||||
rotateLegsInFlight(move, swing, tick, entity);
|
||||
rotateLegsInFlight(move, swing, ticks, entity);
|
||||
} else {
|
||||
rotateLegsOnGround(move, swing, tick, entity);
|
||||
rotateLegsOnGround(move, swing, ticks, entity);
|
||||
}
|
||||
|
||||
bipedLeftArm.rotateAngleZ = 0;
|
||||
bipedRightArm.rotateAngleZ = 0;
|
||||
|
||||
adjustLegs(move, swing, tick);
|
||||
adjustLegs(move, swing, ticks);
|
||||
}
|
||||
|
||||
protected void rotateLegsInFlight(float move, float swing, float tick, Entity entity) {
|
||||
/**
|
||||
* Rotates legs in quopy fashion whilst flying.
|
||||
*
|
||||
* @param move Entity motion parameter - i.e. velocity in no specific direction used in bipeds to calculate step amount.
|
||||
* @param swing Degree to which each 'limb' swings.
|
||||
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}.
|
||||
* @param entity The entity we're being called for.
|
||||
*
|
||||
*/
|
||||
protected void rotateLegsInFlight(float move, float swing, float ticks, Entity entity) {
|
||||
float armX = MathHelper.sin(-swing / 2);
|
||||
float legX = MathHelper.sin(swing / 2);
|
||||
|
||||
|
@ -203,23 +240,26 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
bipedRightLeg.rotateAngleY = -0.2F;
|
||||
}
|
||||
|
||||
protected void rotateLegsOnGround(float move, float swing, float tick, Entity entity) {
|
||||
float pi = PI * (float) Math.pow(swing, 16);
|
||||
/**
|
||||
* Rotates legs in quopy fashion for walking.
|
||||
*
|
||||
* @param move Entity motion parameter - i.e. velocity in no specific direction used in bipeds to calculate step amount.
|
||||
* @param swing Degree to which each 'limb' swings.
|
||||
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}.
|
||||
* @param entity The entity we're being called for.
|
||||
*
|
||||
*/
|
||||
protected void rotateLegsOnGround(float move, float swing, float ticks, Entity entity) {
|
||||
float angle = PI * (float) Math.pow(swing, 16);
|
||||
|
||||
float mve = move * 0.6662F; // magic number ahoy
|
||||
float srt = swing / 4;
|
||||
float baseRotation = move * 0.6662F; // magic number ahoy
|
||||
float scale = swing / 4;
|
||||
|
||||
float leftArm = MathHelper.cos(mve + pi) * srt;
|
||||
float rightArm = MathHelper.cos(mve + PI + pi / 2) * srt;
|
||||
bipedLeftArm.rotateAngleX = MathHelper.cos(baseRotation + angle) * scale;
|
||||
bipedRightArm.rotateAngleX = MathHelper.cos(baseRotation + PI + angle / 2) * scale;
|
||||
|
||||
float leftLeg = MathHelper.cos(mve + PI - (pi * 0.4f)) * srt;
|
||||
float rightLeg = MathHelper.cos(mve + pi * 0.2f) * srt;
|
||||
|
||||
bipedLeftArm.rotateAngleX = leftArm;
|
||||
bipedRightArm.rotateAngleX = rightArm;
|
||||
|
||||
bipedLeftLeg.rotateAngleX = leftLeg;
|
||||
bipedRightLeg.rotateAngleX = rightLeg;
|
||||
bipedLeftLeg.rotateAngleX = MathHelper.cos(baseRotation + PI - (angle * 0.4f)) * scale;
|
||||
bipedRightLeg.rotateAngleX = MathHelper.cos(baseRotation + angle / 5) * scale;
|
||||
|
||||
bipedLeftArm.rotateAngleY = 0;
|
||||
bipedRightArm.rotateAngleY = 0;
|
||||
|
@ -238,7 +278,16 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
return rainboom ? 2 : 1;
|
||||
}
|
||||
|
||||
protected void adjustLegs(float move, float swing, float tick) {
|
||||
/**
|
||||
*
|
||||
* Used to set the legs rotation based on walking/crouching animations.
|
||||
*
|
||||
* Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles}
|
||||
*
|
||||
* TODO: This can be merged into setLegs
|
||||
*
|
||||
*/
|
||||
protected void adjustLegs(float move, float swing, float ticks) {
|
||||
float sin = MathHelper.sin(bipedBody.rotateAngleY) * 5;
|
||||
float cos = MathHelper.cos(bipedBody.rotateAngleY) * 5;
|
||||
|
||||
|
@ -262,6 +311,11 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
bipedRightLeg.rotationPointZ = bipedLeftLeg.rotationPointZ = 10;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts legs as if holding an item. Delegates to the correct arm/leg/limb as neccessary.
|
||||
*
|
||||
* @param swing
|
||||
*/
|
||||
protected void holdItem(float swing) {
|
||||
boolean both = leftArmPose == ArmPose.ITEM && rightArmPose == ArmPose.ITEM;
|
||||
|
||||
|
@ -269,6 +323,14 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
alignArmForAction(bipedRightArm, rightArmPose, both, swing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Aligns an arm for the appropriate arm pose
|
||||
*
|
||||
* @param arm The arm model to align
|
||||
* @param pose The post to align to
|
||||
* @param both True if we have something in both hands
|
||||
* @param swing Degree to which each 'limb' swings.
|
||||
*/
|
||||
protected void alignArmForAction(ModelRenderer arm, ArmPose pose, boolean both, float swing) {
|
||||
switch (pose) {
|
||||
case ITEM:
|
||||
|
@ -289,7 +351,12 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
}
|
||||
}
|
||||
|
||||
protected void swingItem(Entity entity, float swingProgress) {
|
||||
/**
|
||||
* Animates arm swinging. Delegates to the correct arm/leg/limb as neccessary.
|
||||
*
|
||||
* @param entity The entity we are being called for.
|
||||
*/
|
||||
protected void swingItem(Entity entity) {
|
||||
if (swingProgress > -9990.0F && !isSleeping) {
|
||||
EnumHandSide mainSide = getMainHand(entity);
|
||||
|
||||
|
@ -297,6 +364,11 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Animates arm swinging.
|
||||
*
|
||||
* @param arm The arm to swing
|
||||
*/
|
||||
protected void swingArm(ModelRenderer arm) {
|
||||
float swing = 1 - (float)Math.pow(1 - swingProgress, 3);
|
||||
|
||||
|
@ -310,11 +382,16 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
arm.rotateAngleZ = -deltaZ * 0.4F;
|
||||
}
|
||||
|
||||
protected void swingArms(float tick) {
|
||||
/**
|
||||
* Animates the walking animation.
|
||||
*
|
||||
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}.
|
||||
*/
|
||||
protected void swingArms(float ticks) {
|
||||
if (isSleeping) return;
|
||||
|
||||
float cos = MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
|
||||
float sin = MathHelper.sin(tick * 0.067F) * 0.05F;
|
||||
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||
float sin = MathHelper.sin(ticks * 0.067F) * 0.05F;
|
||||
|
||||
if (rightArmPose != ArmPose.EMPTY) {
|
||||
bipedRightArm.rotateAngleZ += cos;
|
||||
|
@ -370,28 +447,31 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
AbstractPonyRenderer.shiftRotationPoint(bipedLeftLeg, 0, 2, -8);
|
||||
}
|
||||
|
||||
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float tick) {
|
||||
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(bipedRightArm, tick);
|
||||
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(bipedLeftArm, tick);
|
||||
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float ticks) {
|
||||
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(bipedRightArm, ticks);
|
||||
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(bipedLeftArm, ticks);
|
||||
}
|
||||
|
||||
protected void aimBowPony(ModelRenderer arm, float tick) {
|
||||
protected void aimBowPony(ModelRenderer arm, float ticks) {
|
||||
arm.rotateAngleZ = 0;
|
||||
arm.rotateAngleY = bipedHead.rotateAngleY - 0.06F;
|
||||
arm.rotateAngleX = ROTATE_270 + bipedHead.rotateAngleX;
|
||||
arm.rotateAngleZ += MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
|
||||
arm.rotateAngleX += MathHelper.sin(tick * 0.067F) * 0.05F;
|
||||
}
|
||||
|
||||
protected void fixSpecialRotationPoints(float move) {
|
||||
arm.rotateAngleZ += MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||
arm.rotateAngleX += MathHelper.sin(ticks * 0.067F) * 0.05F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up this model's initial values, like a constructor...
|
||||
* @param yOffset YPosition for this model. Always 0.
|
||||
* @param stretch Scaling factor for this model. Ranges above or below 0 (no change).
|
||||
* Called after postioning but before wears alignment to perform some last-minute adjustments.
|
||||
*
|
||||
* @param move Entity motion parameter. See {@link AbstractPonyModel.setRotationAngles}.
|
||||
*
|
||||
* TODO: Empty method
|
||||
*/
|
||||
protected void fixSpecialRotationPoints(float move) {
|
||||
}
|
||||
|
||||
public void init(float yOffset, float stretch) {
|
||||
// TODO: Splitting things like this isn't strictly neccessary and just complicates things.
|
||||
initTextures();
|
||||
initPositions(yOffset, stretch);
|
||||
}
|
||||
|
@ -613,14 +693,14 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
* @param arm The arm to rotate
|
||||
* @param direction Direction multiplier. 1 for right, -1 for left.
|
||||
* @param swingProgress How far we are through the current swing
|
||||
* @param tick Render partial ticks
|
||||
* @param ticks Render partial ticks
|
||||
*/
|
||||
protected void rotateArmHolding(ModelRenderer arm, float direction, float swingProgress, float tick) {
|
||||
protected void rotateArmHolding(ModelRenderer arm, float direction, float swingProgress, float ticks) {
|
||||
float swing = MathHelper.sin(swingProgress * PI);
|
||||
float roll = MathHelper.sin((1 - (1 - swingProgress) * (1 - swingProgress)) * PI);
|
||||
|
||||
float cos = MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
|
||||
float sin = MathHelper.sin(tick * 0.067F) / 10;
|
||||
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||
float sin = MathHelper.sin(ticks * 0.067F) / 10;
|
||||
|
||||
arm.rotateAngleX = -1.5707964F;
|
||||
arm.rotateAngleX -= swing * 1.2F - roll * 0.4F;
|
||||
|
@ -631,12 +711,23 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the model's various rotation angles.
|
||||
*
|
||||
* @param entity The entity we're being called for.
|
||||
* @param move Entity motion parameter - i.e. velocity in no specific direction used in bipeds to calculate step amount.
|
||||
* @param swing Degree to which each 'limb' swings.
|
||||
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}.
|
||||
* @param headYaw Horizontal head motion in radians.
|
||||
* @param headPitch Vertical head motion in radians.
|
||||
* @param scale Scaling factor used to render this model. Determined by the return value of {@link RenderLivingBase.prepareScale}. Usually {@code 0.0625F}.
|
||||
*/
|
||||
@Override
|
||||
public void render(Entity entityIn, float move, float swing, float age, float headYaw, float headPitch, float scale) {
|
||||
public void render(Entity entityIn, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
|
||||
pushMatrix();
|
||||
transform(BodyPart.HEAD);
|
||||
renderHead(entityIn, move, swing, age, headYaw, headPitch, scale);
|
||||
renderHead(entityIn, move, swing, ticks, headYaw, headPitch, scale);
|
||||
popMatrix();
|
||||
|
||||
pushMatrix();
|
||||
|
@ -646,7 +737,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
|
||||
pushMatrix();
|
||||
transform(BodyPart.BODY);
|
||||
renderBody(entityIn, move, swing, age, headYaw, headPitch, scale);
|
||||
renderBody(entityIn, move, swing, ticks, headYaw, headPitch, scale);
|
||||
popMatrix();
|
||||
|
||||
pushMatrix();
|
||||
|
@ -655,7 +746,14 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
popMatrix();
|
||||
}
|
||||
|
||||
protected void renderHead(Entity entity, float move, float swing, float age, float headYaw, float headPitch, float scale) {
|
||||
/**
|
||||
*
|
||||
* Called to render the head.
|
||||
*
|
||||
* Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles}
|
||||
*
|
||||
*/
|
||||
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
bipedHead.render(scale);
|
||||
bipedHeadwear.render(scale);
|
||||
bipedHead.postRender(scale);
|
||||
|
@ -666,7 +764,14 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
neck.render(scale);
|
||||
}
|
||||
|
||||
protected void renderBody(Entity entity, float move, float swing, float age, float headYaw, float headPitch, float scale) {
|
||||
/**
|
||||
*
|
||||
* Called to render the head.
|
||||
*
|
||||
* Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles}
|
||||
*
|
||||
*/
|
||||
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
bipedBody.render(scale);
|
||||
if (textureHeight == 64) {
|
||||
bipedBodyWear.render(scale);
|
||||
|
@ -705,6 +810,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
|||
rotate(motionPitch, 1, 0, 0);
|
||||
}
|
||||
|
||||
// TODO: Get these out of here
|
||||
if (isChild()) {
|
||||
transformFoal(part);
|
||||
} else if (metadata.getSize() == PonySize.LARGE) {
|
||||
|
|
|
@ -18,27 +18,27 @@ public class ModelMobPony extends ModelAlicorn {
|
|||
* Returns true if the angle is to the right?
|
||||
*/
|
||||
public boolean islookAngleRight(float move) {
|
||||
return MathHelper.sin(move / 20f) < 0;
|
||||
return MathHelper.sin(move / 20) < 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void adjustLegs(float move, float swing, float tick) {
|
||||
super.adjustLegs(move, swing, tick);
|
||||
protected void adjustLegs(float move, float swing, float ticks) {
|
||||
super.adjustLegs(move, swing, ticks);
|
||||
if (rightArmPose != ArmPose.EMPTY) {
|
||||
if (canCast()) {
|
||||
unicornArmRight.setRotationPoint(-7, 12, -2);
|
||||
rotateArmHolding(unicornArmRight, -1, swingProgress, tick);
|
||||
rotateArmHolding(unicornArmRight, -1, swingProgress, ticks);
|
||||
} else {
|
||||
rotateArmHolding(bipedRightArm, -1, swingProgress, tick);
|
||||
rotateArmHolding(bipedRightArm, -1, swingProgress, ticks);
|
||||
}
|
||||
}
|
||||
|
||||
if (leftArmPose != ArmPose.EMPTY) {
|
||||
if (!canCast()) {
|
||||
unicornArmRight.setRotationPoint(-7, 12, -2);
|
||||
rotateArmHolding(unicornArmLeft, -1, swingProgress, tick);
|
||||
rotateArmHolding(unicornArmLeft, -1, swingProgress, ticks);
|
||||
} else {
|
||||
rotateArmHolding(bipedLeftArm, -1, swingProgress, tick);
|
||||
rotateArmHolding(bipedLeftArm, -1, swingProgress, ticks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package com.minelittlepony.model;
|
||||
|
||||
import com.minelittlepony.model.armour.PonyArmor;
|
||||
import com.minelittlepony.model.capabilities.IModelWrapper;
|
||||
import com.minelittlepony.pony.data.IPonyData;
|
||||
|
||||
/**
|
||||
* Container class for the various models and their associated piece of armour.
|
||||
*/
|
||||
public class ModelWrapper {
|
||||
public class ModelWrapper implements IModelWrapper {
|
||||
|
||||
private final AbstractPonyModel model;
|
||||
private final PonyArmor armor;
|
||||
|
@ -32,17 +33,11 @@ public class ModelWrapper {
|
|||
return armor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates metadata values on this wrapper's armour and model.
|
||||
*/
|
||||
public void apply(IPonyData meta) {
|
||||
model.metadata = meta;
|
||||
armor.apply(meta);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called at startup to configure a model's needed components.
|
||||
*/
|
||||
public void init() {
|
||||
model.init(0, 0);
|
||||
armor.init();
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.lang.reflect.Field;
|
|||
/**
|
||||
* PMAPI - Pony Models API?
|
||||
*
|
||||
* TODO: Remove this, move the models to where they're being used.
|
||||
*/
|
||||
public final class PMAPI {
|
||||
|
||||
|
|
|
@ -23,13 +23,13 @@ public class ModelPonyArmor extends ModelMobPony {
|
|||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
syncLegs();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void rotateLook(float limbSwing, float limbSwingAmount, float bodySwing, float ticks) {
|
||||
protected void rotateLook(float move, float swing, float bodySwing, float ticks) {
|
||||
bipedBody.rotateAngleY = bodySwing / 5;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class ModelPonyArmor extends ModelMobPony {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void renderHead(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
bipedHead.render(this.scale);
|
||||
helmet.render(this.scale);
|
||||
bipedHeadwear.render(this.scale);
|
||||
|
@ -75,6 +75,7 @@ public class ModelPonyArmor extends ModelMobPony {
|
|||
|
||||
@Override
|
||||
protected void renderNeck() {
|
||||
// TODO: Disabling the neck like this forces more complexity lower down
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -83,7 +84,7 @@ public class ModelPonyArmor extends ModelMobPony {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void renderBody(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
bipedBody.render(this.scale);
|
||||
flankGuard.render(this.scale);
|
||||
saddle.render(this.scale);
|
||||
|
|
|
@ -5,14 +5,14 @@ import com.minelittlepony.render.AbstractPonyRenderer;
|
|||
public class ModelZombiePonyArmor extends ModelPonyArmor {
|
||||
// Copied from ModelZombiePony
|
||||
@Override
|
||||
protected void adjustLegs(float move, float swing, float tick) {
|
||||
super.adjustLegs(move, swing, tick);
|
||||
protected void adjustLegs(float move, float swing, float ticks) {
|
||||
super.adjustLegs(move, swing, ticks);
|
||||
if (rightArmPose != ArmPose.EMPTY) return;
|
||||
|
||||
if (islookAngleRight(move)) {
|
||||
rotateArmHolding(bipedRightArm, 1, swingProgress, tick);
|
||||
rotateArmHolding(bipedRightArm, 1, swingProgress, ticks);
|
||||
} else {
|
||||
rotateArmHolding(bipedLeftArm, -1, swingProgress, tick);
|
||||
rotateArmHolding(bipedLeftArm, -1, swingProgress, ticks);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package com.minelittlepony.model.armour;
|
||||
|
||||
import com.minelittlepony.model.AbstractPonyModel;
|
||||
import com.minelittlepony.model.capabilities.IModelWrapper;
|
||||
import com.minelittlepony.pony.data.IPonyData;
|
||||
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
|
||||
public class PonyArmor {
|
||||
public class PonyArmor implements IModelWrapper {
|
||||
|
||||
public final AbstractPonyModel chestplate;
|
||||
public final AbstractPonyModel leggings;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.model.armour;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -7,11 +7,10 @@ import net.minecraft.entity.Entity;
|
|||
|
||||
public interface IModel {
|
||||
|
||||
|
||||
/**
|
||||
* Sets up this model's initial values, like a constructor...
|
||||
* @param yOffset YPosition for this model. Always 0.
|
||||
* @param stretch Scaling factor for this model. Ranges above or below 0 (no change).
|
||||
* @param yOffset YPosition for this model. Always 0.
|
||||
* @param stretch Scaling factor for this model. Ranges above or below 0 (no change).
|
||||
*/
|
||||
void init(float yOffset, float stretch);
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.minelittlepony.model.capabilities;
|
||||
|
||||
import com.minelittlepony.pony.data.IPonyData;
|
||||
|
||||
public interface IModelWrapper {
|
||||
/**
|
||||
* Initialises this wrapper's contained models.
|
||||
*/
|
||||
void init();
|
||||
|
||||
/**
|
||||
* Updates metadata values to this wrapper's contained models.
|
||||
*/
|
||||
void apply(IPonyData meta);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.model.capabilities;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -23,17 +23,27 @@ public class PonyElytra extends ModelBase {
|
|||
rightWing.flipX().box( 0, 0, 0, 10, 20, 2, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the model's various rotation angles.
|
||||
*
|
||||
* See {@link AbstractPonyModel.render} for an explanation of the various parameters.
|
||||
*/
|
||||
@Override
|
||||
public void render(Entity entity, float move, float swing, float age, float headYaw, float headPitch, float scale) {
|
||||
public void render(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.disableCull();
|
||||
leftWing.render(scale);
|
||||
rightWing.render(scale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the model's various rotation angles.
|
||||
*
|
||||
* See {@link AbstractPonyModel.setRotationAngles} for an explanation of the various parameters.
|
||||
*/
|
||||
@Override
|
||||
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);
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
|
||||
float rotateX = PI / 2;
|
||||
float rotateY = PI / 8;
|
||||
|
|
|
@ -27,6 +27,11 @@ public class PonyTail extends PlaneRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the model's various rotation angles.
|
||||
*
|
||||
* See {@link AbstractPonyMode.setRotationAndAngle} for an explanation of the various parameters.
|
||||
*/
|
||||
public void setRotationAndAngles(boolean rainboom, float move, float swing, float bodySwing, float ticks) {
|
||||
rotateAngleZ = rainboom ? 0 : MathHelper.cos(move * 0.8F) * 0.2f * swing;
|
||||
rotateAngleY = bodySwing;
|
||||
|
@ -58,8 +63,8 @@ public class PonyTail extends PlaneRenderer {
|
|||
tailStop = theModel.metadata.getTail().ordinal();
|
||||
}
|
||||
|
||||
public void swingX(float tick) {
|
||||
float sinTickFactor = MathHelper.sin(tick * 0.067f) * 0.05f;
|
||||
public void swingX(float ticks) {
|
||||
float sinTickFactor = MathHelper.sin(ticks * 0.067f) * 0.05f;
|
||||
rotateAngleX += sinTickFactor;
|
||||
rotateAngleY += sinTickFactor;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.model.components;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -6,10 +6,10 @@ 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;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||
|
||||
/**
|
||||
* Used for both unicorns and alicorns since there's no logical way to keep them distinct and not duplicate stuff.
|
||||
*/
|
||||
|
@ -31,16 +31,16 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void rotateLegsOnGround(float move, float swing, float tick, Entity entity) {
|
||||
super.rotateLegsOnGround(move, swing, tick, entity);
|
||||
protected void rotateLegsOnGround(float move, float swing, float ticks, Entity entity) {
|
||||
super.rotateLegsOnGround(move, swing, ticks, entity);
|
||||
|
||||
unicornArmRight.rotateAngleY = 0;
|
||||
unicornArmLeft.rotateAngleY = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void adjustLegs(float move, float swing, float tick) {
|
||||
super.adjustLegs(move, swing, tick);
|
||||
protected void adjustLegs(float move, float swing, float ticks) {
|
||||
super.adjustLegs(move, swing, ticks);
|
||||
|
||||
unicornArmLeft.rotateAngleZ = 0;
|
||||
unicornArmRight.rotateAngleZ = 0;
|
||||
|
@ -62,7 +62,7 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void swingItem(Entity entity, float swingProgress) {
|
||||
protected void swingItem(Entity entity) {
|
||||
EnumHandSide mainSide = getMainHand(entity);
|
||||
|
||||
if (canCast() && getArmPoseForSide(mainSide) != ArmPose.EMPTY) {
|
||||
|
@ -70,17 +70,17 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
|||
swingArm(getUnicornArmForSide(mainSide));
|
||||
}
|
||||
} else {
|
||||
super.swingItem(entity, swingProgress);
|
||||
super.swingItem(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void swingArms(float tick) {
|
||||
protected void swingArms(float ticks) {
|
||||
if (isSleeping) return;
|
||||
|
||||
if (canCast()) {
|
||||
float cos = MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
|
||||
float sin = MathHelper.sin(tick * 0.067F) * 0.05F;
|
||||
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||
float sin = MathHelper.sin(ticks * 0.067F) * 0.05F;
|
||||
|
||||
if (rightArmPose != ArmPose.EMPTY) {
|
||||
unicornArmRight.rotateAngleZ += cos;
|
||||
|
@ -92,7 +92,7 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
|||
unicornArmLeft.rotateAngleX += sin;
|
||||
}
|
||||
} else {
|
||||
super.swingArms(tick);
|
||||
super.swingArms(ticks);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,18 +124,18 @@ public class ModelAlicorn extends ModelPegasus implements IModelUnicorn {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float tick) {
|
||||
protected void aimBow(ArmPose leftArm, ArmPose rightArm, float ticks) {
|
||||
if (canCast()) {
|
||||
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmRight, tick);
|
||||
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmLeft, tick);
|
||||
if (rightArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmRight, ticks);
|
||||
if (leftArm == ArmPose.BOW_AND_ARROW) aimBowPony(unicornArmLeft, ticks);
|
||||
} else {
|
||||
super.aimBow(leftArm, rightArm, tick);
|
||||
super.aimBow(leftArm, rightArm, ticks);
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
if (canCast()) {
|
||||
horn.render(scale);
|
||||
|
|
|
@ -17,8 +17,8 @@ public class ModelEarthPony extends AbstractPonyModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
|
||||
if (bipedCape != null) {
|
||||
bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0;
|
||||
|
|
|
@ -27,18 +27,18 @@ public class ModelPegasus extends ModelEarthPony implements IModelPegasus {
|
|||
}
|
||||
|
||||
@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 ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
checkRainboom(entity, swing);
|
||||
|
||||
super.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
|
||||
if (bipedCape != null) {
|
||||
wings.setRotationAngles(move, swing, age);
|
||||
wings.setRotationAngles(move, swing, ticks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void rotateLegsInFlight(float move, float swing, float tick, Entity entity) {
|
||||
protected void rotateLegsInFlight(float move, float swing, float ticks, Entity entity) {
|
||||
if (rainboom) {
|
||||
bipedLeftArm.rotateAngleX = ROTATE_270;
|
||||
bipedRightArm.rotateAngleX = ROTATE_270;
|
||||
|
@ -52,13 +52,13 @@ public class ModelPegasus extends ModelEarthPony implements IModelPegasus {
|
|||
bipedRightArm.rotateAngleY = 0.2F;
|
||||
bipedRightLeg.rotateAngleY = -0.2F;
|
||||
} else {
|
||||
super.rotateLegsInFlight(move, swing, tick, entity);
|
||||
super.rotateLegsInFlight(move, swing, ticks, 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);
|
||||
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
if (canFly()) {
|
||||
wings.render(scale);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.model.player;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -66,8 +66,8 @@ public class ModelBreezie extends ModelBiped {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float move, float swing, float age, float headYaw, float headPitch, float scale) {
|
||||
super.render(entity, move, swing, age, headYaw, headPitch, scale);
|
||||
public void render(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
neck.render(scale);
|
||||
tailStub.render(scale);
|
||||
tail.render(scale);
|
||||
|
@ -77,7 +77,7 @@ public class ModelBreezie extends ModelBiped {
|
|||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
@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 ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
|
||||
bipedHead.rotateAngleY = headYaw * 0.017453292F;
|
||||
bipedHead.rotateAngleX = headPitch * 0.017453292F;
|
||||
|
@ -104,8 +104,8 @@ public class ModelBreezie extends ModelBiped {
|
|||
swingArms(getMainHand(entity));
|
||||
}
|
||||
|
||||
float rotX = MathHelper.sin(age * 0.067F) * 0.05F;
|
||||
float rotZ = MathHelper.cos(age * 0.09F) * 0.05F + 0.05F;
|
||||
float rotX = MathHelper.sin(ticks * 0.067F) * 0.05F;
|
||||
float rotZ = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||
|
||||
bipedLeftArm.rotateAngleX -= rotX;
|
||||
bipedLeftArm.rotateAngleZ -= rotZ;
|
||||
|
|
|
@ -16,8 +16,8 @@ public class ModelIllagerPony extends ModelAlicorn {
|
|||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
|
||||
AbstractIllager illager = (AbstractIllager) entity;
|
||||
IllagerArmPose pose = illager.getArmPose();
|
||||
|
@ -34,38 +34,38 @@ public class ModelIllagerPony extends ModelAlicorn {
|
|||
bipedLeftArm.rotateAngleY = -0.15707964F;
|
||||
|
||||
if (rightHanded) {
|
||||
bipedRightArm.rotateAngleX = -1.8849558F + MathHelper.cos(age * 0.09F) * 0.15F;
|
||||
bipedRightArm.rotateAngleX = -1.8849558F + MathHelper.cos(ticks * 0.09F) * 0.15F;
|
||||
bipedRightArm.rotateAngleX += f * 2.2F - f1 * 0.4F;
|
||||
} else {
|
||||
bipedLeftArm.rotateAngleX = -1.8849558F + MathHelper.cos(age * 0.09F) * 0.15F;
|
||||
bipedLeftArm.rotateAngleX = -1.8849558F + MathHelper.cos(ticks * 0.09F) * 0.15F;
|
||||
bipedLeftArm.rotateAngleX += f * 2.2F - f1 * 0.4F;
|
||||
}
|
||||
|
||||
bipedRightArm.rotateAngleZ += MathHelper.cos(age * 0.09F) * 0.05F + 0.05F;
|
||||
bipedLeftArm.rotateAngleZ -= MathHelper.cos(age * 0.09F) * 0.05F + 0.05F;
|
||||
bipedRightArm.rotateAngleX += MathHelper.sin(age * 0.067F) * 0.05F;
|
||||
bipedLeftArm.rotateAngleX -= MathHelper.sin(age * 0.067F) * 0.05F;
|
||||
bipedRightArm.rotateAngleZ += MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||
bipedLeftArm.rotateAngleZ -= MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||
bipedRightArm.rotateAngleX += MathHelper.sin(ticks * 0.067F) * 0.05F;
|
||||
bipedLeftArm.rotateAngleX -= MathHelper.sin(ticks * 0.067F) * 0.05F;
|
||||
} else if (pose == IllagerArmPose.SPELLCASTING) {
|
||||
// waving arms!
|
||||
if (rightHanded) {
|
||||
// this.bipedRightArm.rotationPointZ = 0.0F;
|
||||
// this.bipedRightArm.rotationPointX = -5.0F;
|
||||
bipedRightArm.rotateAngleX = (float) (-.75F * Math.PI);
|
||||
bipedRightArm.rotateAngleZ = MathHelper.cos(age * 0.6662F) / 4;
|
||||
bipedRightArm.rotateAngleZ = MathHelper.cos(ticks * 0.6662F) / 4;
|
||||
bipedRightArm.rotateAngleY = 1.1F;
|
||||
} else {
|
||||
// this.bipedLeftArm.rotationPointZ = 0.0F;
|
||||
// this.bipedLeftArm.rotationPointX = 5.0F;
|
||||
bipedLeftArm.rotateAngleX = (float) (-.75F * Math.PI);
|
||||
bipedLeftArm.rotateAngleZ = -MathHelper.cos(age * 0.6662F) / 4;
|
||||
bipedLeftArm.rotateAngleZ = -MathHelper.cos(ticks * 0.6662F) / 4;
|
||||
bipedLeftArm.rotateAngleY = -1.1F;
|
||||
}
|
||||
|
||||
} else if (pose == IllagerArmPose.BOW_AND_ARROW) {
|
||||
if (rightHanded) {
|
||||
aimBow(ArmPose.EMPTY, ArmPose.BOW_AND_ARROW, age);
|
||||
aimBow(ArmPose.EMPTY, ArmPose.BOW_AND_ARROW, ticks);
|
||||
} else {
|
||||
aimBow(ArmPose.BOW_AND_ARROW, ArmPose.EMPTY, age);
|
||||
aimBow(ArmPose.BOW_AND_ARROW, ArmPose.EMPTY, ticks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ public class ModelVillagerPony extends ModelAlicorn {
|
|||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
|
||||
float angleY = 0;
|
||||
if (swingProgress > -9990.0F && !canCast()) {
|
||||
|
@ -31,8 +31,8 @@ public class ModelVillagerPony extends ModelAlicorn {
|
|||
}
|
||||
|
||||
@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);
|
||||
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
int profession = getProfession(entity);
|
||||
if (profession > -1) {
|
||||
|
|
|
@ -22,11 +22,12 @@ public class ModelWitchPony extends ModelVillagerPony {
|
|||
super();
|
||||
}
|
||||
|
||||
public void setRotationAngles(float move, float swing, float age, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
@Override
|
||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
rightArmPose = ArmPose.EMPTY;
|
||||
leftArmPose = ((EntityWitch) entity).getHeldItemMainhand().isEmpty() ? ArmPose.EMPTY : ArmPose.ITEM;
|
||||
|
||||
super.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
if (leftArmPose != ArmPose.EMPTY) {
|
||||
if (!canCast()) {
|
||||
bipedRightArm.rotateAngleX = -2 * (float)Math.PI/3;
|
||||
|
@ -37,8 +38,8 @@ public class ModelWitchPony extends ModelVillagerPony {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entityIn, float move, float swing, float age, float headYaw, float headPitch, float scale) {
|
||||
super.render(entityIn, move, swing, age, headYaw, headPitch, scale);
|
||||
public void render(Entity entityIn, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.render(entityIn, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
copyModelAngles(bipedHead, witchHat);
|
||||
|
||||
|
|
|
@ -13,14 +13,14 @@ public class ModelZombiePony extends ModelMobPony {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void adjustLegs(float move, float swing, float tick) {
|
||||
super.adjustLegs(move, swing, tick);
|
||||
protected void adjustLegs(float move, float swing, float ticks) {
|
||||
super.adjustLegs(move, swing, ticks);
|
||||
if (rightArmPose != ArmPose.EMPTY) return;
|
||||
|
||||
if (islookAngleRight(move)) {
|
||||
rotateArmHolding(bipedRightArm, 1, swingProgress, tick);
|
||||
rotateArmHolding(bipedRightArm, 1, swingProgress, ticks);
|
||||
} else {
|
||||
rotateArmHolding(bipedLeftArm, -1, swingProgress, tick);
|
||||
rotateArmHolding(bipedLeftArm, -1, swingProgress, ticks);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,18 +39,18 @@ public class Pony {
|
|||
smallArms = slim;
|
||||
}
|
||||
|
||||
private IPonyData checkSkin(ResourceLocation textureResourceLocation) {
|
||||
IPonyData data = checkPonyMeta(textureResourceLocation);
|
||||
private IPonyData checkSkin(ResourceLocation resource) {
|
||||
IPonyData data = checkPonyMeta(resource);
|
||||
if (data != null) return data;
|
||||
|
||||
BufferedImage skinImage = getBufferedImage(textureResourceLocation);
|
||||
BufferedImage skinImage = getBufferedImage(resource);
|
||||
return this.checkSkin(skinImage);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private IPonyData checkPonyMeta(ResourceLocation location) {
|
||||
private IPonyData checkPonyMeta(ResourceLocation resource) {
|
||||
try {
|
||||
IResource res = Minecraft.getMinecraft().getResourceManager().getResource(location);
|
||||
IResource res = Minecraft.getMinecraft().getResourceManager().getResource(resource);
|
||||
if (res.hasMetadata()) {
|
||||
PonyData data = res.getMetadata(PonyDataSerialzier.NAME);
|
||||
if (data != null) {
|
||||
|
@ -60,7 +60,7 @@ public class Pony {
|
|||
} catch (FileNotFoundException e) {
|
||||
// Ignore uploaded texture
|
||||
} catch (IOException e) {
|
||||
MineLittlePony.logger.warn("Unable to read {} metadata", location, e);
|
||||
MineLittlePony.logger.warn("Unable to read {} metadata", resource, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -76,14 +76,14 @@ public class Pony {
|
|||
} catch (IOException ignored) { }
|
||||
|
||||
try {
|
||||
ITextureObject e2 = Minecraft.getMinecraft().getTextureManager().getTexture(resource);
|
||||
ITextureObject texture = Minecraft.getMinecraft().getTextureManager().getTexture(resource);
|
||||
|
||||
if (e2 instanceof MixinThreadDownloadImageData) {
|
||||
return ((MixinThreadDownloadImageData) e2).getBufferedImage();
|
||||
} else if (e2 instanceof ThreadDownloadImageETag) {
|
||||
return ((ThreadDownloadImageETag) e2).getBufferedImage();
|
||||
} else if (e2 instanceof DynamicTextureImage) {
|
||||
return ((DynamicTextureImage) e2).getImage();
|
||||
if (texture instanceof MixinThreadDownloadImageData) {
|
||||
return ((MixinThreadDownloadImageData) texture).getBufferedImage();
|
||||
} else if (texture instanceof ThreadDownloadImageETag) {
|
||||
return ((ThreadDownloadImageETag) texture).getBufferedImage();
|
||||
} else if (texture instanceof DynamicTextureImage) {
|
||||
return ((DynamicTextureImage) texture).getImage();
|
||||
}
|
||||
} catch (Exception ignored) { }
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.pony.data;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -99,6 +99,10 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
|
|||
return (T) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Positions a given model in space by setting its offset values divided
|
||||
* by 16 to account for scaling applied inside the model.
|
||||
*/
|
||||
public static <T extends ModelRenderer> T at(T renderer, float x, float y, float z) {
|
||||
renderer.offsetX = x / 16;
|
||||
renderer.offsetY = y / 16;
|
||||
|
@ -106,10 +110,16 @@ public abstract class AbstractPonyRenderer<T extends AbstractPonyRenderer<T>> ex
|
|||
return renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates this model to align itself with the angles of another.
|
||||
*/
|
||||
public void rotateTo(ModelRenderer other) {
|
||||
rotate(other.rotateAngleX, other.rotateAngleY, other.rotateAngleZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shifts this model to align its center with the center of another.
|
||||
*/
|
||||
public T rotateAt(ModelRenderer other) {
|
||||
return around(other.rotationPointX, other.rotationPointY, other.rotationPointZ);
|
||||
}
|
||||
|
|
|
@ -19,12 +19,24 @@ public abstract class AbstractPonyLayer<T extends EntityLivingBase> implements L
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@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 partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
// render the pony layer
|
||||
doPonyRender((T)entity, move, swing, ticks, age, headYaw, headPitch, scale);
|
||||
doPonyRender((T)entity, move, swing, partialTicks, ticks, headYaw, headPitch, scale);
|
||||
}
|
||||
|
||||
protected abstract void doPonyRender(T entity, float move, float swing, float ticks, float age, float headYaw, float headPitch, float scale);
|
||||
/**
|
||||
* Renders this layer.
|
||||
*
|
||||
* @param entity The entity we're being called for.
|
||||
* @param move Entity motion parameter - i.e. velocity in no specific direction used in bipeds to calculate step amount.
|
||||
* @param swing Degree to which each 'limb' swings.
|
||||
* @param partialTicks Render partial ticks
|
||||
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}.
|
||||
* @param headYaw Horizontal head motion in radians.
|
||||
* @param headPitch Vertical head motion in radians.
|
||||
* @param scale Scaling factor used to render this model. Determined by the return value of {@link RenderLivingBase.prepareScale}. Usually {@code 0.0625F}.
|
||||
*/
|
||||
protected abstract void doPonyRender(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale);
|
||||
|
||||
protected RenderLivingBase<T> getRenderer() {
|
||||
return renderer;
|
||||
|
|
|
@ -14,6 +14,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* TODO: Looks like {@link LayerEntityOnShoulder}
|
||||
*/
|
||||
public class LayerEntityOnPonyShoulder extends AbstractPonyLayer<AbstractClientPlayer> {
|
||||
|
||||
private final RenderManager renderManager;
|
||||
|
@ -27,7 +30,7 @@ public class LayerEntityOnPonyShoulder extends AbstractPonyLayer<AbstractClientP
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doPonyRender(AbstractClientPlayer player, float move, float swing, float ticks, float age, float headYaw, float headPitch, float scale) {
|
||||
public void doPonyRender(AbstractClientPlayer player, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
|
@ -35,32 +38,35 @@ public class LayerEntityOnPonyShoulder extends AbstractPonyLayer<AbstractClientP
|
|||
NBTTagCompound leftTag = player.getLeftShoulderEntity();
|
||||
|
||||
if (!leftTag.hasNoTags()) {
|
||||
leftEntity = renderShoulderEntity(player, leftEntity,
|
||||
leftTag, move, swing, ticks, age, headYaw, headPitch, scale, true);
|
||||
leftEntity = renderShoulderEntity(player, leftEntity, leftTag, partialTicks, true);
|
||||
}
|
||||
|
||||
NBTTagCompound rightTag = player.getRightShoulderEntity();
|
||||
|
||||
if (!rightTag.hasNoTags()) {
|
||||
rightEntity = renderShoulderEntity(player, rightEntity,
|
||||
rightTag, move, swing, ticks, age, headYaw, headPitch, scale, false);
|
||||
rightEntity = renderShoulderEntity(player, rightEntity, rightTag, partialTicks, false);
|
||||
}
|
||||
|
||||
GlStateManager.disableRescaleNormal();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private EntityLivingBase renderShoulderEntity(AbstractClientPlayer player, @Nullable EntityLivingBase entity, NBTTagCompound tag,
|
||||
float move, float swing, float ticks, float age, float headYaw, float headPitch, float scale, boolean left) {
|
||||
private EntityLivingBase renderShoulderEntity(AbstractClientPlayer player, @Nullable EntityLivingBase entity, NBTTagCompound shoulderTag, float partialTicks, boolean left) {
|
||||
|
||||
if (entity == null || !entity.getUniqueID().equals(tag.getUniqueId("UUID"))) {
|
||||
entity = (EntityLivingBase) EntityList.createEntityFromNBT(tag, player.world);
|
||||
if (entity == null || !entity.getUniqueID().equals(shoulderTag.getUniqueId("UUID"))) {
|
||||
entity = (EntityLivingBase) EntityList.createEntityFromNBT(shoulderTag, player.world);
|
||||
// this isn't an entity.
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Render<Entity> render = renderManager.getEntityRenderObject(entity);
|
||||
|
||||
if (render == null) {
|
||||
return entity;
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
getPonyModel().transform(BodyPart.BODY);
|
||||
|
@ -70,10 +76,7 @@ public class LayerEntityOnPonyShoulder extends AbstractPonyLayer<AbstractClientP
|
|||
GlStateManager.scale(1, -1, -1);
|
||||
GlStateManager.rotate(left ? -5 : 5, 0, 0, 1);
|
||||
|
||||
Render<Entity> render = renderManager.getEntityRenderObject(entity);
|
||||
if (render != null) {
|
||||
render.doRender(entity, 0, 0, 0, 0, 0);
|
||||
}
|
||||
render.doRender(entity, 0, 0, 0, 0, partialTicks);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
return entity;
|
||||
|
|
|
@ -14,9 +14,9 @@ public class LayerHeldItemIllager<T extends AbstractIllager> extends LayerHeldPo
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doPonyRender(T entity, float move, float swing, float ticks, float age, float headYaw, float headPitch, float scale) {
|
||||
public void doPonyRender(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
if (shouldRender(entity)) {
|
||||
super.doPonyRender(entity, move, swing, ticks, age, headYaw, headPitch, scale);
|
||||
super.doPonyRender(entity, move, swing, partialTicks, ticks, headYaw, headPitch, scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public class LayerHeldPonyItem<T extends EntityLivingBase> extends AbstractPonyL
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doPonyRender(T entity, float move, float swing, float ticks, float age, float headYaw, float headPitch, float scale) {
|
||||
public void doPonyRender(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
|
||||
boolean mainRight = entity.getPrimaryHand() == EnumHandSide.RIGHT;
|
||||
|
||||
|
|
|
@ -21,16 +21,16 @@ public abstract class LayerOverlayBase<T extends EntityLiving> implements LayerR
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(T entity, float move, float swing, float ticks, float age, float headYaw, float headPitch, float scale) {
|
||||
public void doRenderLayer(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
ModelBase overlayModel = getOverlayModel();
|
||||
|
||||
overlayModel.setModelAttributes(renderer.getMainModel());
|
||||
overlayModel.setLivingAnimations(entity, move, swing, ticks);
|
||||
overlayModel.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
||||
overlayModel.setLivingAnimations(entity, move, swing, partialTicks);
|
||||
overlayModel.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
|
||||
renderer.bindTexture(getOverlayTexture());
|
||||
|
||||
overlayModel.render(entity, move, swing, age, headYaw, headPitch, scale);
|
||||
overlayModel.render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
}
|
||||
|
||||
protected abstract ModelBase getOverlayModel();
|
||||
|
|
|
@ -43,17 +43,17 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doPonyRender(T entity, float move, float swing, float ticks, float age, float headYaw, float headPitch, float scale) {
|
||||
public void doPonyRender(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
pony = ((IRenderPony) getRenderer()).getPlayerModel();
|
||||
|
||||
for (EntityEquipmentSlot i : EntityEquipmentSlot.values()) {
|
||||
if (i.getSlotType() == Type.ARMOR) {
|
||||
renderArmor(entity, move, swing, ticks, age, headYaw, headPitch, scale, i);
|
||||
renderArmor(entity, move, swing, partialTicks, ticks, headYaw, headPitch, scale, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void renderArmor(T entity, float move, float swing, float ticks, float age, float headYaw, float headPitch, float scale, EntityEquipmentSlot armorSlot) {
|
||||
private void renderArmor(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale, EntityEquipmentSlot armorSlot) {
|
||||
ItemStack itemstack = entity.getItemStackFromSlot(armorSlot);
|
||||
|
||||
if (!itemstack.isEmpty() && itemstack.getItem() instanceof ItemArmor) {
|
||||
|
@ -63,7 +63,7 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
|||
AbstractPonyModel modelbase = pony.getArmor().getArmorForSlot(armorSlot);
|
||||
modelbase = getArmorModel(entity, itemstack, armorSlot, modelbase);
|
||||
modelbase.setModelAttributes(pony.getModel());
|
||||
modelbase.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
|
||||
modelbase.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
|
||||
Tuple<ResourceLocation, Boolean> armors = getArmorTexture(entity, itemstack, armorSlot, null);
|
||||
prepareToRender((ModelPonyArmor) modelbase, armorSlot, armors.getSecond());
|
||||
|
@ -71,15 +71,15 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
|||
getRenderer().bindTexture(armors.getFirst());
|
||||
if (itemarmor.getArmorMaterial() == ArmorMaterial.LEATHER) {
|
||||
Color.glColor(itemarmor.getColor(itemstack), 1);
|
||||
modelbase.render(entity, move, swing, age, headYaw, headPitch, scale);
|
||||
modelbase.render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
armors = getArmorTexture(entity, itemstack, armorSlot, "overlay");
|
||||
getRenderer().bindTexture(armors.getFirst());
|
||||
}
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
modelbase.render(entity, move, swing, age, headYaw, headPitch, scale);
|
||||
modelbase.render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
if (itemstack.isItemEnchanted()) {
|
||||
renderEnchantment(entity, modelbase, move, swing, ticks, age, headYaw, headPitch, scale);
|
||||
renderEnchantment(entity, modelbase, move, swing, partialTicks, ticks, headYaw, headPitch, scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ 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 partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
getRenderer().bindTexture(ENCHANTED_ITEM_GLINT_RES);
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
|
@ -167,7 +167,7 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
|||
float brightness = 0.5F;
|
||||
GlStateManager.color(brightness, brightness, brightness, 1);
|
||||
|
||||
float baseYOffset = entity.ticksExisted + ticks;
|
||||
float baseYOffset = entity.ticksExisted + partialTicks;
|
||||
float glintBrightness = 0.76F;
|
||||
float scaleFactor = 0.33333334F;
|
||||
|
||||
|
@ -186,7 +186,7 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
|||
GlStateManager.translate(0, baseYOffset * (0.02F + i * 0.06F), 0);
|
||||
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
|
||||
|
||||
model.render(entity, move, swing, age, headYaw, headPitch, scale);
|
||||
model.render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
}
|
||||
|
||||
GlStateManager.matrixMode(GL11.GL_TEXTURE);
|
||||
|
|
|
@ -23,7 +23,7 @@ public class LayerPonyCape extends AbstractPonyLayer<AbstractClientPlayer> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doPonyRender(@Nonnull AbstractClientPlayer player, float move, float swing, float ticks, float age, float headYaw, float headPitch, float scale) {
|
||||
public void doPonyRender(@Nonnull AbstractClientPlayer player, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
ModelWrapper model = ((IRenderPony) getRenderer()).getPlayerModel();
|
||||
|
||||
if (player.hasPlayerInfo() && !player.isInvisible()
|
||||
|
|
|
@ -34,7 +34,7 @@ public class LayerPonyCustomHead<T extends EntityLivingBase> implements LayerRen
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(T entity, float move, float swing, float ticks, float age, float headYaw, float headPitch, float scale) {
|
||||
public void doRenderLayer(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
|
||||
if (!itemstack.isEmpty()) {
|
||||
AbstractPonyModel model = getModel().getModel();
|
||||
|
@ -97,6 +97,7 @@ public class LayerPonyCustomHead<T extends EntityLivingBase> implements LayerRen
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: PonySkullRenderer
|
||||
TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0, -0.45F, EnumFacing.UP, 180, itemstack.getMetadata(), profile, -1, limbSwing);
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class LayerPonyElytra<T extends EntityLivingBase> extends AbstractPonyLay
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doPonyRender(@Nonnull T entity, float move, float swing, float ticks, float age, float yaw, float head, float scale) {
|
||||
public void doPonyRender(@Nonnull T entity, float move, float swing, float partialTicks, float ticks, float yaw, float head, float scale) {
|
||||
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
|
||||
if (itemstack.getItem() == Items.ELYTRA) {
|
||||
|
@ -37,11 +37,11 @@ public class LayerPonyElytra<T extends EntityLivingBase> extends AbstractPonyLay
|
|||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(0, 0.25F, 0.125F);
|
||||
getPlayerModel().transform(BodyPart.BODY);
|
||||
modelElytra.setRotationAngles(move, swing, age, yaw, head, scale, entity);
|
||||
modelElytra.render(entity, move, swing, age, yaw, head, scale);
|
||||
modelElytra.setRotationAngles(move, swing, ticks, yaw, head, scale, entity);
|
||||
modelElytra.render(entity, move, swing, ticks, yaw, head, scale);
|
||||
|
||||
if (itemstack.isItemEnchanted()) {
|
||||
LayerArmorBase.renderEnchantedGlint(getRenderer(), entity, modelElytra, move, swing, ticks, age, yaw, head, scale);
|
||||
LayerArmorBase.renderEnchantedGlint(getRenderer(), entity, modelElytra, move, swing, partialTicks, ticks, yaw, head, scale);
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
|
|
@ -21,8 +21,6 @@ import net.minecraft.util.ResourceLocation;
|
|||
|
||||
public abstract class RenderPonyBase extends RenderPlayer implements IRenderPony {
|
||||
|
||||
protected final boolean smallArms;
|
||||
|
||||
private ModelWrapper playerModel;
|
||||
|
||||
protected AbstractPonyModel ponyModel;
|
||||
|
@ -31,7 +29,6 @@ public abstract class RenderPonyBase extends RenderPlayer implements IRenderPony
|
|||
|
||||
public RenderPonyBase(RenderManager manager, boolean useSmallArms, ModelWrapper model) {
|
||||
super(manager, useSmallArms);
|
||||
smallArms = useSmallArms;
|
||||
|
||||
setPlayerModel(model);
|
||||
|
||||
|
|
|
@ -59,5 +59,5 @@ public class RenderPonyPlayer extends RenderPonyBase {
|
|||
GlStateManager.rotate(((IPonyAnimationHolder)player).getStrafeAmount(ticks), 0, 0, 1);
|
||||
}
|
||||
|
||||
//TODO: transformSwimming()
|
||||
//TODO: MC1.13 transformSwimming()
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ public class RenderPonySkeleton<Skeleton extends AbstractSkeleton> extends Rende
|
|||
private static final ResourceLocation WITHER = new ResourceLocation("minelittlepony", "textures/entity/skeleton/skeleton_wither_pony.png");
|
||||
private static final ResourceLocation STRAY = new ResourceLocation("minelittlepony", "textures/entity/skeleton/stray_pony.png");
|
||||
|
||||
public RenderPonySkeleton(RenderManager rm) {
|
||||
super(rm, PMAPI.skeleton);
|
||||
public RenderPonySkeleton(RenderManager manager) {
|
||||
super(manager, PMAPI.skeleton);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -60,4 +60,6 @@ public class RenderPonyZombie<Zombie extends EntityZombie> extends RenderPonyMob
|
|||
return ZOMBIE;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: MC1.13 EntityDrowned
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ public class Vertex extends PositionTextureVertex {
|
|||
super(old, texX, texY);
|
||||
}
|
||||
|
||||
// The MCP name is misleading.
|
||||
// This is meant to return a COPY with the given texture position
|
||||
public Vertex setTexturePosition(float texX, float texY) {
|
||||
texturePositionX = texX;
|
||||
texturePositionY = texY;
|
||||
return this;
|
||||
return new Vertex(this, texX, texY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue