mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 04:27:59 +01:00
Added a particle effect when switching from pony to seapony and back
This commit is contained in:
parent
3adfef141c
commit
65cf88e50a
2 changed files with 17 additions and 1 deletions
|
@ -2,9 +2,11 @@ package com.minelittlepony.render.player;
|
|||
|
||||
import com.minelittlepony.model.ModelWrapper;
|
||||
import com.minelittlepony.pony.data.IPony;
|
||||
import com.minelittlepony.util.math.MathUtil;
|
||||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
|
||||
public class RenderSeaponyPlayer extends RenderPonyPlayer {
|
||||
|
||||
|
@ -26,7 +28,17 @@ public class RenderSeaponyPlayer extends RenderPonyPlayer {
|
|||
|
||||
mainModel = renderPony.setPonyModel(wet ? seapony : normalPony);
|
||||
|
||||
float state = wet ? 100 : 0;
|
||||
float interpolated = pony.getMetadata().getInterpolator().interpolate("seapony_state", state, 5);
|
||||
|
||||
if (!MathUtil.compareFloats(interpolated, state)) {
|
||||
double x = player.posX + (player.getEntityWorld().rand.nextFloat() * 2) - 1;
|
||||
double y = player.posY + (player.getEntityWorld().rand.nextFloat() * 2);
|
||||
double z = player.posZ + (player.getEntityWorld().rand.nextFloat() * 2) - 1;
|
||||
|
||||
player.getEntityWorld().spawnParticle(EnumParticleTypes.END_ROD, x, y, z, 0, 0, 0);
|
||||
}
|
||||
|
||||
return pony;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,4 +37,8 @@ public class MathUtil {
|
|||
public static float interpolateRadians(float prev, float current, float partialTicks) {
|
||||
return (float)Math.toRadians(interpolateDegress(prev, current, partialTicks));
|
||||
}
|
||||
|
||||
public static boolean compareFloats(float a, float b) {
|
||||
return Math.abs(a - b) <= 0.001F;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue