mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Fixed villagers flapping their wings whilst in a boat (RenderPonyMob and RenderPonyBase can be merged some time in the future)
This commit is contained in:
parent
cd84f64d37
commit
12600fff3d
2 changed files with 21 additions and 11 deletions
|
@ -10,7 +10,7 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.texture.ITextureObject;
|
import net.minecraft.client.renderer.texture.ITextureObject;
|
||||||
import net.minecraft.client.renderer.texture.TextureUtil;
|
import net.minecraft.client.renderer.texture.TextureUtil;
|
||||||
import net.minecraft.client.resources.IResource;
|
import net.minecraft.client.resources.IResource;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
@ -96,11 +96,9 @@ public class Pony {
|
||||||
return PonyData.parse(bufferedimage);
|
return PonyData.parse(bufferedimage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPegasusFlying(EntityPlayer player) {
|
public boolean isPegasusFlying(EntityLivingBase entity) {
|
||||||
//noinspection SimplifiableIfStatement
|
return getRace(false).hasWings() &&
|
||||||
if (!getRace(false).hasWings()) return false;
|
!(entity.onGround || entity.isRiding() || entity.isOnLadder() || entity.isInWater());
|
||||||
|
|
||||||
return player.capabilities.isFlying || !(player.onGround || player.isRiding() || player.isOnLadder() || player.isInWater());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelWrapper getModel(boolean ignorePony) {
|
public ModelWrapper getModel(boolean ignorePony) {
|
||||||
|
|
|
@ -2,7 +2,9 @@ package com.minelittlepony.render;
|
||||||
|
|
||||||
import com.minelittlepony.MineLittlePony;
|
import com.minelittlepony.MineLittlePony;
|
||||||
import com.minelittlepony.ducks.IRenderPony;
|
import com.minelittlepony.ducks.IRenderPony;
|
||||||
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
import com.minelittlepony.model.ModelWrapper;
|
import com.minelittlepony.model.ModelWrapper;
|
||||||
|
import com.minelittlepony.pony.data.Pony;
|
||||||
import com.minelittlepony.render.layer.LayerHeldPonyItem;
|
import com.minelittlepony.render.layer.LayerHeldPonyItem;
|
||||||
import com.minelittlepony.render.layer.LayerHeldPonyItemMagical;
|
import com.minelittlepony.render.layer.LayerHeldPonyItemMagical;
|
||||||
import com.minelittlepony.render.layer.LayerPonyArmor;
|
import com.minelittlepony.render.layer.LayerPonyArmor;
|
||||||
|
@ -23,9 +25,14 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
|
||||||
|
|
||||||
protected ModelWrapper playerModel;
|
protected ModelWrapper playerModel;
|
||||||
|
|
||||||
|
protected AbstractPonyModel ponyModel;
|
||||||
|
|
||||||
|
private Pony pony;
|
||||||
|
|
||||||
public RenderPonyMob(RenderManager manager, ModelWrapper model) {
|
public RenderPonyMob(RenderManager manager, ModelWrapper model) {
|
||||||
super(manager, model.getModel(), 0.5F);
|
super(manager, model.getModel(), 0.5F);
|
||||||
playerModel = model;
|
playerModel = model;
|
||||||
|
ponyModel = playerModel.getModel();
|
||||||
|
|
||||||
addLayers();
|
addLayers();
|
||||||
}
|
}
|
||||||
|
@ -52,13 +59,13 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void preRenderCallback(T entity, float ticks) {
|
protected void preRenderCallback(T entity, float ticks) {
|
||||||
playerModel.getModel().isSneak = entity.isSneaking();
|
updateModel(entity);
|
||||||
playerModel.getModel().isFlying = !entity.onGround || entity.isElytraFlying();
|
|
||||||
playerModel.getModel().isSleeping = false;
|
|
||||||
|
|
||||||
ResourceLocation loc = getEntityTexture(entity);
|
ponyModel.isSneak = entity.isSneaking();
|
||||||
playerModel.apply(MineLittlePony.getInstance().getManager().getPony(loc, false).getMetadata());
|
ponyModel.isSleeping = entity.isPlayerSleeping();
|
||||||
|
ponyModel.isFlying = pony.isPegasusFlying(entity);
|
||||||
|
|
||||||
|
super.preRenderCallback(entity, ticks);
|
||||||
shadowSize = getShadowScale();
|
shadowSize = getShadowScale();
|
||||||
|
|
||||||
float s = getScaleFactor();
|
float s = getScaleFactor();
|
||||||
|
@ -88,6 +95,11 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
|
||||||
return playerModel;
|
return playerModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void updateModel(T entity) {
|
||||||
|
pony = MineLittlePony.getInstance().getManager().getPony(getEntityTexture(entity), false);
|
||||||
|
playerModel.apply(pony.getMetadata());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
protected final ResourceLocation getEntityTexture(T entity) {
|
protected final ResourceLocation getEntityTexture(T entity) {
|
||||||
|
|
Loading…
Reference in a new issue