mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 06:18:00 +01:00
Add a villager clothing layer
This commit is contained in:
parent
8c9ff0c553
commit
ab23f3ccec
3 changed files with 35 additions and 39 deletions
|
@ -1,17 +1,14 @@
|
||||||
package com.minelittlepony.client.render.entities;
|
package com.minelittlepony.client.render.entities;
|
||||||
|
|
||||||
import com.minelittlepony.client.model.entities.ModelVillagerPony;
|
import com.minelittlepony.client.model.entities.ModelVillagerPony;
|
||||||
|
import com.minelittlepony.client.render.layer.LayerVillagerClothing;
|
||||||
import com.minelittlepony.util.resources.FormattedTextureSupplier;
|
import com.minelittlepony.util.resources.FormattedTextureSupplier;
|
||||||
import com.minelittlepony.util.resources.ITextureSupplier;
|
import com.minelittlepony.util.resources.ITextureSupplier;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
|
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||||
import net.minecraft.client.render.entity.feature.VillagerClothingFeatureRenderer;
|
|
||||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
|
||||||
import net.minecraft.entity.passive.VillagerEntity;
|
import net.minecraft.entity.passive.VillagerEntity;
|
||||||
import net.minecraft.resource.ReloadableResourceManager;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class RenderPonyVillager extends RenderPonyMob.Caster<VillagerEntity, ModelVillagerPony<VillagerEntity>> {
|
public class RenderPonyVillager extends RenderPonyMob.Caster<VillagerEntity, ModelVillagerPony<VillagerEntity>> {
|
||||||
|
@ -27,21 +24,7 @@ public class RenderPonyVillager extends RenderPonyMob.Caster<VillagerEntity, Mod
|
||||||
@Override
|
@Override
|
||||||
protected void addLayers() {
|
protected void addLayers() {
|
||||||
super.addLayers();
|
super.addLayers();
|
||||||
ReloadableResourceManager resManager = (ReloadableResourceManager)MinecraftClient.getInstance().getResourceManager();
|
addFeature(new LayerVillagerClothing<>(this, "villager"));
|
||||||
|
|
||||||
addFeature(new VillagerClothingFeatureRenderer<>(this, resManager, "villager"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void bindTexture(Identifier texture) {
|
|
||||||
|
|
||||||
if (texture != SpriteAtlasTexture.BLOCK_ATLAS_TEX) {
|
|
||||||
if (!"minelittlepony".contentEquals(texture.getNamespace())) {
|
|
||||||
texture = new Identifier("minelittlepony", texture.getPath());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
super.bindTexture(texture);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,16 +1,13 @@
|
||||||
package com.minelittlepony.client.render.entities;
|
package com.minelittlepony.client.render.entities;
|
||||||
|
|
||||||
import com.minelittlepony.client.model.entities.ModelZombieVillagerPony;
|
import com.minelittlepony.client.model.entities.ModelZombieVillagerPony;
|
||||||
|
import com.minelittlepony.client.render.layer.LayerVillagerClothing;
|
||||||
import com.minelittlepony.util.resources.FormattedTextureSupplier;
|
import com.minelittlepony.util.resources.FormattedTextureSupplier;
|
||||||
import com.minelittlepony.util.resources.ITextureSupplier;
|
import com.minelittlepony.util.resources.ITextureSupplier;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
|
import net.fabricmc.fabric.api.client.render.EntityRendererRegistry;
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||||
import net.minecraft.client.render.entity.feature.VillagerClothingFeatureRenderer;
|
|
||||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
|
||||||
import net.minecraft.entity.mob.ZombieVillagerEntity;
|
import net.minecraft.entity.mob.ZombieVillagerEntity;
|
||||||
import net.minecraft.resource.ReloadableResourceManager;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class RenderPonyZombieVillager extends RenderPonyMob.Caster<ZombieVillagerEntity, ModelZombieVillagerPony> {
|
public class RenderPonyZombieVillager extends RenderPonyMob.Caster<ZombieVillagerEntity, ModelZombieVillagerPony> {
|
||||||
|
@ -26,24 +23,9 @@ public class RenderPonyZombieVillager extends RenderPonyMob.Caster<ZombieVillage
|
||||||
@Override
|
@Override
|
||||||
protected void addLayers() {
|
protected void addLayers() {
|
||||||
super.addLayers();
|
super.addLayers();
|
||||||
ReloadableResourceManager resManager = (ReloadableResourceManager)MinecraftClient.getInstance().getResourceManager();
|
addFeature(new LayerVillagerClothing<>(this, "zombie_villager"));
|
||||||
|
|
||||||
addFeature(new VillagerClothingFeatureRenderer<>(this, resManager, "zombie_villager"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void bindTexture(Identifier texture) {
|
|
||||||
|
|
||||||
if (texture != SpriteAtlasTexture.BLOCK_ATLAS_TEX) {
|
|
||||||
if (!"minelittlepony".contentEquals(texture.getNamespace())) {
|
|
||||||
texture = new Identifier("minelittlepony", texture.getPath());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
super.bindTexture(texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier findTexture(ZombieVillagerEntity entity) {
|
public Identifier findTexture(ZombieVillagerEntity entity) {
|
||||||
return PROFESSIONS.supplyTexture(entity);
|
return PROFESSIONS.supplyTexture(entity);
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.minelittlepony.client.render.layer;
|
||||||
|
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.render.entity.feature.FeatureRendererContext;
|
||||||
|
import net.minecraft.client.render.entity.feature.VillagerClothingFeatureRenderer;
|
||||||
|
import net.minecraft.client.render.entity.model.EntityModel;
|
||||||
|
import net.minecraft.client.render.entity.model.ModelWithHat;
|
||||||
|
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.resource.ReloadableResourceManager;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.village.VillagerDataContainer;
|
||||||
|
|
||||||
|
public class LayerVillagerClothing<T extends LivingEntity & VillagerDataContainer, M extends EntityModel<T> & ModelWithHat> extends VillagerClothingFeatureRenderer<T, M> {
|
||||||
|
|
||||||
|
public LayerVillagerClothing(FeatureRendererContext<T, M> context, String type) {
|
||||||
|
super(context, (ReloadableResourceManager)MinecraftClient.getInstance().getResourceManager(), type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void bindTexture(Identifier texture) {
|
||||||
|
|
||||||
|
if (texture != SpriteAtlasTexture.BLOCK_ATLAS_TEX) {
|
||||||
|
if (!"minelittlepony".contentEquals(texture.getNamespace())) {
|
||||||
|
texture = new Identifier("minelittlepony", texture.getPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
super.bindTexture(texture);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue