mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Fixed villagers missing clothing. Closes #207
This commit is contained in:
parent
a7e2f09d39
commit
110d8fac90
3 changed files with 8 additions and 16 deletions
|
@ -21,7 +21,6 @@ import com.minelittlepony.mson.api.ModelContext;
|
|||
public class VillagerPonyModel<T extends LivingEntity & VillagerDataContainer> extends AlicornModel<T> implements ModelWithHat {
|
||||
|
||||
private final ModelPart apron;
|
||||
private final ModelPart trinket;
|
||||
|
||||
private IPart batWings;
|
||||
private IPart batEars;
|
||||
|
@ -29,7 +28,6 @@ public class VillagerPonyModel<T extends LivingEntity & VillagerDataContainer> e
|
|||
public VillagerPonyModel(ModelPart tree) {
|
||||
super(tree, false);
|
||||
apron = tree.getChild("apron");
|
||||
trinket = tree.getChild("trinket");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +57,6 @@ public class VillagerPonyModel<T extends LivingEntity & VillagerDataContainer> e
|
|||
protected void shakeBody(float move, float swing, float bodySwing, float ticks) {
|
||||
super.shakeBody(move, swing, bodySwing, ticks);
|
||||
apron.yaw = bodySwing;
|
||||
trinket.yaw = bodySwing;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,14 +67,12 @@ public class VillagerPonyModel<T extends LivingEntity & VillagerDataContainer> e
|
|||
|
||||
attributes.visualHeight += PonyTextures.isCrownPony(entity) ? 0.3F : -0.1F;
|
||||
apron.visible = !special && profession == VillagerProfession.BUTCHER;
|
||||
trinket.visible = !special && !apron.visible && profession != VillagerProfession.NONE && profession != VillagerProfession.NITWIT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBody(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
|
||||
super.renderBody(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
||||
apron.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
||||
//trinket.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -88,7 +88,7 @@ class NpcClothingFeature<
|
|||
Identifier key = new Identifier("minelittlepony", (typeId + "/" + profId + "/" + level).replace(':', '_'));
|
||||
|
||||
if (MinecraftClient.getInstance().getTextureManager().getOrDefault(key, null) == null) {
|
||||
TextureFlattener.flatten(computeTextures(type, profession, typeId, profId, level), (Identifier)key);
|
||||
TextureFlattener.flatten(computeTextures(type, profession, typeId, profId, level), key);
|
||||
}
|
||||
|
||||
return key;
|
||||
|
|
|
@ -19,14 +19,11 @@ public class TextureFlattener {
|
|||
MinecraftClient.getInstance().getTextureManager().registerTexture(output, new ResourceTexture(output) {
|
||||
@Override
|
||||
public void load(ResourceManager resManager) throws IOException {
|
||||
NativeImage image = null;
|
||||
|
||||
for (int i = 0; i < textures.size(); i++) {
|
||||
TextureData data = TextureData.load(resManager, textures.get(0));
|
||||
data.checkException();
|
||||
if (image == null) {
|
||||
image = data.getImage();
|
||||
} else {
|
||||
NativeImage image = TextureData.load(resManager, textures.get(0)).getImage();
|
||||
|
||||
for (int i = 1; i < textures.size(); i++) {
|
||||
try (TextureData data = TextureData.load(resManager, textures.get(i))) {
|
||||
copyOver(data.getImage(), image);
|
||||
}
|
||||
}
|
||||
|
@ -54,9 +51,9 @@ public class TextureFlattener {
|
|||
}
|
||||
|
||||
public static void copyOver(NativeImage from, NativeImage to, int x, int y, int w, int h) {
|
||||
for (; x < w; x++) {
|
||||
for (; y < h; y++) {
|
||||
copy(from, to, x, y);
|
||||
for (int xx = x; xx < w; xx++) {
|
||||
for (int yy = y; yy < h; yy++) {
|
||||
copy(from, to, xx, yy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue