mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 13:57:59 +01:00
Fixed body parts not being properly hidden/made visible again by the game when clothing is enabled. Fixes #236
This commit is contained in:
parent
d438d0f5bb
commit
e55b17f3a7
3 changed files with 30 additions and 27 deletions
|
@ -3,12 +3,10 @@ package com.minelittlepony.client.model.entity.race;
|
|||
import com.minelittlepony.client.model.armour.PonyArmourModel;
|
||||
import com.minelittlepony.mson.api.ModelView;
|
||||
import com.minelittlepony.api.model.*;
|
||||
import com.minelittlepony.api.model.armour.ArmourLayer;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
|
@ -25,6 +23,15 @@ public class SeaponyModel<T extends LivingEntity> extends UnicornModel<T> {
|
|||
leftFin = tree.getChild("left_fin");
|
||||
rightFin = tree.getChild("right_fin");
|
||||
centerFin = tree.getChild("center_fin");
|
||||
|
||||
jacket.hidden = true;
|
||||
|
||||
leftPants.hidden = true;
|
||||
rightPants.hidden = true;
|
||||
leftSleeve.hidden = true;
|
||||
rightSleeve.hidden = true;
|
||||
leftLeg.hidden = true;
|
||||
rightLeg.hidden = true;
|
||||
}
|
||||
|
||||
public SeaponyModel(ModelPart tree) {
|
||||
|
@ -112,17 +119,6 @@ public class SeaponyModel<T extends LivingEntity> extends UnicornModel<T> {
|
|||
@Override
|
||||
public void setVisible(boolean visible) {
|
||||
super.setVisible(visible);
|
||||
|
||||
leftSleeve.visible = false;
|
||||
rightSleeve.visible = false;
|
||||
jacket.visible = false;
|
||||
|
||||
// hide the back legs
|
||||
leftLeg.visible = false;
|
||||
rightLeg.visible = false;
|
||||
leftPants.visible = false;
|
||||
rightPants.visible = false;
|
||||
|
||||
leftFin.visible = visible;
|
||||
centerFin.visible = visible;
|
||||
rightFin.visible = visible;
|
||||
|
@ -132,14 +128,8 @@ public class SeaponyModel<T extends LivingEntity> extends UnicornModel<T> {
|
|||
|
||||
public Armour(ModelPart tree) {
|
||||
super(tree);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setVisibilities(EquipmentSlot slot, ArmourLayer layer) {
|
||||
boolean result = super.setVisibilities(slot, layer);
|
||||
rightLeg.visible = false;
|
||||
leftLeg.visible = false;
|
||||
return result;
|
||||
rightLeg.hidden = true;
|
||||
leftLeg.hidden = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,7 +8,9 @@ import com.minelittlepony.client.model.*;
|
|||
import com.minelittlepony.util.MathUtil;
|
||||
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
|
@ -28,14 +30,18 @@ public class PlayerSeaponyRenderer extends PlayerPonyRenderer {
|
|||
|
||||
@Override
|
||||
public Identifier getTexture(AbstractClientPlayerEntity player) {
|
||||
if (PonyPosture.isPartiallySubmerged(player)) {
|
||||
return SkinsProxy.instance.getSkin(SKIN_TYPE_ID, player).orElseGet(() -> super.getTexture(player));
|
||||
}
|
||||
return super.getTexture(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPony getEntityPony(AbstractClientPlayerEntity player) {
|
||||
IPony pony = super.getEntityPony(player);
|
||||
|
||||
boolean wet = PonyPosture.isPartiallySubmerged(player);
|
||||
public void render(AbstractClientPlayerEntity player, float entityYaw, float tickDelta, MatrixStack stack, VertexConsumerProvider renderContext, int light) {
|
||||
IPony pony = getEntityPony(player);
|
||||
boolean wet =
|
||||
(pony.race() == Race.SEAPONY || SkinsProxy.instance.getSkin(SKIN_TYPE_ID, player).isPresent())
|
||||
&& PonyPosture.isPartiallySubmerged(player);
|
||||
|
||||
model = manager.setModel(wet ? seapony : normalPony).body();
|
||||
|
||||
|
@ -50,6 +56,6 @@ public class PlayerSeaponyRenderer extends PlayerPonyRenderer {
|
|||
player.getEntityWorld().addParticle(ParticleTypes.END_ROD, x, y, z, 0, 0, 0);
|
||||
}
|
||||
|
||||
return pony;
|
||||
super.render(player, entityYaw, tickDelta, stack, renderContext, light);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,13 @@
|
|||
"children": {
|
||||
"tail_stub": {}
|
||||
}
|
||||
},
|
||||
"jacket": {
|
||||
"texture": { "u": 24, "v": 0 },
|
||||
"dilate": 0.25,
|
||||
"cubes": [
|
||||
{ "from": [-4, 4, -2], "size": [ 8, 8, 4 ], "texture": { "u": 16, "v": 32 }, "dilate": 0.25 }
|
||||
]
|
||||
},
|
||||
"tail": {
|
||||
"implementation": "com.minelittlepony.client.model.part.SeaponyTail",
|
||||
|
|
Loading…
Reference in a new issue