mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Fixed seapony previews in the skinning gui
This commit is contained in:
parent
9a59f2444e
commit
627adab1f6
4 changed files with 21 additions and 11 deletions
|
@ -1,6 +1,7 @@
|
||||||
package com.minelittlepony.api.pony;
|
package com.minelittlepony.api.pony;
|
||||||
|
|
||||||
import com.minelittlepony.api.pony.meta.Race;
|
import com.minelittlepony.api.pony.meta.Race;
|
||||||
|
import com.minelittlepony.client.IPreviewModel;
|
||||||
import com.minelittlepony.client.SkinsProxy;
|
import com.minelittlepony.client.SkinsProxy;
|
||||||
import com.minelittlepony.client.render.entity.AquaticPlayerPonyRenderer;
|
import com.minelittlepony.client.render.entity.AquaticPlayerPonyRenderer;
|
||||||
|
|
||||||
|
@ -88,10 +89,16 @@ public final class PonyPosture {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSeaponyModifier(LivingEntity entity) {
|
public static boolean isSeaponyModifier(LivingEntity entity) {
|
||||||
|
if (entity instanceof IPreviewModel preview) {
|
||||||
|
return preview.forceSeapony();
|
||||||
|
}
|
||||||
return hasSeaponyForm(entity) && isPartiallySubmerged(entity);
|
return hasSeaponyForm(entity) && isPartiallySubmerged(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasSeaponyForm(LivingEntity entity) {
|
public static boolean hasSeaponyForm(LivingEntity entity) {
|
||||||
|
if (entity instanceof IPreviewModel preview) {
|
||||||
|
return preview.forceSeapony();
|
||||||
|
}
|
||||||
return IPony.getManager().getPony(entity).filter(pony -> {
|
return IPony.getManager().getPony(entity).filter(pony -> {
|
||||||
return (pony.race() == Race.SEAPONY
|
return (pony.race() == Race.SEAPONY
|
||||||
|| (entity instanceof AbstractClientPlayerEntity player && SkinsProxy.instance.getSkin(AquaticPlayerPonyRenderer.SKIN_TYPE_ID, player).isPresent())
|
|| (entity instanceof AbstractClientPlayerEntity player && SkinsProxy.instance.getSkin(AquaticPlayerPonyRenderer.SKIN_TYPE_ID, player).isPresent())
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package com.minelittlepony.client;
|
package com.minelittlepony.client;
|
||||||
|
|
||||||
public interface IPreviewModel {
|
public interface IPreviewModel {
|
||||||
|
boolean forceSeapony();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ class DummyPony extends DummyPlayer implements IPreviewModel, IPonyManager.Force
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSubmergedInWater() {
|
public boolean forceSeapony() {
|
||||||
return getTextures().getPosture().getActiveSkinType() == MineLPHDSkins.seaponySkinType || super.isSubmergedInWater();
|
return getTextures().getPosture().getActiveSkinType() == MineLPHDSkins.seaponySkinType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.minelittlepony.client.render.entity;
|
||||||
import com.minelittlepony.api.pony.IPony;
|
import com.minelittlepony.api.pony.IPony;
|
||||||
import com.minelittlepony.api.pony.PonyPosture;
|
import com.minelittlepony.api.pony.PonyPosture;
|
||||||
import com.minelittlepony.api.pony.meta.Race;
|
import com.minelittlepony.api.pony.meta.Race;
|
||||||
|
import com.minelittlepony.client.IPreviewModel;
|
||||||
import com.minelittlepony.client.SkinsProxy;
|
import com.minelittlepony.client.SkinsProxy;
|
||||||
import com.minelittlepony.util.MathUtil;
|
import com.minelittlepony.util.MathUtil;
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ public class AquaticPlayerPonyRenderer extends PlayerPonyRenderer {
|
||||||
updateSeaponyState(player);
|
updateSeaponyState(player);
|
||||||
super.render(player, entityYaw, tickDelta, stack, renderContext, light);
|
super.render(player, entityYaw, tickDelta, stack, renderContext, light);
|
||||||
|
|
||||||
if (wet && player.getVelocity().length() > 0.1F) {
|
if (!(player instanceof IPreviewModel) && wet && player.getVelocity().length() > 0.1F) {
|
||||||
double x = player.getEntityWorld().getRandom().nextTriangular(player.getX(), 1);
|
double x = player.getEntityWorld().getRandom().nextTriangular(player.getX(), 1);
|
||||||
double y = player.getEntityWorld().getRandom().nextTriangular(player.getY(), 1);
|
double y = player.getEntityWorld().getRandom().nextTriangular(player.getY(), 1);
|
||||||
double z = player.getEntityWorld().getRandom().nextTriangular(player.getZ(), 1);
|
double z = player.getEntityWorld().getRandom().nextTriangular(player.getZ(), 1);
|
||||||
|
@ -71,15 +72,17 @@ public class AquaticPlayerPonyRenderer extends PlayerPonyRenderer {
|
||||||
IPony pony = getEntityPony(player);
|
IPony pony = getEntityPony(player);
|
||||||
wet = PonyPosture.isSeaponyModifier(player);
|
wet = PonyPosture.isSeaponyModifier(player);
|
||||||
|
|
||||||
float state = wet ? 100 : 0;
|
if (!(player instanceof IPreviewModel)) {
|
||||||
float interpolated = pony.metadata().getInterpolator(player.getUuid()).interpolate("seapony_state", state, 5);
|
float state = wet ? 100 : 0;
|
||||||
|
float interpolated = pony.metadata().getInterpolator(player.getUuid()).interpolate("seapony_state", state, 5);
|
||||||
|
|
||||||
if (!MathUtil.compareFloats(interpolated, state)) {
|
if (!MathUtil.compareFloats(interpolated, state)) {
|
||||||
double x = player.getEntityWorld().getRandom().nextTriangular(player.getX(), 1);
|
double x = player.getEntityWorld().getRandom().nextTriangular(player.getX(), 1);
|
||||||
double y = player.getEntityWorld().getRandom().nextTriangular(player.getY() + player.getHeight() * 0.5F, 1);
|
double y = player.getEntityWorld().getRandom().nextTriangular(player.getY() + player.getHeight() * 0.5F, 1);
|
||||||
double z = player.getEntityWorld().getRandom().nextTriangular(player.getZ(), 1);
|
double z = player.getEntityWorld().getRandom().nextTriangular(player.getZ(), 1);
|
||||||
|
|
||||||
player.getEntityWorld().addParticle(ParticleTypes.END_ROD, x, y, z, 0, 0, 0);
|
player.getEntityWorld().addParticle(ParticleTypes.END_ROD, x, y, z, 0, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue