Fixed sync with dragon and fixed guardian not showing
This commit is contained in:
parent
5fe5c613e5
commit
ac0339fc59
|
@ -65,6 +65,32 @@ public class WinEffectRankEternal extends WinEffectRankBased
|
||||||
_step = 0;
|
_step = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void spawnGuardian(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.TICK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_guardian != null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isRunning())
|
||||||
|
return;
|
||||||
|
|
||||||
|
_step++;
|
||||||
|
|
||||||
|
if (_step == 5)
|
||||||
|
{
|
||||||
|
Location npcLocation = _npc.getEntity().getBukkitEntity().getLocation();
|
||||||
|
Manager.getPetManager().getCreatureModule().SetForce(true);
|
||||||
|
_guardian = npcLocation.getWorld().spawn(npcLocation, Guardian.class);
|
||||||
|
Manager.getPetManager().getCreatureModule().SetForce(false);
|
||||||
|
_step = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onUpdate(UpdateEvent event)
|
public void onUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
|
@ -74,22 +100,20 @@ public class WinEffectRankEternal extends WinEffectRankBased
|
||||||
if (event.getType() != UpdateType.FASTEST)
|
if (event.getType() != UpdateType.FASTEST)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (_guardian == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Location npcLocation = _npc.getEntity().getBukkitEntity().getLocation();
|
Location npcLocation = _npc.getEntity().getBukkitEntity().getLocation();
|
||||||
|
|
||||||
_step++;
|
_step++;
|
||||||
|
|
||||||
if (_guardian == null)
|
|
||||||
{
|
|
||||||
Manager.getPetManager().getCreatureModule().SetForce(true);
|
|
||||||
_guardian = npcLocation.getWorld().spawn(npcLocation.add(0, 20, 0), Guardian.class);
|
|
||||||
Manager.getPetManager().getCreatureModule().SetForce(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
double increment = (2 * Math.PI) / POINTS;
|
double increment = (2 * Math.PI) / POINTS;
|
||||||
double angle = _step * increment;
|
double angle = _step * increment;
|
||||||
Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS);
|
Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS);
|
||||||
_guardian.setVelocity(new Vector(0,0,0));
|
_guardian.setVelocity(new Vector(0,0,0));
|
||||||
_guardian.teleport(_player.getLocation().clone().subtract(vector));
|
_guardian.teleport(npcLocation.clone().subtract(vector));
|
||||||
Vector direction = npcLocation.toVector().subtract(_guardian.getEyeLocation().toVector());
|
Vector direction = npcLocation.toVector().subtract(_guardian.getEyeLocation().toVector());
|
||||||
Location enderLocation = _guardian.getLocation().setDirection(direction);
|
Location enderLocation = _guardian.getLocation().setDirection(direction);
|
||||||
_guardian.teleport(enderLocation);
|
_guardian.teleport(enderLocation);
|
||||||
|
|
|
@ -71,10 +71,10 @@ public class WinEffectRankHero extends WinEffectRankBased
|
||||||
if (!isRunning())
|
if (!isRunning())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_step > 65)
|
if (_step > 62)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_step == 65)
|
if (_step == 62)
|
||||||
{
|
{
|
||||||
breakBlocks();
|
breakBlocks();
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ public class WinEffectRankHero extends WinEffectRankBased
|
||||||
double angle = _step * increment;
|
double angle = _step * increment;
|
||||||
Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS);
|
Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS);
|
||||||
_enderDragon.setVelocity(new Vector(0, 0, 0));
|
_enderDragon.setVelocity(new Vector(0, 0, 0));
|
||||||
_enderDragon.teleport(_player.getLocation().clone().subtract(vector));
|
_enderDragon.teleport(npcLocation.clone().subtract(vector));
|
||||||
Vector direction = npcLocation.toVector().subtract(_enderDragon.getEyeLocation().toVector()).multiply(-1);
|
Vector direction = npcLocation.toVector().subtract(_enderDragon.getEyeLocation().toVector()).multiply(-1);
|
||||||
Location enderLocation = _enderDragon.getLocation().setDirection(direction);
|
Location enderLocation = _enderDragon.getLocation().setDirection(direction);
|
||||||
_enderDragon.teleport(enderLocation);
|
_enderDragon.teleport(enderLocation);
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class WinEffectRankLegend extends WinEffectRankBased
|
||||||
double angle = _step * increment;
|
double angle = _step * increment;
|
||||||
Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS);
|
Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS);
|
||||||
_wither.setVelocity(new Vector(0,0,0));
|
_wither.setVelocity(new Vector(0,0,0));
|
||||||
_wither.teleport(_player.getLocation().clone().subtract(vector));
|
_wither.teleport(npcLocation.clone().subtract(vector));
|
||||||
Vector direction = npcLocation.toVector().subtract(_wither.getEyeLocation().toVector());
|
Vector direction = npcLocation.toVector().subtract(_wither.getEyeLocation().toVector());
|
||||||
Location enderLocation = _wither.getLocation().setDirection(direction);
|
Location enderLocation = _wither.getLocation().setDirection(direction);
|
||||||
_wither.teleport(enderLocation);
|
_wither.teleport(enderLocation);
|
||||||
|
|
Loading…
Reference in New Issue