2011-02-06 00:37:33 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
public class EntityTrackerEntry {
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
public Entity tracker;
|
2011-02-06 00:37:33 +01:00
|
|
|
public int b;
|
|
|
|
public int c;
|
|
|
|
public int d;
|
|
|
|
public int e;
|
|
|
|
public int f;
|
|
|
|
public int g;
|
|
|
|
public int h;
|
|
|
|
public double i;
|
|
|
|
public double j;
|
|
|
|
public double k;
|
|
|
|
public int l = 0;
|
|
|
|
private double o;
|
|
|
|
private double p;
|
|
|
|
private double q;
|
|
|
|
private boolean r = false;
|
2011-04-20 19:05:14 +02:00
|
|
|
private boolean isMoving;
|
2011-05-26 14:48:22 +02:00
|
|
|
private int t = 0;
|
2011-02-06 00:37:33 +01:00
|
|
|
public boolean m = false;
|
2011-04-20 19:05:14 +02:00
|
|
|
public Set trackedPlayers = new HashSet();
|
2011-02-06 00:37:33 +01:00
|
|
|
|
|
|
|
public EntityTrackerEntry(Entity entity, int i, int j, boolean flag) {
|
2011-04-20 19:05:14 +02:00
|
|
|
this.tracker = entity;
|
2011-02-06 00:37:33 +01:00
|
|
|
this.b = i;
|
|
|
|
this.c = j;
|
2011-04-20 19:05:14 +02:00
|
|
|
this.isMoving = flag;
|
|
|
|
this.d = MathHelper.floor(entity.locX * 32.0D);
|
|
|
|
this.e = MathHelper.floor(entity.locY * 32.0D);
|
|
|
|
this.f = MathHelper.floor(entity.locZ * 32.0D);
|
2011-02-06 00:37:33 +01:00
|
|
|
this.g = MathHelper.d(entity.yaw * 256.0F / 360.0F);
|
|
|
|
this.h = MathHelper.d(entity.pitch * 256.0F / 360.0F);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean equals(Object object) {
|
2011-04-20 19:05:14 +02:00
|
|
|
return object instanceof EntityTrackerEntry ? ((EntityTrackerEntry) object).tracker.id == this.tracker.id : false;
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
2011-04-20 19:05:14 +02:00
|
|
|
return this.tracker.id;
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
public void track(List list) {
|
2011-02-06 00:37:33 +01:00
|
|
|
this.m = false;
|
2011-07-08 14:25:53 +02:00
|
|
|
if (!this.r || this.tracker.e(this.o, this.p, this.q) > 16.0D) {
|
2011-04-20 19:05:14 +02:00
|
|
|
this.o = this.tracker.locX;
|
|
|
|
this.p = this.tracker.locY;
|
|
|
|
this.q = this.tracker.locZ;
|
2011-02-06 00:37:33 +01:00
|
|
|
this.r = true;
|
|
|
|
this.m = true;
|
2011-04-20 19:05:14 +02:00
|
|
|
this.scanPlayers(list);
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
|
2011-05-26 14:48:22 +02:00
|
|
|
++this.t;
|
2012-01-12 23:10:13 +01:00
|
|
|
if (++this.l % this.c == 0 || this.tracker.ce) {
|
2011-04-20 19:05:14 +02:00
|
|
|
int i = MathHelper.floor(this.tracker.locX * 32.0D);
|
|
|
|
int j = MathHelper.floor(this.tracker.locY * 32.0D);
|
|
|
|
int k = MathHelper.floor(this.tracker.locZ * 32.0D);
|
|
|
|
int l = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F);
|
|
|
|
int i1 = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F);
|
2011-02-06 00:37:33 +01:00
|
|
|
int j1 = i - this.d;
|
|
|
|
int k1 = j - this.e;
|
|
|
|
int l1 = k - this.f;
|
|
|
|
Object object = null;
|
2011-11-20 09:01:14 +01:00
|
|
|
boolean flag = Math.abs(j1) >= 4 || Math.abs(k1) >= 4 || Math.abs(l1) >= 4;
|
|
|
|
boolean flag1 = Math.abs(l - this.g) >= 4 || Math.abs(i1 - this.h) >= 4;
|
2011-02-06 00:37:33 +01:00
|
|
|
|
2011-05-26 14:48:22 +02:00
|
|
|
if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.t <= 400) {
|
2011-02-06 00:37:33 +01:00
|
|
|
if (flag && flag1) {
|
2011-04-20 19:05:14 +02:00
|
|
|
object = new Packet33RelEntityMoveLook(this.tracker.id, (byte) j1, (byte) k1, (byte) l1, (byte) l, (byte) i1);
|
2011-02-06 00:37:33 +01:00
|
|
|
} else if (flag) {
|
2011-04-20 19:05:14 +02:00
|
|
|
object = new Packet31RelEntityMove(this.tracker.id, (byte) j1, (byte) k1, (byte) l1);
|
2011-02-06 00:37:33 +01:00
|
|
|
} else if (flag1) {
|
2011-04-20 19:05:14 +02:00
|
|
|
object = new Packet32EntityLook(this.tracker.id, (byte) l, (byte) i1);
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
} else {
|
2011-05-26 14:48:22 +02:00
|
|
|
this.t = 0;
|
|
|
|
this.tracker.locX = (double) i / 32.0D;
|
|
|
|
this.tracker.locY = (double) j / 32.0D;
|
|
|
|
this.tracker.locZ = (double) k / 32.0D;
|
2011-04-20 19:05:14 +02:00
|
|
|
object = new Packet34EntityTeleport(this.tracker.id, i, j, k, (byte) l, (byte) i1);
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
if (this.isMoving) {
|
|
|
|
double d0 = this.tracker.motX - this.i;
|
|
|
|
double d1 = this.tracker.motY - this.j;
|
|
|
|
double d2 = this.tracker.motZ - this.k;
|
2011-02-06 00:37:33 +01:00
|
|
|
double d3 = 0.02D;
|
|
|
|
double d4 = d0 * d0 + d1 * d1 + d2 * d2;
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
if (d4 > d3 * d3 || d4 > 0.0D && this.tracker.motX == 0.0D && this.tracker.motY == 0.0D && this.tracker.motZ == 0.0D) {
|
|
|
|
this.i = this.tracker.motX;
|
|
|
|
this.j = this.tracker.motY;
|
|
|
|
this.k = this.tracker.motZ;
|
2012-01-14 21:03:48 +01:00
|
|
|
this.broadcast(new Packet28EntityVelocity(this.tracker.id, this.i, this.j, this.k));
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (object != null) {
|
2012-01-14 21:03:48 +01:00
|
|
|
this.broadcast((Packet) object);
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
|
2011-09-24 23:03:31 +02:00
|
|
|
DataWatcher datawatcher = this.tracker.getDataWatcher();
|
2011-02-06 00:37:33 +01:00
|
|
|
|
|
|
|
if (datawatcher.a()) {
|
2012-01-14 21:03:48 +01:00
|
|
|
this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher));
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
|
2011-02-23 03:37:56 +01:00
|
|
|
if (flag) {
|
|
|
|
this.d = i;
|
|
|
|
this.e = j;
|
|
|
|
this.f = k;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag1) {
|
|
|
|
this.g = l;
|
|
|
|
this.h = i1;
|
|
|
|
}
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
|
2012-01-12 23:10:13 +01:00
|
|
|
this.tracker.ce = false;
|
2011-04-20 19:05:14 +02:00
|
|
|
if (this.tracker.velocityChanged) {
|
2011-07-28 07:17:31 +02:00
|
|
|
// CraftBukkit start - create PlayerVelocity event
|
|
|
|
boolean cancelled = false;
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
if (this.tracker instanceof EntityPlayer) {
|
2011-07-28 07:17:31 +02:00
|
|
|
org.bukkit.entity.Player player = (org.bukkit.entity.Player) this.tracker.getBukkitEntity();
|
|
|
|
org.bukkit.util.Vector velocity = player.getVelocity();
|
|
|
|
|
|
|
|
org.bukkit.event.player.PlayerVelocityEvent event = new org.bukkit.event.player.PlayerVelocityEvent(player, velocity);
|
|
|
|
this.tracker.world.getServer().getPluginManager().callEvent(event);
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
if (event.isCancelled()) {
|
2011-07-28 07:17:31 +02:00
|
|
|
cancelled = true;
|
2011-11-20 09:01:14 +01:00
|
|
|
} else if (!velocity.equals(event.getVelocity())) {
|
2011-07-28 07:17:31 +02:00
|
|
|
player.setVelocity(velocity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
if (!cancelled) {
|
2012-01-14 21:03:48 +01:00
|
|
|
this.broadcastIncludingSelf((Packet) (new Packet28EntityVelocity(this.tracker)));
|
2011-07-28 07:17:31 +02:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2011-04-20 19:05:14 +02:00
|
|
|
this.tracker.velocityChanged = false;
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-14 21:03:48 +01:00
|
|
|
public void broadcast(Packet packet) {
|
2011-04-20 19:05:14 +02:00
|
|
|
Iterator iterator = this.trackedPlayers.iterator();
|
2011-02-06 00:37:33 +01:00
|
|
|
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
entityplayer.netServerHandler.sendPacket(packet);
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-14 21:03:48 +01:00
|
|
|
public void broadcastIncludingSelf(Packet packet) {
|
|
|
|
this.broadcast(packet);
|
2011-04-20 19:05:14 +02:00
|
|
|
if (this.tracker instanceof EntityPlayer) {
|
|
|
|
((EntityPlayer) this.tracker).netServerHandler.sendPacket(packet);
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void a() {
|
2012-01-14 21:03:48 +01:00
|
|
|
this.broadcast(new Packet29DestroyEntity(this.tracker.id));
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void a(EntityPlayer entityplayer) {
|
2011-04-20 19:05:14 +02:00
|
|
|
if (this.trackedPlayers.contains(entityplayer)) {
|
|
|
|
this.trackedPlayers.remove(entityplayer);
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void b(EntityPlayer entityplayer) {
|
2011-04-20 19:05:14 +02:00
|
|
|
if (entityplayer != this.tracker) {
|
2011-02-06 00:37:33 +01:00
|
|
|
double d0 = entityplayer.locX - (double) (this.d / 32);
|
|
|
|
double d1 = entityplayer.locZ - (double) (this.f / 32);
|
|
|
|
|
|
|
|
if (d0 >= (double) (-this.b) && d0 <= (double) this.b && d1 >= (double) (-this.b) && d1 <= (double) this.b) {
|
2011-05-26 14:48:22 +02:00
|
|
|
if (!this.trackedPlayers.contains(entityplayer)) {
|
2011-04-20 19:05:14 +02:00
|
|
|
this.trackedPlayers.add(entityplayer);
|
|
|
|
entityplayer.netServerHandler.sendPacket(this.b());
|
|
|
|
if (this.isMoving) {
|
|
|
|
entityplayer.netServerHandler.sendPacket(new Packet28EntityVelocity(this.tracker.id, this.tracker.motX, this.tracker.motY, this.tracker.motZ));
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
ItemStack[] aitemstack = this.tracker.getEquipment();
|
2011-02-06 00:37:33 +01:00
|
|
|
|
|
|
|
if (aitemstack != null) {
|
|
|
|
for (int i = 0; i < aitemstack.length; ++i) {
|
2011-04-20 19:05:14 +02:00
|
|
|
entityplayer.netServerHandler.sendPacket(new Packet5EntityEquipment(this.tracker.id, i, aitemstack[i]));
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
}
|
2011-05-31 15:55:45 +02:00
|
|
|
|
|
|
|
if (this.tracker instanceof EntityHuman) {
|
|
|
|
EntityHuman entityhuman = (EntityHuman) this.tracker;
|
|
|
|
|
|
|
|
if (entityhuman.isSleeping()) {
|
2011-11-30 00:17:43 +01:00
|
|
|
entityplayer.netServerHandler.sendPacket(new Packet17EntityLocationAction(this.tracker, 0, MathHelper.floor(this.tracker.locX), MathHelper.floor(this.tracker.locY), MathHelper.floor(this.tracker.locZ)));
|
2011-05-31 15:55:45 +02:00
|
|
|
}
|
|
|
|
}
|
2011-09-15 02:23:52 +02:00
|
|
|
|
|
|
|
if (this.tracker instanceof EntityLiving) {
|
|
|
|
EntityLiving entityliving = (EntityLiving) this.tracker;
|
2011-09-24 23:03:31 +02:00
|
|
|
Iterator iterator = entityliving.getEffects().iterator();
|
2011-09-15 02:23:52 +02:00
|
|
|
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
MobEffect mobeffect = (MobEffect) iterator.next();
|
|
|
|
|
|
|
|
entityplayer.netServerHandler.sendPacket(new Packet41MobEffect(this.tracker.id, mobeffect));
|
|
|
|
}
|
|
|
|
}
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
2011-04-20 19:05:14 +02:00
|
|
|
} else if (this.trackedPlayers.contains(entityplayer)) {
|
|
|
|
this.trackedPlayers.remove(entityplayer);
|
|
|
|
entityplayer.netServerHandler.sendPacket(new Packet29DestroyEntity(this.tracker.id));
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
public void scanPlayers(List list) {
|
2011-02-06 00:37:33 +01:00
|
|
|
for (int i = 0; i < list.size(); ++i) {
|
|
|
|
this.b((EntityPlayer) list.get(i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private Packet b() {
|
2011-11-20 09:01:14 +01:00
|
|
|
if (this.tracker.dead) {
|
2012-01-14 21:03:48 +01:00
|
|
|
// CraftBukkit - add some information
|
|
|
|
System.out.println("Fetching addPacket for removed entity: " + this.tracker.getBukkitEntity().toString());
|
2011-11-20 09:01:14 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
if (this.tracker instanceof EntityItem) {
|
|
|
|
EntityItem entityitem = (EntityItem) this.tracker;
|
2011-02-06 00:37:33 +01:00
|
|
|
Packet21PickupSpawn packet21pickupspawn = new Packet21PickupSpawn(entityitem);
|
|
|
|
|
|
|
|
entityitem.locX = (double) packet21pickupspawn.b / 32.0D;
|
|
|
|
entityitem.locY = (double) packet21pickupspawn.c / 32.0D;
|
|
|
|
entityitem.locZ = (double) packet21pickupspawn.d / 32.0D;
|
|
|
|
return packet21pickupspawn;
|
2011-04-20 19:05:14 +02:00
|
|
|
} else if (this.tracker instanceof EntityPlayer) {
|
|
|
|
return new Packet20NamedEntitySpawn((EntityHuman) this.tracker);
|
2011-02-06 00:37:33 +01:00
|
|
|
} else {
|
2011-04-20 19:05:14 +02:00
|
|
|
if (this.tracker instanceof EntityMinecart) {
|
|
|
|
EntityMinecart entityminecart = (EntityMinecart) this.tracker;
|
2011-02-06 00:37:33 +01:00
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
if (entityminecart.type == 0) {
|
|
|
|
return new Packet23VehicleSpawn(this.tracker, 10);
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
if (entityminecart.type == 1) {
|
|
|
|
return new Packet23VehicleSpawn(this.tracker, 11);
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
if (entityminecart.type == 2) {
|
|
|
|
return new Packet23VehicleSpawn(this.tracker, 12);
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-20 19:05:14 +02:00
|
|
|
if (this.tracker instanceof EntityBoat) {
|
|
|
|
return new Packet23VehicleSpawn(this.tracker, 1);
|
|
|
|
} else if (this.tracker instanceof IAnimal) {
|
|
|
|
return new Packet24MobSpawn((EntityLiving) this.tracker);
|
2011-11-20 09:01:14 +01:00
|
|
|
} else if (this.tracker instanceof EntityEnderDragon) {
|
|
|
|
return new Packet24MobSpawn((EntityLiving) this.tracker);
|
2011-09-24 23:03:31 +02:00
|
|
|
} else if (this.tracker instanceof EntityFishingHook) {
|
2011-04-20 19:05:14 +02:00
|
|
|
return new Packet23VehicleSpawn(this.tracker, 90);
|
|
|
|
} else if (this.tracker instanceof EntityArrow) {
|
2011-09-15 02:23:52 +02:00
|
|
|
Entity entity = ((EntityArrow) this.tracker).shooter;
|
2011-05-26 14:48:22 +02:00
|
|
|
|
2011-09-15 02:23:52 +02:00
|
|
|
return new Packet23VehicleSpawn(this.tracker, 60, entity != null ? entity.id : this.tracker.id);
|
2011-04-20 19:05:14 +02:00
|
|
|
} else if (this.tracker instanceof EntitySnowball) {
|
|
|
|
return new Packet23VehicleSpawn(this.tracker, 61);
|
2011-11-20 09:01:14 +01:00
|
|
|
} else if (this.tracker instanceof EntityPotion) {
|
|
|
|
return new Packet23VehicleSpawn(this.tracker, 73, ((EntityPotion) this.tracker).f());
|
|
|
|
} else if (this.tracker instanceof EntityEnderPearl) {
|
|
|
|
return new Packet23VehicleSpawn(this.tracker, 65);
|
|
|
|
} else if (this.tracker instanceof EntityEnderSignal) {
|
|
|
|
return new Packet23VehicleSpawn(this.tracker, 72);
|
2011-02-06 00:37:33 +01:00
|
|
|
} else {
|
2011-11-20 09:01:14 +01:00
|
|
|
Packet23VehicleSpawn packet23vehiclespawn;
|
2011-02-06 00:37:33 +01:00
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
if (this.tracker instanceof EntitySmallFireball) {
|
|
|
|
EntitySmallFireball entitysmallfireball = (EntitySmallFireball) this.tracker;
|
|
|
|
|
|
|
|
packet23vehiclespawn = null;
|
|
|
|
if (entitysmallfireball.shooter != null) {
|
|
|
|
packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 64, entitysmallfireball.shooter.id);
|
|
|
|
} else {
|
|
|
|
packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 64, 0);
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
packet23vehiclespawn.e = (int) (entitysmallfireball.dirX * 8000.0D);
|
|
|
|
packet23vehiclespawn.f = (int) (entitysmallfireball.dirY * 8000.0D);
|
|
|
|
packet23vehiclespawn.g = (int) (entitysmallfireball.dirZ * 8000.0D);
|
|
|
|
return packet23vehiclespawn;
|
|
|
|
} else if (this.tracker instanceof EntityFireball) {
|
|
|
|
EntityFireball entityfireball = (EntityFireball) this.tracker;
|
|
|
|
|
|
|
|
packet23vehiclespawn = null;
|
|
|
|
if (entityfireball.shooter != null) {
|
|
|
|
packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, ((EntityFireball) this.tracker).shooter.id);
|
|
|
|
} else {
|
|
|
|
packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, 0);
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
|
2011-11-20 09:01:14 +01:00
|
|
|
packet23vehiclespawn.e = (int) (entityfireball.dirX * 8000.0D);
|
|
|
|
packet23vehiclespawn.f = (int) (entityfireball.dirY * 8000.0D);
|
|
|
|
packet23vehiclespawn.g = (int) (entityfireball.dirZ * 8000.0D);
|
|
|
|
return packet23vehiclespawn;
|
|
|
|
} else if (this.tracker instanceof EntityEgg) {
|
|
|
|
return new Packet23VehicleSpawn(this.tracker, 62);
|
|
|
|
} else if (this.tracker instanceof EntityTNTPrimed) {
|
|
|
|
return new Packet23VehicleSpawn(this.tracker, 50);
|
|
|
|
} else if (this.tracker instanceof EntityEnderCrystal) {
|
|
|
|
return new Packet23VehicleSpawn(this.tracker, 51);
|
2011-02-06 00:37:33 +01:00
|
|
|
} else {
|
2011-11-30 00:17:43 +01:00
|
|
|
if (this.tracker instanceof EntityFallingBlock) {
|
2012-01-12 23:10:13 +01:00
|
|
|
EntityFallingBlock entityfallingblock = (EntityFallingBlock) this.tracker;
|
2011-11-20 09:01:14 +01:00
|
|
|
|
2012-01-14 21:03:48 +01:00
|
|
|
if (entityfallingblock.id == Block.SAND.id) {
|
2011-11-20 09:01:14 +01:00
|
|
|
return new Packet23VehicleSpawn(this.tracker, 70);
|
|
|
|
}
|
|
|
|
|
2012-01-14 21:03:48 +01:00
|
|
|
if (entityfallingblock.id == Block.GRAVEL.id) {
|
2011-11-20 09:01:14 +01:00
|
|
|
return new Packet23VehicleSpawn(this.tracker, 71);
|
|
|
|
}
|
|
|
|
|
2012-01-14 21:03:48 +01:00
|
|
|
if (entityfallingblock.id == Block.DRAGON_EGG.id) {
|
2011-11-20 09:01:14 +01:00
|
|
|
return new Packet23VehicleSpawn(this.tracker, 74);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.tracker instanceof EntityPainting) {
|
|
|
|
return new Packet25EntityPainting((EntityPainting) this.tracker);
|
|
|
|
} else if (this.tracker instanceof EntityExperienceOrb) {
|
|
|
|
return new Packet26AddExpOrb((EntityExperienceOrb) this.tracker);
|
|
|
|
} else {
|
|
|
|
throw new IllegalArgumentException("Don\'t know how to add " + this.tracker.getClass() + "!");
|
|
|
|
}
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void c(EntityPlayer entityplayer) {
|
2011-04-20 19:05:14 +02:00
|
|
|
if (this.trackedPlayers.contains(entityplayer)) {
|
|
|
|
this.trackedPlayers.remove(entityplayer);
|
|
|
|
entityplayer.netServerHandler.sendPacket(new Packet29DestroyEntity(this.tracker.id));
|
2011-02-06 00:37:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|