From fc69d2eedcc26cfdb79430e310f9650620fd5580 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 20 Oct 2018 20:08:57 +0200 Subject: [PATCH] Fixed saddlebags sometimes inheriting the wrong texture --- src/main/java/com/minelittlepony/ducks/IRenderPony.java | 3 +++ .../com/minelittlepony/hdskins/gui/RenderPonyModel.java | 5 +++++ .../java/com/minelittlepony/render/RenderPonyMob.java | 2 -- .../java/com/minelittlepony/render/layer/LayerGear.java | 9 ++++++--- .../minelittlepony/render/player/RenderPonyPlayer.java | 6 ++++++ .../render/ponies/RenderEnderStallion.java | 2 +- .../minelittlepony/render/ponies/RenderPonyGuardian.java | 2 +- .../minelittlepony/render/ponies/RenderPonyIllager.java | 6 +++--- .../minelittlepony/render/ponies/RenderPonyPigman.java | 2 +- .../minelittlepony/render/ponies/RenderPonySkeleton.java | 6 +++--- .../minelittlepony/render/ponies/RenderPonyVillager.java | 2 +- .../minelittlepony/render/ponies/RenderPonyWitch.java | 2 +- .../minelittlepony/render/ponies/RenderPonyZombie.java | 6 +++--- .../render/ponies/RenderPonyZombieVillager.java | 2 +- 14 files changed, 35 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/minelittlepony/ducks/IRenderPony.java b/src/main/java/com/minelittlepony/ducks/IRenderPony.java index 023668eb..466e0c07 100644 --- a/src/main/java/com/minelittlepony/ducks/IRenderPony.java +++ b/src/main/java/com/minelittlepony/ducks/IRenderPony.java @@ -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 { RenderPony getInternalRenderer(); + ResourceLocation getTexture(T entity); + /** * Called by riders to have their transportation adjust their position. */ diff --git a/src/main/java/com/minelittlepony/hdskins/gui/RenderPonyModel.java b/src/main/java/com/minelittlepony/hdskins/gui/RenderPonyModel.java index 394ba576..e1c9c967 100644 --- a/src/main/java/com/minelittlepony/hdskins/gui/RenderPonyModel.java +++ b/src/main/java/com/minelittlepony/hdskins/gui/RenderPonyModel.java @@ -118,4 +118,9 @@ public class RenderPonyModel extends RenderPlayerModel implemen public RenderPony getInternalRenderer() { return renderPony; } + + @Override + public ResourceLocation getTexture(EntityPonyModel entity) { + return getEntityTexture(entity); + } } diff --git a/src/main/java/com/minelittlepony/render/RenderPonyMob.java b/src/main/java/com/minelittlepony/render/RenderPonyMob.java index 7fab92d0..b56d2bf2 100644 --- a/src/main/java/com/minelittlepony/render/RenderPonyMob.java +++ b/src/main/java/com/minelittlepony/render/RenderPonyMob.java @@ -107,8 +107,6 @@ public abstract class RenderPonyMob extends RenderLiving return renderPony; } - protected abstract ResourceLocation getTexture(T entity); - public abstract static class Proxy extends RenderPonyMob { public Proxy(List> exportedLayers, RenderManager manager, ModelWrapper model) { diff --git a/src/main/java/com/minelittlepony/render/layer/LayerGear.java b/src/main/java/com/minelittlepony/render/layer/LayerGear.java index 85e0c2d1..9d2ee580 100644 --- a/src/main/java/com/minelittlepony/render/layer/LayerGear.java +++ b/src/main/java/com/minelittlepony/render/layer/LayerGear.java @@ -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 extends AbstractPonyLayer new Stetson() ); - public LayerGear(RenderLivingBase renderer) { + public & IRenderPony> LayerGear(R renderer) { super(renderer); } @@ -73,10 +74,12 @@ public class LayerGear extends AbstractPonyLayer 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); diff --git a/src/main/java/com/minelittlepony/render/player/RenderPonyPlayer.java b/src/main/java/com/minelittlepony/render/player/RenderPonyPlayer.java index 070692d0..427e5417 100644 --- a/src/main/java/com/minelittlepony/render/player/RenderPonyPlayer.java +++ b/src/main/java/com/minelittlepony/render/player/RenderPonyPlayer.java @@ -142,6 +142,11 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony getInternalRenderer() { return renderPony; } + } diff --git a/src/main/java/com/minelittlepony/render/ponies/RenderEnderStallion.java b/src/main/java/com/minelittlepony/render/ponies/RenderEnderStallion.java index c3b0580d..f09c727d 100644 --- a/src/main/java/com/minelittlepony/render/ponies/RenderEnderStallion.java +++ b/src/main/java/com/minelittlepony/render/ponies/RenderEnderStallion.java @@ -50,7 +50,7 @@ public class RenderEnderStallion extends RenderPonyMob implement } @Override - protected ResourceLocation getTexture(EntityEnderman entity) { + public ResourceLocation getTexture(EntityEnderman entity) { return ENDERMAN; } diff --git a/src/main/java/com/minelittlepony/render/ponies/RenderPonyGuardian.java b/src/main/java/com/minelittlepony/render/ponies/RenderPonyGuardian.java index 626f185a..977fd048 100644 --- a/src/main/java/com/minelittlepony/render/ponies/RenderPonyGuardian.java +++ b/src/main/java/com/minelittlepony/render/ponies/RenderPonyGuardian.java @@ -24,7 +24,7 @@ public class RenderPonyGuardian extends RenderGuardian { ponyRenderer = new RenderPonyMob.Proxy(layerRenderers, manager, PMAPI.seapony) { @Override - protected ResourceLocation getTexture(EntityGuardian entity) { + public ResourceLocation getTexture(EntityGuardian entity) { return RenderPonyGuardian.this.getTexture(entity); } }; diff --git a/src/main/java/com/minelittlepony/render/ponies/RenderPonyIllager.java b/src/main/java/com/minelittlepony/render/ponies/RenderPonyIllager.java index 38becc51..bcd822f3 100644 --- a/src/main/java/com/minelittlepony/render/ponies/RenderPonyIllager.java +++ b/src/main/java/com/minelittlepony/render/ponies/RenderPonyIllager.java @@ -42,7 +42,7 @@ public abstract class RenderPonyIllager extends Rende } @Override - protected ResourceLocation getTexture(EntityVindicator entity) { + public ResourceLocation getTexture(EntityVindicator entity) { return VINDICATOR; } } @@ -54,7 +54,7 @@ public abstract class RenderPonyIllager extends Rende } @Override - protected ResourceLocation getTexture(EntityEvoker entity) { + public ResourceLocation getTexture(EntityEvoker entity) { return EVOKER; } } @@ -66,7 +66,7 @@ public abstract class RenderPonyIllager extends Rende } @Override - protected ResourceLocation getTexture(EntityIllusionIllager entity) { + public ResourceLocation getTexture(EntityIllusionIllager entity) { return ILLUSIONIST; } diff --git a/src/main/java/com/minelittlepony/render/ponies/RenderPonyPigman.java b/src/main/java/com/minelittlepony/render/ponies/RenderPonyPigman.java index 4e708102..695ae40e 100644 --- a/src/main/java/com/minelittlepony/render/ponies/RenderPonyPigman.java +++ b/src/main/java/com/minelittlepony/render/ponies/RenderPonyPigman.java @@ -16,7 +16,7 @@ public class RenderPonyPigman extends RenderPonyMob { } @Override - protected ResourceLocation getTexture(EntityPigZombie entity) { + public ResourceLocation getTexture(EntityPigZombie entity) { return PIGMAN; } diff --git a/src/main/java/com/minelittlepony/render/ponies/RenderPonySkeleton.java b/src/main/java/com/minelittlepony/render/ponies/RenderPonySkeleton.java index 827acc93..6faa5751 100644 --- a/src/main/java/com/minelittlepony/render/ponies/RenderPonySkeleton.java +++ b/src/main/java/com/minelittlepony/render/ponies/RenderPonySkeleton.java @@ -21,7 +21,7 @@ public class RenderPonySkeleton extends Rende } @Override - protected ResourceLocation getTexture(Skeleton entity) { + public ResourceLocation getTexture(Skeleton entity) { return SKELETON; } @@ -33,7 +33,7 @@ public class RenderPonySkeleton extends Rende } @Override - protected ResourceLocation getTexture(EntityStray entity) { + public ResourceLocation getTexture(EntityStray entity) { return STRAY; } } @@ -45,7 +45,7 @@ public class RenderPonySkeleton extends Rende } @Override - protected ResourceLocation getTexture(EntityWitherSkeleton entity) { + public ResourceLocation getTexture(EntityWitherSkeleton entity) { return WITHER; } diff --git a/src/main/java/com/minelittlepony/render/ponies/RenderPonyVillager.java b/src/main/java/com/minelittlepony/render/ponies/RenderPonyVillager.java index 2cec367c..843d190a 100644 --- a/src/main/java/com/minelittlepony/render/ponies/RenderPonyVillager.java +++ b/src/main/java/com/minelittlepony/render/ponies/RenderPonyVillager.java @@ -34,7 +34,7 @@ public class RenderPonyVillager extends RenderPonyMob { } @Override - protected ResourceLocation getTexture(EntityVillager entity) { + public ResourceLocation getTexture(EntityVillager entity) { if ("Derpy".equals(entity.getCustomNameTag())) { if (entity.isChild()) { return EGG_2; diff --git a/src/main/java/com/minelittlepony/render/ponies/RenderPonyWitch.java b/src/main/java/com/minelittlepony/render/ponies/RenderPonyWitch.java index 72609753..ceef4a4f 100644 --- a/src/main/java/com/minelittlepony/render/ponies/RenderPonyWitch.java +++ b/src/main/java/com/minelittlepony/render/ponies/RenderPonyWitch.java @@ -38,7 +38,7 @@ public class RenderPonyWitch extends RenderPonyMob { } @Override - protected ResourceLocation getTexture(EntityWitch entity) { + public ResourceLocation getTexture(EntityWitch entity) { return WITCH_TEXTURES; } } diff --git a/src/main/java/com/minelittlepony/render/ponies/RenderPonyZombie.java b/src/main/java/com/minelittlepony/render/ponies/RenderPonyZombie.java index b9364c7d..08233027 100644 --- a/src/main/java/com/minelittlepony/render/ponies/RenderPonyZombie.java +++ b/src/main/java/com/minelittlepony/render/ponies/RenderPonyZombie.java @@ -19,7 +19,7 @@ public class RenderPonyZombie extends RenderPonyMob } @Override - protected ResourceLocation getTexture(Zombie entity) { + public ResourceLocation getTexture(Zombie entity) { return ZOMBIE; } @@ -36,7 +36,7 @@ public class RenderPonyZombie extends RenderPonyMob } @Override - protected ResourceLocation getTexture(EntityHusk entity) { + public ResourceLocation getTexture(EntityHusk entity) { return HUSK; } @@ -55,7 +55,7 @@ public class RenderPonyZombie extends RenderPonyMob } @Override - protected ResourceLocation getTexture(EntityGiantZombie entity) { + public ResourceLocation getTexture(EntityGiantZombie entity) { return ZOMBIE; } } diff --git a/src/main/java/com/minelittlepony/render/ponies/RenderPonyZombieVillager.java b/src/main/java/com/minelittlepony/render/ponies/RenderPonyZombieVillager.java index ba17028e..170a1a70 100644 --- a/src/main/java/com/minelittlepony/render/ponies/RenderPonyZombieVillager.java +++ b/src/main/java/com/minelittlepony/render/ponies/RenderPonyZombieVillager.java @@ -25,7 +25,7 @@ public class RenderPonyZombieVillager extends RenderPonyMob