mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-27 06:47:59 +01:00
Keep the player model where it is, translate the shadow instead
This commit is contained in:
parent
0fb1c77137
commit
0b4086db05
1 changed files with 28 additions and 3 deletions
|
@ -17,6 +17,7 @@ import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||||
import net.minecraft.client.renderer.entity.layers.LayerArrow;
|
import net.minecraft.client.renderer.entity.layers.LayerArrow;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public abstract class RenderPonyBase extends RenderPlayer implements IRenderPony {
|
public abstract class RenderPonyBase extends RenderPlayer implements IRenderPony {
|
||||||
|
@ -46,6 +47,25 @@ public abstract class RenderPonyBase extends RenderPlayer implements IRenderPony
|
||||||
addLayer(new LayerEntityOnPonyShoulder(renderManager, this));
|
addLayer(new LayerEntityOnPonyShoulder(renderManager, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float prepareScale(AbstractClientPlayer player, float ticks) {
|
||||||
|
|
||||||
|
if (!player.isRiding()) {
|
||||||
|
float x = player.width/2;
|
||||||
|
float y = 0;
|
||||||
|
|
||||||
|
if (player.isSneaking()) {
|
||||||
|
// Sneaking makes the player 1/15th shorter.
|
||||||
|
// This should be compatible with height-changing mods.
|
||||||
|
y += player.height / 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.doRenderShadowAndFire(player, 0, y, x, 0, ticks);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.prepareScale(player, ticks);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void preRenderCallback(AbstractClientPlayer player, float ticks) {
|
protected void preRenderCallback(AbstractClientPlayer player, float ticks) {
|
||||||
updateModel(player);
|
updateModel(player);
|
||||||
|
@ -61,13 +81,18 @@ public abstract class RenderPonyBase extends RenderPlayer implements IRenderPony
|
||||||
float s = getScaleFactor();
|
float s = getScaleFactor();
|
||||||
GlStateManager.scale(s, s, s);
|
GlStateManager.scale(s, s, s);
|
||||||
|
|
||||||
if (!player.isRiding()) {
|
if (player.isRiding()) {
|
||||||
GlStateManager.translate(0, 0, -player.width / 2); // move us to the center of the shadow
|
|
||||||
} else {
|
|
||||||
GlStateManager.translate(0, player.getYOffset(), 0);
|
GlStateManager.translate(0, player.getYOffset(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doRenderShadowAndFire(Entity player, double x, double y, double z, float yaw, float ticks) {
|
||||||
|
if (player.isRiding()) {
|
||||||
|
super.doRenderShadowAndFire(player, x, y, z, yaw, ticks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderRightArm(AbstractClientPlayer player) {
|
public void renderRightArm(AbstractClientPlayer player) {
|
||||||
updateModel(player);
|
updateModel(player);
|
||||||
|
|
Loading…
Reference in a new issue