Better way to handle the circle points
This commit is contained in:
parent
2398fbc8c9
commit
3d49eb2181
@ -603,8 +603,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
Creature zombie = entry.getKey();
|
||||
UtilParticle.PlayParticle(ParticleType.HEART, zombie.getLocation().add(0, 0.25, 0), 0.25f, 0.25f, 0.25f, 0, 1, ViewDist.NORMAL);
|
||||
TrueLoveData trueLoveData = entry.getValue();
|
||||
trueLoveData.updateVillager();
|
||||
trueLoveData.updateZombie();
|
||||
trueLoveData.update();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,11 @@
|
||||
package mineplex.core.pet;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.animation.AnimationPoint;
|
||||
import mineplex.core.common.animation.AnimatorEntity;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
|
||||
public class TrueLoveData
|
||||
{
|
||||
@ -21,6 +18,7 @@ public class TrueLoveData
|
||||
private int _step = 0;
|
||||
|
||||
private static final int POINTS = 12;
|
||||
private static final float RADIUS = 0.75F;
|
||||
|
||||
public TrueLoveData(Player player, Zombie zombie, Villager villager)
|
||||
{
|
||||
@ -29,7 +27,7 @@ public class TrueLoveData
|
||||
_villager = villager;
|
||||
}
|
||||
|
||||
public void updateVillager()
|
||||
/*public void updateVillager()
|
||||
{
|
||||
if (_animatorVillager == null || !_animatorVillager.isRunning())
|
||||
{
|
||||
@ -84,6 +82,20 @@ public class TrueLoveData
|
||||
}
|
||||
_animatorZombie.start(start);
|
||||
}
|
||||
}*/
|
||||
|
||||
public void update()
|
||||
{
|
||||
double increment = (2 * Math.PI) / POINTS;
|
||||
// Villager
|
||||
double angle = _step * increment;
|
||||
Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS);
|
||||
_villager.teleport(_player.getLocation().clone().add(vector));
|
||||
// Zombie
|
||||
angle = (_step - 5) * increment;
|
||||
vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS);
|
||||
_zombie.teleport(_player.getLocation().clone().add(vector));
|
||||
_step++;
|
||||
}
|
||||
|
||||
public void remove()
|
||||
|
Loading…
Reference in New Issue
Block a user