mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24: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 {
|
public class VillagerPonyModel<T extends LivingEntity & VillagerDataContainer> extends AlicornModel<T> implements ModelWithHat {
|
||||||
|
|
||||||
private final ModelPart apron;
|
private final ModelPart apron;
|
||||||
private final ModelPart trinket;
|
|
||||||
|
|
||||||
private IPart batWings;
|
private IPart batWings;
|
||||||
private IPart batEars;
|
private IPart batEars;
|
||||||
|
@ -29,7 +28,6 @@ public class VillagerPonyModel<T extends LivingEntity & VillagerDataContainer> e
|
||||||
public VillagerPonyModel(ModelPart tree) {
|
public VillagerPonyModel(ModelPart tree) {
|
||||||
super(tree, false);
|
super(tree, false);
|
||||||
apron = tree.getChild("apron");
|
apron = tree.getChild("apron");
|
||||||
trinket = tree.getChild("trinket");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -59,7 +57,6 @@ public class VillagerPonyModel<T extends LivingEntity & VillagerDataContainer> e
|
||||||
protected void shakeBody(float move, float swing, float bodySwing, float ticks) {
|
protected void shakeBody(float move, float swing, float bodySwing, float ticks) {
|
||||||
super.shakeBody(move, swing, bodySwing, ticks);
|
super.shakeBody(move, swing, bodySwing, ticks);
|
||||||
apron.yaw = bodySwing;
|
apron.yaw = bodySwing;
|
||||||
trinket.yaw = bodySwing;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -70,14 +67,12 @@ public class VillagerPonyModel<T extends LivingEntity & VillagerDataContainer> e
|
||||||
|
|
||||||
attributes.visualHeight += PonyTextures.isCrownPony(entity) ? 0.3F : -0.1F;
|
attributes.visualHeight += PonyTextures.isCrownPony(entity) ? 0.3F : -0.1F;
|
||||||
apron.visible = !special && profession == VillagerProfession.BUTCHER;
|
apron.visible = !special && profession == VillagerProfession.BUTCHER;
|
||||||
trinket.visible = !special && !apron.visible && profession != VillagerProfession.NONE && profession != VillagerProfession.NITWIT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderBody(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
|
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);
|
super.renderBody(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
|
||||||
apron.render(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
|
@Override
|
||||||
|
|
|
@ -88,7 +88,7 @@ class NpcClothingFeature<
|
||||||
Identifier key = new Identifier("minelittlepony", (typeId + "/" + profId + "/" + level).replace(':', '_'));
|
Identifier key = new Identifier("minelittlepony", (typeId + "/" + profId + "/" + level).replace(':', '_'));
|
||||||
|
|
||||||
if (MinecraftClient.getInstance().getTextureManager().getOrDefault(key, null) == null) {
|
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;
|
return key;
|
||||||
|
|
|
@ -19,14 +19,11 @@ public class TextureFlattener {
|
||||||
MinecraftClient.getInstance().getTextureManager().registerTexture(output, new ResourceTexture(output) {
|
MinecraftClient.getInstance().getTextureManager().registerTexture(output, new ResourceTexture(output) {
|
||||||
@Override
|
@Override
|
||||||
public void load(ResourceManager resManager) throws IOException {
|
public void load(ResourceManager resManager) throws IOException {
|
||||||
NativeImage image = null;
|
|
||||||
|
|
||||||
for (int i = 0; i < textures.size(); i++) {
|
NativeImage image = TextureData.load(resManager, textures.get(0)).getImage();
|
||||||
TextureData data = TextureData.load(resManager, textures.get(0));
|
|
||||||
data.checkException();
|
for (int i = 1; i < textures.size(); i++) {
|
||||||
if (image == null) {
|
try (TextureData data = TextureData.load(resManager, textures.get(i))) {
|
||||||
image = data.getImage();
|
|
||||||
} else {
|
|
||||||
copyOver(data.getImage(), image);
|
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) {
|
public static void copyOver(NativeImage from, NativeImage to, int x, int y, int w, int h) {
|
||||||
for (; x < w; x++) {
|
for (int xx = x; xx < w; xx++) {
|
||||||
for (; y < h; y++) {
|
for (int yy = y; yy < h; yy++) {
|
||||||
copy(from, to, x, y);
|
copy(from, to, xx, yy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue