Use collision vector from event

This commit is contained in:
fullwall 2012-08-04 13:39:04 +08:00
parent 288bcf5e9f
commit b081ecd5ac
26 changed files with 161 additions and 82 deletions

View File

@ -63,9 +63,12 @@ public class CitizensBlazeNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -65,9 +65,12 @@ public class CitizensCaveSpiderNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -62,9 +62,12 @@ public class CitizensChickenNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -62,9 +62,12 @@ public class CitizensCowNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -69,12 +69,15 @@ public class CitizensCreeperNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC
// so we prevent it from doing anything if the event is cancelled.
// NPC so we prevent it from doing anything if the event is
// cancelled.
}
@Override

View File

@ -65,9 +65,12 @@ public class CitizensEnderDragonNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -115,9 +115,12 @@ public class CitizensEndermanNPC extends CitizensMobNPC implements Equipable {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -63,9 +63,12 @@ public class CitizensGhastNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -59,9 +59,12 @@ public class CitizensGiantNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -58,9 +58,12 @@ public class CitizensIronGolemNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -71,9 +71,12 @@ public class CitizensMagmaCubeNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -62,9 +62,12 @@ public class CitizensMushroomCowNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -62,9 +62,12 @@ public class CitizensOcelotNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -95,9 +95,12 @@ public class CitizensPigNPC extends CitizensMobNPC implements Equipable {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -70,9 +70,12 @@ public class CitizensPigZombieNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -100,9 +100,12 @@ public class CitizensSheepNPC extends CitizensMobNPC implements Equipable {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -70,9 +70,12 @@ public class CitizensSilverfishNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -62,9 +62,12 @@ public class CitizensSkeletonNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -71,9 +71,12 @@ public class CitizensSlimeNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -57,9 +57,12 @@ public class CitizensSnowmanNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -69,9 +69,12 @@ public class CitizensSpiderNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -63,9 +63,12 @@ public class CitizensSquidNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -70,9 +70,12 @@ public class CitizensVillagerNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -62,9 +62,12 @@ public class CitizensWolfNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -62,9 +62,12 @@ public class CitizensZombieNPC extends CitizensMobNPC {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.

View File

@ -63,11 +63,15 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
}
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
return;
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
if (!event.isCancelled())
super.g(x, y, z);
// when another entity collides, this method is called to push the NPC
// so we prevent it from doing anything if the event is cancelled.
Vector vector = new Vector(x, y, z);
NPCPushEvent event = Util.callPushEvent(npc, vector);
if (!event.isCancelled()) {
vector = event.getCollisionVector();
super.g(vector.getX(), vector.getY(), vector.getZ());
}
// when another entity collides, this method is called to push the
// NPC so we prevent it from doing anything if the event is
// cancelled.
}
@Override