diff --git a/src/main/java/com/minelittlepony/ducks/IRenderPony.java b/src/main/java/com/minelittlepony/ducks/IRenderPony.java index d630a50a..64e55055 100644 --- a/src/main/java/com/minelittlepony/ducks/IRenderPony.java +++ b/src/main/java/com/minelittlepony/ducks/IRenderPony.java @@ -16,4 +16,9 @@ public interface IRenderPony { * Gets the current shadow size for rendering. */ float getShadowScale(); + + /** + * Gets the scaling factor used when rendering this pony. + */ + float getScaleFactor(); } diff --git a/src/main/java/com/minelittlepony/model/AbstractPonyModel.java b/src/main/java/com/minelittlepony/model/AbstractPonyModel.java index c7b96fdd..4a7b15b3 100644 --- a/src/main/java/com/minelittlepony/model/AbstractPonyModel.java +++ b/src/main/java/com/minelittlepony/model/AbstractPonyModel.java @@ -727,7 +727,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { pushMatrix(); transform(BodyPart.HEAD); - renderHead(entityIn, move, swing, ticks, headYaw, headPitch, scale); + renderHead(entityIn, move, swing, ticks, headYaw, headPitch, this.scale); popMatrix(); pushMatrix(); @@ -737,7 +737,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { pushMatrix(); transform(BodyPart.BODY); - renderBody(entityIn, move, swing, ticks, headYaw, headPitch, scale); + renderBody(entityIn, move, swing, ticks, headYaw, headPitch, this.scale); popMatrix(); pushMatrix(); diff --git a/src/main/java/com/minelittlepony/pony/data/PonySize.java b/src/main/java/com/minelittlepony/pony/data/PonySize.java index 587d6709..dee84d29 100644 --- a/src/main/java/com/minelittlepony/pony/data/PonySize.java +++ b/src/main/java/com/minelittlepony/pony/data/PonySize.java @@ -1,5 +1,7 @@ package com.minelittlepony.pony.data; +import com.minelittlepony.MineLittlePony; + public enum PonySize implements ITriggerPixelMapped { NORMAL(0, 0.4f, 1f), LARGE(0xce3254, 0.5f, 0.8f), @@ -18,10 +20,16 @@ public enum PonySize implements ITriggerPixelMapped { } public float getShadowSize() { + if (MineLittlePony.getConfig().showscale) { + return shadowSize * 0.9F; + } return shadowSize; } public float getScaleFactor() { + if (MineLittlePony.getConfig().showscale) { + return scale * 0.9F; + } return scale; } diff --git a/src/main/java/com/minelittlepony/pony/data/TriggerPixels.java b/src/main/java/com/minelittlepony/pony/data/TriggerPixels.java index 15d403bf..05ec7afe 100644 --- a/src/main/java/com/minelittlepony/pony/data/TriggerPixels.java +++ b/src/main/java/com/minelittlepony/pony/data/TriggerPixels.java @@ -11,7 +11,7 @@ public enum TriggerPixels { RACE(PonyRace.HUMAN, 0, 0), TAIL(TailLengths.FULL, 1, 0), GENDER(PonyGender.MARE, 2, 0), - SIZE(PonySize.NORMAL, 3, 0), + SIZE(PonySize.LARGE, 3, 0), GLOW(null, 0, 1); private int x; diff --git a/src/main/java/com/minelittlepony/render/RenderPonyMob.java b/src/main/java/com/minelittlepony/render/RenderPonyMob.java index 9223fac5..0efe0f9e 100644 --- a/src/main/java/com/minelittlepony/render/RenderPonyMob.java +++ b/src/main/java/com/minelittlepony/render/RenderPonyMob.java @@ -9,6 +9,8 @@ import com.minelittlepony.render.layer.LayerPonyArmor; import com.minelittlepony.render.layer.LayerPonyCustomHead; import com.minelittlepony.render.layer.LayerPonyElytra; import com.voxelmodpack.hdskins.HDSkinManager; + +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.layers.LayerArrow; @@ -16,7 +18,6 @@ import net.minecraft.entity.EntityLiving; import net.minecraft.util.ResourceLocation; import javax.annotation.Nonnull; -import javax.annotation.OverridingMethodsMustInvokeSuper; public abstract class RenderPonyMob extends RenderLiving implements IRenderPony { @@ -50,7 +51,6 @@ public abstract class RenderPonyMob extends RenderLiving } @Override - @OverridingMethodsMustInvokeSuper protected void preRenderCallback(T entity, float ticks) { playerModel.getModel().isSneak = entity.isSneaking(); playerModel.getModel().isFlying = !entity.onGround; @@ -60,6 +60,11 @@ public abstract class RenderPonyMob extends RenderLiving playerModel.apply(MineLittlePony.getInstance().getManager().getPony(loc, false).getMetadata()); shadowSize = getShadowScale(); + + float s = getScaleFactor(); + GlStateManager.scale(s, s, s); + + GlStateManager.translate(0, 0, -entity.width / 2); // move us to the center of the shadow } @Override @@ -72,6 +77,12 @@ public abstract class RenderPonyMob extends RenderLiving return 0.5F; } + @Override + public float getScaleFactor() { + if (MineLittlePony.getConfig().showscale) return 0.9F; + return 1; + } + @Override public ModelWrapper getPlayerModel() { return playerModel; diff --git a/src/main/java/com/minelittlepony/render/player/RenderPonyBase.java b/src/main/java/com/minelittlepony/render/player/RenderPonyBase.java index 8bd4c822..0a3f3447 100644 --- a/src/main/java/com/minelittlepony/render/player/RenderPonyBase.java +++ b/src/main/java/com/minelittlepony/render/player/RenderPonyBase.java @@ -47,23 +47,20 @@ public abstract class RenderPonyBase extends RenderPlayer implements IRenderPony } @Override - protected void renderLivingAt(AbstractClientPlayer player, double x, double y, double z) { - float s = getScaleFactor(); - GlStateManager.scale(s, s, s); - super.renderLivingAt(player, x, y, z); - } - - @Override - public void doRender(AbstractClientPlayer player, double x, double y, double z, float entityYaw, float ticks) { + protected void preRenderCallback(AbstractClientPlayer player, float ticks) { updateModel(player); ponyModel.isSneak = player.isSneaking(); ponyModel.isSleeping = player.isPlayerSleeping(); ponyModel.isFlying = pony.isPegasusFlying(player); + super.preRenderCallback(player, ticks); shadowSize = getShadowScale(); - super.doRender(player, x, y, z, entityYaw, ticks); + float s = getScaleFactor(); + GlStateManager.scale(s, s, s); + + GlStateManager.translate(0, 0, -player.width / 2); // move us to the center of the shadow } @Override @@ -135,8 +132,6 @@ public abstract class RenderPonyBase extends RenderPlayer implements IRenderPony return pony; } - protected abstract float getScaleFactor(); - protected abstract void transformElytraFlight(AbstractClientPlayer player, double motionX, double motionY, double motionZ, float ticks); protected abstract void transformPegasusFlight(AbstractClientPlayer player, double motionX, double motionY, double motionZ, float yaw, float pitch, float ticks); diff --git a/src/main/java/com/minelittlepony/render/player/RenderPonyPlayer.java b/src/main/java/com/minelittlepony/render/player/RenderPonyPlayer.java index 5b0468c0..4b67cf6d 100644 --- a/src/main/java/com/minelittlepony/render/player/RenderPonyPlayer.java +++ b/src/main/java/com/minelittlepony/render/player/RenderPonyPlayer.java @@ -1,6 +1,5 @@ package com.minelittlepony.render.player; -import com.minelittlepony.MineLittlePony; import com.minelittlepony.model.ModelWrapper; import com.minelittlepony.util.math.MathUtil; @@ -17,12 +16,11 @@ public class RenderPonyPlayer extends RenderPonyBase { @Override public float getShadowScale() { - if (!MineLittlePony.getConfig().showscale) return .5f; return getPony().getMetadata().getSize().getShadowSize(); } @Override - protected float getScaleFactor() { + public float getScaleFactor() { return getPony().getMetadata().getSize().getScaleFactor(); }