mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 13:57:59 +01:00
Remove the redundant findTexture and getTextureFor methods (likely leftovers of previous refactorings) and make it so all entities get their saddlebags from a separate texture
This commit is contained in:
parent
3ce2d75120
commit
73d85cf709
15 changed files with 30 additions and 45 deletions
|
@ -52,6 +52,9 @@ public interface IGear {
|
|||
*/
|
||||
<T extends Entity> Identifier getTexture(T entity, Context<T, ?> context);
|
||||
|
||||
/**
|
||||
* Gets the layer used to render this piece of gear.
|
||||
*/
|
||||
default <T extends Entity> RenderLayer getLayer(T entity, Context<T, ?> context) {
|
||||
return RenderLayer.getEntityTranslucent(getTexture(entity, context));
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.minelittlepony.api.model.BodyPart;
|
|||
import com.minelittlepony.api.model.PonyModelConstants;
|
||||
import com.minelittlepony.api.model.gear.IGear;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.util.MathUtil;
|
||||
|
@ -12,7 +11,6 @@ import com.minelittlepony.util.MathUtil;
|
|||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public interface IPonyRenderContext<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends PonyModelConstants, IGear.Context<T, M> {
|
||||
|
||||
|
@ -25,13 +23,6 @@ public interface IPonyRenderContext<T extends LivingEntity, M extends EntityMode
|
|||
|
||||
EquineRenderManager<T, M> getInternalRenderer();
|
||||
|
||||
Identifier findTexture(T entity);
|
||||
|
||||
@Override
|
||||
default Identifier getDefaultTexture(T entity, Wearable wearable) {
|
||||
return findTexture(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by riders to have their transportation adjust their position.
|
||||
*/
|
||||
|
|
|
@ -52,7 +52,7 @@ public class EnderStallionRenderer extends PonyRenderer<EndermanEntity, EnderSta
|
|||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(EndermanEntity entity) {
|
||||
public Identifier getTexture(EndermanEntity entity) {
|
||||
return ENDERMAN;
|
||||
}
|
||||
|
||||
|
|
|
@ -192,11 +192,6 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRen
|
|||
return manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(AbstractClientPlayerEntity entity) {
|
||||
return getTexture(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPony getEntityPony(AbstractClientPlayerEntity entity) {
|
||||
return MineLittlePony.getInstance().getManager().getPony(entity);
|
||||
|
@ -210,6 +205,6 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRen
|
|||
}
|
||||
}
|
||||
|
||||
return IPonyRenderContext.super.getDefaultTexture(entity, wearable);
|
||||
return getTexture(entity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class PonyPiglinRenderer extends PonyRenderer.Caster<HostileEntity, Pigli
|
|||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(HostileEntity entity) {
|
||||
public Identifier getTexture(HostileEntity entity) {
|
||||
return TEXTURES.get(entity.getType());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.minelittlepony.client.render.entity;
|
||||
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.client.model.ClientPonyModel;
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
|
@ -28,7 +29,7 @@ import net.minecraft.text.Text;
|
|||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.List;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import java.util.Locale;
|
||||
|
||||
public abstract class PonyRenderer<T extends MobEntity, M extends EntityModel<T> & IPonyModel<T>> extends MobEntityRenderer<T, M> implements IPonyRenderContext<T, M> {
|
||||
|
||||
|
@ -109,11 +110,10 @@ public abstract class PonyRenderer<T extends MobEntity, M extends EntityModel<T>
|
|||
stack.pop();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
@NotNull
|
||||
public final Identifier getTexture(T entity) {
|
||||
return findTexture(entity);
|
||||
public Identifier getDefaultTexture(T entity, Wearable wearable) {
|
||||
Identifier texture = getTexture(entity);
|
||||
return new Identifier(texture.getNamespace(), texture.getPath().split("\\.")[0] + "_" + wearable.name().toLowerCase(Locale.ROOT) + ".png");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -123,7 +123,7 @@ public abstract class PonyRenderer<T extends MobEntity, M extends EntityModel<T>
|
|||
|
||||
@Override
|
||||
public IPony getEntityPony(T entity) {
|
||||
return MineLittlePony.getInstance().getManager().getPony(findTexture(entity));
|
||||
return MineLittlePony.getInstance().getManager().getPony(getTexture(entity));
|
||||
}
|
||||
|
||||
public abstract static class Caster<T extends MobEntity, M extends ClientPonyModel<T>> extends PonyRenderer<T, M> {
|
||||
|
@ -152,9 +152,5 @@ public abstract class PonyRenderer<T extends MobEntity, M extends EntityModel<T>
|
|||
features.clear();
|
||||
super.addLayers(context);
|
||||
}
|
||||
|
||||
public final Identifier getTextureFor(T entity) {
|
||||
return super.getTexture(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class SeaponyRenderer extends GuardianEntityRenderer {
|
|||
features.clear();
|
||||
ponyRenderer = new Proxy<GuardianEntity, GuardianPonyModel>(features, context, ModelType.GUARDIAN) {
|
||||
@Override
|
||||
public Identifier findTexture(GuardianEntity entity) {
|
||||
public Identifier getTexture(GuardianEntity entity) {
|
||||
return SEAPONY;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class SeaponyRenderer extends GuardianEntityRenderer {
|
|||
@Override
|
||||
@NotNull
|
||||
public final Identifier getTexture(GuardianEntity entity) {
|
||||
return ponyRenderer.getTextureFor(entity);
|
||||
return ponyRenderer.getTexture(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,7 +24,7 @@ public class SkeleponyRenderer<Skeleton extends AbstractSkeletonEntity> extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(Skeleton entity) {
|
||||
public Identifier getTexture(Skeleton entity) {
|
||||
return SKELETON;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class SkeleponyRenderer<Skeleton extends AbstractSkeletonEntity> extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(StrayEntity entity) {
|
||||
public Identifier getTexture(StrayEntity entity) {
|
||||
return STRAY;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class SkeleponyRenderer<Skeleton extends AbstractSkeletonEntity> extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(WitherSkeletonEntity entity) {
|
||||
public Identifier getTexture(WitherSkeletonEntity entity) {
|
||||
return WITHER;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class WitchRenderer extends PonyRenderer<WitchEntity, WitchPonyModel> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(WitchEntity entity) {
|
||||
public Identifier getTexture(WitchEntity entity) {
|
||||
return WITCH_TEXTURES;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class ZomponyRenderer<Zombie extends ZombieEntity> extends PonyRenderer.C
|
|||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(Zombie entity) {
|
||||
public Identifier getTexture(Zombie entity) {
|
||||
return ZOMBIE;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class ZomponyRenderer<Zombie extends ZombieEntity> extends PonyRenderer.C
|
|||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(DrownedEntity entity) {
|
||||
public Identifier getTexture(DrownedEntity entity) {
|
||||
return DROWNED;
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class ZomponyRenderer<Zombie extends ZombieEntity> extends PonyRenderer.C
|
|||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(HuskEntity entity) {
|
||||
public Identifier getTexture(HuskEntity entity) {
|
||||
return HUSK;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class ZomponyRenderer<Zombie extends ZombieEntity> extends PonyRenderer.C
|
|||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(GiantEntity entity) {
|
||||
public Identifier getTexture(GiantEntity entity) {
|
||||
return ZOMBIE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public class GearFeature<T extends LivingEntity, M extends EntityModel<T> & IPon
|
|||
|
||||
private void renderGear(M model, T entity, IGear gear, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, float limbDistance, float limbAngle, float tickDelta) {
|
||||
gear.pose(model, entity, model.getAttributes().isGoingFast, entity.getUuid(), limbDistance, limbAngle, model.getWobbleAmount(), tickDelta);
|
||||
gear.render(stack, renderContext.getBuffer(RenderLayer.getEntityTranslucent(gear.getTexture(entity, getContext()))), lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1, entity.getUuid());
|
||||
gear.render(stack, renderContext.getBuffer(gear.getLayer(entity, getContext())), lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1, entity.getUuid());
|
||||
}
|
||||
|
||||
static record Entry(IGear gear, Wearable wearable) {}
|
||||
|
|
|
@ -78,11 +78,11 @@ abstract class AbstractNpcRenderer<T extends MobEntity & VillagerDataContainer>
|
|||
if (wearable == Wearable.SADDLE_BAGS) {
|
||||
return clothing.createTexture(villager, "accessory");
|
||||
}
|
||||
return super.getDefaultTexture(villager, wearable);
|
||||
return getTexture(villager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(T villager) {
|
||||
public Identifier getTexture(T villager) {
|
||||
return baseTextures.supplyTexture(villager);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public abstract class IllagerPonyRenderer<T extends IllagerEntity> extends PonyR
|
|||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(VindicatorEntity entity) {
|
||||
public Identifier getTexture(VindicatorEntity entity) {
|
||||
return VINDICATOR;
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public abstract class IllagerPonyRenderer<T extends IllagerEntity> extends PonyR
|
|||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(EvokerEntity entity) {
|
||||
public Identifier getTexture(EvokerEntity entity) {
|
||||
return EVOKER;
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public abstract class IllagerPonyRenderer<T extends IllagerEntity> extends PonyR
|
|||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(IllusionerEntity entity) {
|
||||
public Identifier getTexture(IllusionerEntity entity) {
|
||||
return ILLUSIONIST;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ public class PillagerRenderer extends PonyRenderer<PillagerEntity, PillagerPonyM
|
|||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(PillagerEntity entity) {
|
||||
public Identifier getTexture(PillagerEntity entity) {
|
||||
return TEXTURES;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ public class TraderRenderer extends PonyRenderer.Caster<WanderingTraderEntity, A
|
|||
}
|
||||
|
||||
@Override
|
||||
public Identifier findTexture(WanderingTraderEntity entity) {
|
||||
public Identifier getTexture(WanderingTraderEntity entity) {
|
||||
return TEXTURE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue