Fixed saddlebags sometimes inheriting the wrong texture

This commit is contained in:
Sollace 2018-10-20 20:08:57 +02:00
parent f66f78693f
commit fc69d2eedc
14 changed files with 35 additions and 20 deletions

View file

@ -8,6 +8,7 @@ import com.minelittlepony.render.RenderPony;
import com.minelittlepony.util.math.MathUtil;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
/**
* I Render Pony now, oky?
@ -23,6 +24,8 @@ public interface IRenderPony<T extends EntityLivingBase> {
RenderPony<T> getInternalRenderer();
ResourceLocation getTexture(T entity);
/**
* Called by riders to have their transportation adjust their position.
*/

View file

@ -118,4 +118,9 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> implemen
public RenderPony<EntityPonyModel> getInternalRenderer() {
return renderPony;
}
@Override
public ResourceLocation getTexture(EntityPonyModel entity) {
return getEntityTexture(entity);
}
}

View file

@ -107,8 +107,6 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
return renderPony;
}
protected abstract ResourceLocation getTexture(T entity);
public abstract static class Proxy<T extends EntityLiving> extends RenderPonyMob<T> {
public Proxy(List<LayerRenderer<T>> exportedLayers, RenderManager manager, ModelWrapper model) {

View file

@ -8,6 +8,7 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.google.common.collect.Lists;
import com.minelittlepony.ducks.IRenderPony;
import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.gear.IGear;
@ -30,7 +31,7 @@ public class LayerGear<T extends EntityLivingBase> extends AbstractPonyLayer<T>
new Stetson()
);
public LayerGear(RenderLivingBase<T> renderer) {
public <R extends RenderLivingBase<T> & IRenderPony<T>> LayerGear(R renderer) {
super(renderer);
}
@ -73,10 +74,12 @@ public class LayerGear<T extends EntityLivingBase> extends AbstractPonyLayer<T>
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
ResourceLocation texture = gear.getTexture(entity);
if (texture != null) {
getRenderer().bindTexture(texture);
if (texture == null) {
texture = getPonyRenderer().getTexture(entity);
}
getRenderer().bindTexture(texture);
gear.setLivingAnimations(model, entity);
gear.setRotationAndAngles(model.isGoingFast(), move, swing, model.getWobbleAmount(), ticks);
gear.renderPart(scale);

View file

@ -142,6 +142,11 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
return renderPony.getPony(player).getTexture();
}
@Override
public ResourceLocation getTexture(AbstractClientPlayer entity) {
return getEntityTexture(entity);
}
@Override
public ModelWrapper getModelWrapper() {
return renderPony.playerModel;
@ -156,4 +161,5 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
public RenderPony<AbstractClientPlayer> getInternalRenderer() {
return renderPony;
}
}

View file

@ -50,7 +50,7 @@ public class RenderEnderStallion extends RenderPonyMob<EntityEnderman> implement
}
@Override
protected ResourceLocation getTexture(EntityEnderman entity) {
public ResourceLocation getTexture(EntityEnderman entity) {
return ENDERMAN;
}

View file

@ -24,7 +24,7 @@ public class RenderPonyGuardian extends RenderGuardian {
ponyRenderer = new RenderPonyMob.Proxy<EntityGuardian>(layerRenderers, manager, PMAPI.seapony) {
@Override
protected ResourceLocation getTexture(EntityGuardian entity) {
public ResourceLocation getTexture(EntityGuardian entity) {
return RenderPonyGuardian.this.getTexture(entity);
}
};

View file

@ -42,7 +42,7 @@ public abstract class RenderPonyIllager<T extends AbstractIllager> extends Rende
}
@Override
protected ResourceLocation getTexture(EntityVindicator entity) {
public ResourceLocation getTexture(EntityVindicator entity) {
return VINDICATOR;
}
}
@ -54,7 +54,7 @@ public abstract class RenderPonyIllager<T extends AbstractIllager> extends Rende
}
@Override
protected ResourceLocation getTexture(EntityEvoker entity) {
public ResourceLocation getTexture(EntityEvoker entity) {
return EVOKER;
}
}
@ -66,7 +66,7 @@ public abstract class RenderPonyIllager<T extends AbstractIllager> extends Rende
}
@Override
protected ResourceLocation getTexture(EntityIllusionIllager entity) {
public ResourceLocation getTexture(EntityIllusionIllager entity) {
return ILLUSIONIST;
}

View file

@ -16,7 +16,7 @@ public class RenderPonyPigman extends RenderPonyMob<EntityPigZombie> {
}
@Override
protected ResourceLocation getTexture(EntityPigZombie entity) {
public ResourceLocation getTexture(EntityPigZombie entity) {
return PIGMAN;
}

View file

@ -21,7 +21,7 @@ public class RenderPonySkeleton<Skeleton extends AbstractSkeleton> extends Rende
}
@Override
protected ResourceLocation getTexture(Skeleton entity) {
public ResourceLocation getTexture(Skeleton entity) {
return SKELETON;
}
@ -33,7 +33,7 @@ public class RenderPonySkeleton<Skeleton extends AbstractSkeleton> extends Rende
}
@Override
protected ResourceLocation getTexture(EntityStray entity) {
public ResourceLocation getTexture(EntityStray entity) {
return STRAY;
}
}
@ -45,7 +45,7 @@ public class RenderPonySkeleton<Skeleton extends AbstractSkeleton> extends Rende
}
@Override
protected ResourceLocation getTexture(EntityWitherSkeleton entity) {
public ResourceLocation getTexture(EntityWitherSkeleton entity) {
return WITHER;
}

View file

@ -34,7 +34,7 @@ public class RenderPonyVillager extends RenderPonyMob<EntityVillager> {
}
@Override
protected ResourceLocation getTexture(EntityVillager entity) {
public ResourceLocation getTexture(EntityVillager entity) {
if ("Derpy".equals(entity.getCustomNameTag())) {
if (entity.isChild()) {
return EGG_2;

View file

@ -38,7 +38,7 @@ public class RenderPonyWitch extends RenderPonyMob<EntityWitch> {
}
@Override
protected ResourceLocation getTexture(EntityWitch entity) {
public ResourceLocation getTexture(EntityWitch entity) {
return WITCH_TEXTURES;
}
}

View file

@ -19,7 +19,7 @@ public class RenderPonyZombie<Zombie extends EntityZombie> extends RenderPonyMob
}
@Override
protected ResourceLocation getTexture(Zombie entity) {
public ResourceLocation getTexture(Zombie entity) {
return ZOMBIE;
}
@ -36,7 +36,7 @@ public class RenderPonyZombie<Zombie extends EntityZombie> extends RenderPonyMob
}
@Override
protected ResourceLocation getTexture(EntityHusk entity) {
public ResourceLocation getTexture(EntityHusk entity) {
return HUSK;
}
@ -55,7 +55,7 @@ public class RenderPonyZombie<Zombie extends EntityZombie> extends RenderPonyMob
}
@Override
protected ResourceLocation getTexture(EntityGiantZombie entity) {
public ResourceLocation getTexture(EntityGiantZombie entity) {
return ZOMBIE;
}
}

View file

@ -25,7 +25,7 @@ public class RenderPonyZombieVillager extends RenderPonyMob<EntityZombieVillager
}
@Override
protected ResourceLocation getTexture(EntityZombieVillager entity) {
public ResourceLocation getTexture(EntityZombieVillager entity) {
return PROFESSIONS.supplyTexture(entity.getProfession());
}