Removed mob spectating method from evolving.
This commit is contained in:
parent
86ad6a09de
commit
cbaaee60d9
@ -5,10 +5,8 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
@ -408,4 +406,21 @@ public class UtilAlg
|
|||||||
|
|
||||||
return bestLoc;
|
return bestLoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Location getNearestCornerLocation(Location near, Block block)
|
||||||
|
{
|
||||||
|
ArrayList<Location> corners = new ArrayList<Location>();
|
||||||
|
|
||||||
|
corners.add(block.getLocation().clone());
|
||||||
|
corners.add(block.getLocation().clone().add(.999, 0, 0));
|
||||||
|
corners.add(block.getLocation().clone().add(.999, 0, .999));
|
||||||
|
corners.add(block.getLocation().clone().add(0, 0, .999));
|
||||||
|
|
||||||
|
corners.add(block.getLocation().clone().add(0, .999, 0));
|
||||||
|
corners.add(block.getLocation().clone().add(.999, .999, 0));
|
||||||
|
corners.add(block.getLocation().clone().add(.999, .999, .999));
|
||||||
|
corners.add(block.getLocation().clone().add(0, .999, .999));
|
||||||
|
|
||||||
|
return UtilAlg.findClosest(near, corners);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ public class Evolution extends SoloGame
|
|||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void endNoEvolve(GameStateChangeEvent event)
|
public void endNoEvolve(GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
if (event.GetState() != GameState.Prepare)
|
if (event.GetState() != GameState.Live)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_evoPlatforms.size() <= 0)
|
if (_evoPlatforms.size() <= 0)
|
||||||
|
@ -8,7 +8,6 @@ import mineplex.core.common.util.C;
|
|||||||
import mineplex.core.common.util.MapUtil;
|
import mineplex.core.common.util.MapUtil;
|
||||||
import mineplex.core.common.util.UtilAction;
|
import mineplex.core.common.util.UtilAction;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
|
||||||
import mineplex.core.common.util.UtilFirework;
|
import mineplex.core.common.util.UtilFirework;
|
||||||
import mineplex.core.common.util.UtilParticle;
|
import mineplex.core.common.util.UtilParticle;
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
@ -16,11 +15,9 @@ import mineplex.core.common.util.UtilParticle.ViewDist;
|
|||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.disguise.disguises.DisguiseArmorStand;
|
|
||||||
import mineplex.core.hologram.Hologram;
|
import mineplex.core.hologram.Hologram;
|
||||||
import mineplex.core.hologram.Hologram.HologramTarget;
|
import mineplex.core.hologram.Hologram.HologramTarget;
|
||||||
import mineplex.core.hologram.HologramManager;
|
import mineplex.core.hologram.HologramManager;
|
||||||
import mineplex.core.packethandler.PacketPlayOutCamera;
|
|
||||||
import nautilus.game.arcade.game.games.evolution.EvoKit;
|
import nautilus.game.arcade.game.games.evolution.EvoKit;
|
||||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent;
|
import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent;
|
||||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent;
|
import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent;
|
||||||
@ -49,7 +46,6 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Zombie;
|
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class EvolveData
|
public class EvolveData
|
||||||
@ -66,7 +62,7 @@ public class EvolveData
|
|||||||
private final long _preEvolve;
|
private final long _preEvolve;
|
||||||
private final long _postEvolve;
|
private final long _postEvolve;
|
||||||
|
|
||||||
private EvolveManager _manager;
|
// private EvolveManager _manager;
|
||||||
private HologramManager _holoManager;
|
private HologramManager _holoManager;
|
||||||
|
|
||||||
private final PlatformToken _token;
|
private final PlatformToken _token;
|
||||||
@ -74,8 +70,8 @@ public class EvolveData
|
|||||||
private boolean _active = true;
|
private boolean _active = true;
|
||||||
|
|
||||||
private final Player _player;
|
private final Player _player;
|
||||||
private Zombie _zombie;
|
// private Zombie _zombie;
|
||||||
private DisguiseArmorStand _disguise;
|
// private DisguiseArmorStand _disguise;
|
||||||
|
|
||||||
private final Location _eggLoc;
|
private final Location _eggLoc;
|
||||||
private final SimpleEntry<Material, Byte> _eggLocData;
|
private final SimpleEntry<Material, Byte> _eggLocData;
|
||||||
@ -95,7 +91,7 @@ public class EvolveData
|
|||||||
_preEvolve = 3200;
|
_preEvolve = 3200;
|
||||||
_postEvolve = 3400;
|
_postEvolve = 3400;
|
||||||
|
|
||||||
_manager = manager;
|
// _manager = manager;
|
||||||
_holoManager = holo;
|
_holoManager = holo;
|
||||||
|
|
||||||
_token = token;
|
_token = token;
|
||||||
@ -114,8 +110,8 @@ public class EvolveData
|
|||||||
Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player));
|
Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player));
|
||||||
|
|
||||||
setupViewingToken(_eFrom);
|
setupViewingToken(_eFrom);
|
||||||
spawnZombie();
|
// spawnZombie();
|
||||||
setupZombie();
|
// setupZombie();
|
||||||
setupPlayer();
|
setupPlayer();
|
||||||
setupEgg();
|
setupEgg();
|
||||||
setupHologram(holo, _eFrom, from);
|
setupHologram(holo, _eFrom, from);
|
||||||
@ -138,37 +134,51 @@ public class EvolveData
|
|||||||
|
|
||||||
private void setupViewingToken(EntityInsentient ent)
|
private void setupViewingToken(EntityInsentient ent)
|
||||||
{
|
{
|
||||||
Vector viewing = UtilAlg.getTrajectory(_token.Viewing, _token.Platform.clone().add(0.5, (ent.boundingBox.e - ent.boundingBox.b) / 2 - 1, 0.5));
|
Location center = _token.Platform.clone().add(0.5, (ent.boundingBox.e - ent.boundingBox.b) / 2 - 1, 0.5);
|
||||||
|
Location offset = UtilAlg.getNearestCornerLocation(_token.Viewing, center.getBlock());
|
||||||
|
|
||||||
|
center.setX(offset.getX());
|
||||||
|
center.setZ(offset.getZ());
|
||||||
|
|
||||||
|
Vector viewing = UtilAlg.getTrajectory(_token.Viewing, offset);
|
||||||
_token.Viewing.setPitch(UtilAlg.GetPitch(viewing));
|
_token.Viewing.setPitch(UtilAlg.GetPitch(viewing));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spawnZombie()
|
// private void spawnZombie()
|
||||||
{
|
// {
|
||||||
_manager.Host.CreatureAllowOverride = true;
|
// _manager.Host.CreatureAllowOverride = true;
|
||||||
_zombie = (Zombie) _player.getWorld().spawnEntity(_token.Viewing, EntityType.ZOMBIE);
|
// _zombie = (Zombie) _player.getWorld().spawnEntity(_token.Viewing, EntityType.ZOMBIE);
|
||||||
_manager.Host.CreatureAllowOverride = true;
|
// _manager.Host.CreatureAllowOverride = true;
|
||||||
UtilEnt.Vegetate(_zombie, true);
|
// UtilEnt.Vegetate(_zombie, true);
|
||||||
|
// UtilEnt.ghost(_zombie, true, true);
|
||||||
_disguise = new DisguiseArmorStand(_zombie);
|
//
|
||||||
_disguise.setInvisible(true);
|
// _disguise = new DisguiseArmorStand(_zombie);
|
||||||
|
//
|
||||||
_manager.Host.Manager.GetDisguise().disguise(_disguise);
|
// _disguise.setInvisible(true);
|
||||||
}
|
// _disguise.Global = false;
|
||||||
|
//
|
||||||
private void setupZombie()
|
// _manager.Host.Manager.GetDisguise().disguise(_disguise, _player);
|
||||||
{
|
// }
|
||||||
_disguise.setHeadPosition(_token.Viewing.getDirection());
|
//
|
||||||
|
// private void setupZombie()
|
||||||
_disguise.UpdateDataWatcher();
|
// {
|
||||||
_manager.Host.Manager.GetDisguise().updateDisguise(_disguise);
|
// _zombie.teleport(_token.Viewing);
|
||||||
// ((CraftZombie) _zombie).getHandle().getControllerLook().a(((CraftZombie) _zombie).getHandle(), _token.Viewing.getYaw(), _token.Viewing.getPitch());
|
//
|
||||||
}
|
// _disguise.setHeadPosition(_token.Viewing.getDirection());
|
||||||
|
//
|
||||||
|
//// _disguise.UpdateDataWatcher();
|
||||||
|
// _manager.Host.Manager.GetDisguise().updateDisguise(_disguise);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
private void setupPlayer()
|
private void setupPlayer()
|
||||||
{
|
{
|
||||||
_player.teleport(_token.Store);
|
_player.teleport(_token.Viewing);
|
||||||
|
|
||||||
UtilPlayer.sendPacket(_player, new PacketPlayOutCamera(_zombie.getEntityId()));
|
// _player.teleport(_token.Store);
|
||||||
|
// _player.teleport(_token.Viewing);
|
||||||
|
|
||||||
|
// UtilPlayer.sendPacket(_player, new PacketPlayOutCamera(_zombie.getEntityId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupHologram(HologramManager manager, EntityInsentient entity, EvoKit kit)
|
private void setupHologram(HologramManager manager, EntityInsentient entity, EvoKit kit)
|
||||||
@ -197,7 +207,7 @@ public class EvolveData
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
setupZombie();
|
// setupZombie();
|
||||||
teleport();
|
teleport();
|
||||||
|
|
||||||
//Hasn't ended yet
|
//Hasn't ended yet
|
||||||
@ -221,7 +231,7 @@ public class EvolveData
|
|||||||
despawn(_eFrom);
|
despawn(_eFrom);
|
||||||
|
|
||||||
setupViewingToken(_eTo);
|
setupViewingToken(_eTo);
|
||||||
setupZombie();
|
// setupZombie();
|
||||||
setupPlayer();
|
setupPlayer();
|
||||||
|
|
||||||
setupHologram(_holoManager, _eTo, _to);
|
setupHologram(_holoManager, _eTo, _to);
|
||||||
@ -277,8 +287,8 @@ public class EvolveData
|
|||||||
if (_holo != null)
|
if (_holo != null)
|
||||||
_holo.stop();
|
_holo.stop();
|
||||||
|
|
||||||
UtilPlayer.sendPacket(_player, new PacketPlayOutCamera(_player));
|
// UtilPlayer.sendPacket(_player, new PacketPlayOutCamera(_player));
|
||||||
_zombie.remove();
|
// _zombie.remove();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@ public class PlatformToken
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public final Location Platform;
|
public final Location Platform;
|
||||||
public final Location Viewing;
|
public final Location Viewing; /**This was when I was using a spectate packet. Will be used again once I can have teh armorstand : >>>>>>>>*/
|
||||||
public final Location Store;
|
public final Location Store;
|
||||||
|
|
||||||
public PlatformToken(Location platform, Location viewing, Location store)
|
public PlatformToken(Location platform, Location viewing, Location store)
|
||||||
|
Loading…
Reference in New Issue
Block a user