snake workin!
This commit is contained in:
parent
110222e5f3
commit
05ecfb8ff0
@ -65,7 +65,7 @@ public class UtilMath
|
||||
|
||||
public static double offset(Vector a, Vector b)
|
||||
{
|
||||
return a.subtract(b).length();
|
||||
return a.clone().subtract(b).length();
|
||||
}
|
||||
|
||||
public static double offsetSquared(Entity a, Entity b)
|
||||
|
@ -36,8 +36,9 @@ public class SnakeCreature extends EventCreature<Silverfish>
|
||||
private ArrayList<Player> _canSee = new ArrayList<Player>();
|
||||
|
||||
private Location _waypoint;
|
||||
private Vector _velocity = new Vector(0,0,0);
|
||||
|
||||
private boolean _enabled = false;
|
||||
private boolean _enabled = true;
|
||||
|
||||
public SnakeCreature(WorldEvent event, Location spawnLocation)
|
||||
{
|
||||
@ -60,15 +61,13 @@ public class SnakeCreature extends EventCreature<Silverfish>
|
||||
new ItemStack(i == 0 ? Material.EMERALD_BLOCK : Material.STONE));
|
||||
|
||||
_segments.add(tail);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void getNewWaypoint()
|
||||
{
|
||||
//Bukkit.broadcastMessage("NEW WAYPOINT!");
|
||||
_waypoint = getSpawnLocation().clone().add(Math.random() * 80 - 40, Math.random() * 24 - 24, Math.random() * 80 - 40);
|
||||
_waypoint = getSpawnLocation().clone().add(Math.random() * 60 - 30, Math.random() * 24 - 16, Math.random() * 60 - 30);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -162,13 +161,16 @@ public class SnakeCreature extends EventCreature<Silverfish>
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
//Vector moveTo = UtilAlg.getTrajectory(vec, _waypoint.toVector()).multiply(0.1);
|
||||
Vector moveTo = UtilAlg.getTrajectory(vec, _waypoint.toVector());
|
||||
|
||||
Vector moveTo = new Vector(0,0.1,0);
|
||||
_velocity.add(moveTo.multiply(0.04));
|
||||
|
||||
Bukkit.broadcastMessage("Loc: " + UtilWorld.vecToStrClean(moveTo));
|
||||
if (_velocity.length() > 0.5)
|
||||
_velocity.normalize().multiply(0.5);
|
||||
|
||||
vec.add(moveTo);
|
||||
//Bukkit.broadcastMessage("Loc: " + UtilWorld.vecToStrClean(moveTo));
|
||||
|
||||
vec.add(_velocity);
|
||||
|
||||
//Bukkit.broadcastMessage("Loc: " + UtilWorld.vecToStrClean(vec));
|
||||
|
||||
@ -176,8 +178,6 @@ public class SnakeCreature extends EventCreature<Silverfish>
|
||||
{
|
||||
getNewWaypoint();
|
||||
}
|
||||
|
||||
_enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ public class SnakeSegment
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
watcher.a(0, (byte) 0);
|
||||
watcher.a(0, (byte) 32);
|
||||
watcher.a(1, 0);
|
||||
|
||||
packet.a = getId();
|
||||
|
Loading…
Reference in New Issue
Block a user