Snakes tail final location instead of rel movement

This commit is contained in:
libraryaddict 2015-08-29 12:38:19 -07:00
parent bd2fda17b0
commit 5d28509474
2 changed files with 13 additions and 6 deletions

View File

@ -36,8 +36,10 @@ public class SnakeTail
return _previous; return _previous;
} }
public Packet moveEntity(Vector toMove) public Packet moveEntity(Vector newLocation)
{ {
Vector toMove = newLocation.clone().subtract(_entityLocation);
int x = (int) Math.floor(32 * toMove.getX()); int x = (int) Math.floor(32 * toMove.getX());
int y = (int) Math.floor(32 * toMove.getY()); int y = (int) Math.floor(32 * toMove.getY());
int z = (int) Math.floor(32 * toMove.getZ()); int z = (int) Math.floor(32 * toMove.getZ());
@ -59,7 +61,7 @@ public class SnakeTail
} }
else else
{ {
_entityLocation.add(toMove); _entityLocation = newLocation.clone();
x = (int) Math.floor(_entityLocation.getX() * 32); x = (int) Math.floor(_entityLocation.getX() * 32);
y = (int) Math.floor(_entityLocation.getY() * 32); y = (int) Math.floor(_entityLocation.getY() * 32);

View File

@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -54,6 +55,14 @@ public class BossBattles extends TeamGame
}); });
HungerSet = 20; HungerSet = 20;
CreatureAllowOverride = true;
}
@EventHandler
public void onSpawn(CreatureSpawnEvent event)
{
if (event.getSpawnReason() != event.getSpawnReason().CUSTOM)
event.setCancelled(true);
} }
@Override @Override
@ -281,14 +290,10 @@ public class BossBattles extends TeamGame
return; return;
} }
CreatureAllowOverride = true;
_currentBoss.start(); _currentBoss.start();
Bukkit.getPluginManager().registerEvents(_currentBoss, Bukkit.getPluginManager().registerEvents(_currentBoss,
getArcadeManager().getPlugin()); getArcadeManager().getPlugin());
CreatureAllowOverride = false;
} }
public WorldEvent createInstance(Class clazz, Location centerLocation) public WorldEvent createInstance(Class clazz, Location centerLocation)