mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-28 05:35:45 +01:00
Implement NPCPush/CollisionEvent
This commit is contained in:
parent
585de19c25
commit
11325cbbfa
@ -88,15 +88,18 @@ public class Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double asDouble() {
|
public double asDouble() {
|
||||||
return (Double) value;
|
return ((Number) value).doubleValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public float asFloat() {
|
public float asFloat() {
|
||||||
return (Float) value;
|
return ((Number) value).floatValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int asInt() {
|
public int asInt() {
|
||||||
return Integer.parseInt(value.toString());
|
if (value instanceof String) {
|
||||||
|
return Integer.parseInt(value.toString());
|
||||||
|
}
|
||||||
|
return ((Number) value).intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -108,7 +111,7 @@ public class Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public long asLong() {
|
public long asLong() {
|
||||||
return (Long) value;
|
return ((Number) value).longValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String asString() {
|
public String asString() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -46,13 +46,21 @@ public class CitizensBlazeNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -42,13 +42,21 @@ public class CitizensCaveSpiderNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -46,13 +46,21 @@ public class CitizensChickenNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -46,13 +46,21 @@ public class CitizensCowNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -53,13 +53,21 @@ public class CitizensCreeperNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -42,13 +42,21 @@ public class CitizensEnderDragonNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.api.trait.trait.Equipment;
|
import net.citizensnpcs.api.trait.trait.Equipment;
|
||||||
import net.citizensnpcs.editor.Equipable;
|
import net.citizensnpcs.editor.Equipable;
|
||||||
@ -84,13 +84,21 @@ public class CitizensEndermanNPC extends CitizensMobNPC implements Equipable {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -46,13 +46,21 @@ public class CitizensGhastNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -42,13 +42,21 @@ public class CitizensGiantNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -42,13 +42,21 @@ public class CitizensIronGolemNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -47,13 +47,21 @@ public class CitizensMagmaCubeNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -46,13 +46,21 @@ public class CitizensMushroomCowNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -46,13 +46,21 @@ public class CitizensOcelotNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.editor.Equipable;
|
import net.citizensnpcs.editor.Equipable;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
@ -79,13 +79,21 @@ public class CitizensPigNPC extends CitizensMobNPC implements Equipable {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -46,13 +46,21 @@ public class CitizensPigZombieNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.editor.Equipable;
|
import net.citizensnpcs.editor.Equipable;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
@ -84,13 +84,21 @@ public class CitizensSheepNPC extends CitizensMobNPC implements Equipable {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -46,13 +46,21 @@ public class CitizensSilverfishNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -46,13 +46,21 @@ public class CitizensSkeletonNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -47,13 +47,21 @@ public class CitizensSlimeNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -42,13 +42,21 @@ public class CitizensSnowmanNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -46,13 +46,21 @@ public class CitizensSpiderNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -46,13 +46,21 @@ public class CitizensSquidNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -46,13 +46,21 @@ public class CitizensVillagerNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -46,13 +46,21 @@ public class CitizensWolfNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
@ -46,13 +46,21 @@ public class CitizensZombieNPC extends CitizensMobNPC {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,7 +2,7 @@ package net.citizensnpcs.npc.entity;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPC;
|
import net.citizensnpcs.npc.CitizensNPC;
|
||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
@ -52,13 +52,21 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
|||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length == 0)
|
if (NPCPushEvent.getHandlerList().getRegisteredListeners().length == 0)
|
||||||
return;
|
return;
|
||||||
NPCCollisionEvent event = Util.callCollisionEvent(npc, new Vector(x, y, z));
|
NPCPushEvent event = Util.callPushEvent(npc, new Vector(x, y, z));
|
||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
super.b_(x, y, z);
|
super.b_(x, y, z);
|
||||||
// when another entity collides, b_ is called to push the NPC
|
// when another entity collides, b_ is called to push the NPC
|
||||||
// so we prevent b_ from doing anything.
|
// so we prevent b_ from doing anything if the event is cancelled.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collide(net.minecraft.server.Entity entity) {
|
||||||
|
// this method is called by both the entities involved - cancelling
|
||||||
|
// it will not stop the NPC from moving.
|
||||||
|
super.collide(entity);
|
||||||
|
Util.callCollisionEvent(npc, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,6 +8,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import net.citizensnpcs.Settings.Setting;
|
import net.citizensnpcs.Settings.Setting;
|
||||||
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
import net.citizensnpcs.api.event.NPCCollisionEvent;
|
||||||
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.minecraft.server.Packet;
|
import net.minecraft.server.Packet;
|
||||||
|
|
||||||
@ -32,8 +33,13 @@ public class Util {
|
|||||||
|
|
||||||
private static final Map<Class<?>, Class<?>> primitiveClassMap = Maps.newHashMap();
|
private static final Map<Class<?>, Class<?>> primitiveClassMap = Maps.newHashMap();
|
||||||
|
|
||||||
public static NPCCollisionEvent callCollisionEvent(NPC npc, Vector vector) {
|
public static void callCollisionEvent(NPC npc, net.minecraft.server.Entity entity) {
|
||||||
NPCCollisionEvent event = new NPCCollisionEvent(npc, vector);
|
if (NPCCollisionEvent.getHandlerList().getRegisteredListeners().length > 0)
|
||||||
|
Bukkit.getPluginManager().callEvent(new NPCCollisionEvent(npc, entity.getBukkitEntity()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NPCPushEvent callPushEvent(NPC npc, Vector vector) {
|
||||||
|
NPCPushEvent event = new NPCPushEvent(npc, vector);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user