mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 20:55:44 +01:00
Use the persistent field instead of overriding bh
This commit is contained in:
parent
a61172e6e4
commit
bc575cbcf5
@ -53,6 +53,7 @@ public class CitizensBatNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,12 +64,6 @@ public class CitizensBatNPC extends CitizensMobNPC {
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void j_() {
|
||||
if (npc == null)
|
||||
super.j_();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
@ -111,5 +106,11 @@ public class CitizensBatNPC extends CitizensMobNPC {
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void j_() {
|
||||
if (npc == null)
|
||||
super.j_();
|
||||
}
|
||||
}
|
||||
}
|
@ -54,16 +54,10 @@ public class CitizensBlazeNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bb();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bk() {
|
||||
if (npc != null)
|
||||
|
@ -53,16 +53,10 @@ public class CitizensCaveSpiderNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
|
@ -53,6 +53,7 @@ public class CitizensChickenNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,7 @@ public class CitizensCowNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,7 @@ public class CitizensCreeperNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,13 +65,6 @@ public class CitizensCreeperNPC extends CitizensMobNPC {
|
||||
super.a(entitylightning);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
|
@ -45,27 +45,33 @@ public class CitizensEnderDragonNPC extends CitizensMobNPC {
|
||||
public static class EntityEnderDragonNPC extends EntityEnderDragon implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public EntityEnderDragonNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
|
||||
public EntityEnderDragonNPC(World world, NPC npc) {
|
||||
super(world);
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bk() {
|
||||
if (npc == null)
|
||||
super.bk();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
else
|
||||
super.c();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
@ -75,14 +81,6 @@ public class CitizensEnderDragonNPC extends CitizensMobNPC {
|
||||
Util.callCollisionEvent(npc, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
if (npc != null)
|
||||
npc.update();
|
||||
else
|
||||
super.c();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
if (npc == null) {
|
||||
|
@ -87,16 +87,10 @@ public class CitizensEndermanNPC extends CitizensMobNPC implements Equipable {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
@ -114,15 +108,6 @@ public class CitizensEndermanNPC extends CitizensMobNPC implements Equipable {
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
if (npc != null)
|
||||
Util.callCollisionEvent(npc, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
if (npc == null)
|
||||
@ -133,6 +118,15 @@ public class CitizensEndermanNPC extends CitizensMobNPC implements Equipable {
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
if (npc != null)
|
||||
Util.callCollisionEvent(npc, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void g(double x, double y, double z) {
|
||||
if (npc == null) {
|
||||
|
@ -40,16 +40,10 @@ public class CitizensGhastNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bk() {
|
||||
if (npc != null)
|
||||
|
@ -31,21 +31,19 @@ public class CitizensGiantNPC extends CitizensMobNPC {
|
||||
public static class EntityGiantNPC extends EntityGiantZombie implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public EntityGiantNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
|
||||
public EntityGiantNPC(World world, NPC npc) {
|
||||
super(world);
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bk() {
|
||||
if (npc == null)
|
||||
|
@ -31,21 +31,19 @@ public class CitizensIronGolemNPC extends CitizensMobNPC {
|
||||
public static class EntityIronGolemNPC extends EntityIronGolem implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public EntityIronGolemNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
|
||||
public EntityIronGolemNPC(World world, NPC npc) {
|
||||
super(world);
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
|
@ -41,15 +41,10 @@ public class CitizensMagmaCubeNPC extends CitizensMobNPC {
|
||||
if (npc != null) {
|
||||
setSize(3);
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
|
@ -40,6 +40,7 @@ public class CitizensMushroomCowNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,16 +40,10 @@ public class CitizensOcelotNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
|
@ -64,6 +64,7 @@ public class CitizensPigNPC extends CitizensMobNPC implements Equipable {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,16 +40,10 @@ public class CitizensPigZombieNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
|
@ -69,6 +69,7 @@ public class CitizensSheepNPC extends CitizensMobNPC implements Equipable {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,16 +40,10 @@ public class CitizensSilverfishNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
|
@ -40,16 +40,10 @@ public class CitizensSkeletonNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
|
@ -41,16 +41,10 @@ public class CitizensSlimeNPC extends CitizensMobNPC {
|
||||
if (npc != null) {
|
||||
setSize(3);
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
|
@ -31,21 +31,19 @@ public class CitizensSnowmanNPC extends CitizensMobNPC {
|
||||
public static class EntitySnowmanNPC extends EntitySnowman implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public EntitySnowmanNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
|
||||
public EntitySnowmanNPC(World world, NPC npc) {
|
||||
super(world);
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
|
@ -39,16 +39,10 @@ public class CitizensSpiderNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
|
@ -40,16 +40,10 @@ public class CitizensSquidNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bk() {
|
||||
if (npc != null)
|
||||
|
@ -41,16 +41,10 @@ public class CitizensVillagerNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
|
@ -27,20 +27,6 @@ public class CitizensWitchNPC extends CitizensMobNPC {
|
||||
return (Witch) super.getBukkitEntity();
|
||||
}
|
||||
|
||||
public static class WitchNPC extends CraftWitch implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public WitchNPC(EntityWitchNPC entity) {
|
||||
super((CraftServer) Bukkit.getServer(), entity);
|
||||
this.npc = entity.npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EntityWitchNPC extends EntityWitch implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
@ -53,6 +39,7 @@ public class CitizensWitchNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,4 +93,18 @@ public class CitizensWitchNPC extends CitizensMobNPC {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
|
||||
public static class WitchNPC extends CraftWitch implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public WitchNPC(EntityWitchNPC entity) {
|
||||
super((CraftServer) Bukkit.getServer(), entity);
|
||||
this.npc = entity.npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,20 +27,6 @@ public class CitizensWitherNPC extends CitizensMobNPC {
|
||||
return (Wither) super.getBukkitEntity();
|
||||
}
|
||||
|
||||
public static class WitherNPC extends CraftWither implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public WitherNPC(EntityWitherNPC entity) {
|
||||
super((CraftServer) Bukkit.getServer(), entity);
|
||||
this.npc = entity.npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EntityWitherNPC extends EntityWither implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
@ -53,6 +39,7 @@ public class CitizensWitherNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,6 +50,12 @@ public class CitizensWitherNPC extends CitizensMobNPC {
|
||||
npc.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
if (npc == null)
|
||||
super.c();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(net.minecraft.server.Entity entity) {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
@ -105,11 +98,19 @@ public class CitizensWitherNPC extends CitizensMobNPC {
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
|
||||
public static class WitherNPC extends CraftWither implements NPCHolder {
|
||||
private final CitizensNPC npc;
|
||||
|
||||
public WitherNPC(EntityWitherNPC entity) {
|
||||
super((CraftServer) Bukkit.getServer(), entity);
|
||||
this.npc = entity.npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
if (npc == null)
|
||||
super.c();
|
||||
public NPC getNPC() {
|
||||
return npc;
|
||||
}
|
||||
}
|
||||
}
|
@ -40,16 +40,10 @@ public class CitizensWolfNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
|
@ -40,16 +40,10 @@ public class CitizensZombieNPC extends CitizensMobNPC {
|
||||
this.npc = (CitizensNPC) npc;
|
||||
if (npc != null) {
|
||||
NMS.clearGoals(goalSelector, targetSelector);
|
||||
NMS.setPersistent(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bh() {
|
||||
if (npc == null)
|
||||
super.bh();
|
||||
// check despawn method, we only want to despawn on chunk unload.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bi() {
|
||||
super.bi();
|
||||
|
@ -84,27 +84,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
return npc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void j_() {
|
||||
super.j_();
|
||||
if (npc == null)
|
||||
return;
|
||||
Navigation navigation = getNavigation();
|
||||
if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON)
|
||||
motX = motY = motZ = 0;
|
||||
|
||||
if (!navigation.f()) {
|
||||
navigation.e();
|
||||
moveOnCurrentHeading();
|
||||
} else if (motX != 0 || motZ != 0 || motY != 0)
|
||||
e(0, 0); // is this necessary? it does gravity/controllable but
|
||||
// sometimes players sink into the ground
|
||||
|
||||
if (noDamageTicks > 0)
|
||||
--noDamageTicks;
|
||||
npc.update();
|
||||
}
|
||||
|
||||
private void initialise(MinecraftServer minecraftServer) {
|
||||
Socket socket = new EmptySocket();
|
||||
NetworkManager netMgr = null;
|
||||
@ -131,6 +110,27 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void j_() {
|
||||
super.j_();
|
||||
if (npc == null)
|
||||
return;
|
||||
Navigation navigation = getNavigation();
|
||||
if (Math.abs(motX) < EPSILON && Math.abs(motY) < EPSILON && Math.abs(motZ) < EPSILON)
|
||||
motX = motY = motZ = 0;
|
||||
|
||||
if (!navigation.f()) {
|
||||
navigation.e();
|
||||
moveOnCurrentHeading();
|
||||
} else if (motX != 0 || motZ != 0 || motY != 0)
|
||||
e(0, 0); // is this necessary? it does gravity/controllable but
|
||||
// sometimes players sink into the ground
|
||||
|
||||
if (noDamageTicks > 0)
|
||||
--noDamageTicks;
|
||||
npc.update();
|
||||
}
|
||||
|
||||
private void moveOnCurrentHeading() {
|
||||
getControllerMove().c();
|
||||
getControllerLook().a();
|
||||
|
@ -6,9 +6,9 @@ import java.util.List;
|
||||
import net.citizensnpcs.api.exception.NPCLoadException;
|
||||
import net.citizensnpcs.api.trait.Trait;
|
||||
import net.citizensnpcs.api.util.DataKey;
|
||||
import net.citizensnpcs.util.Anchor;
|
||||
import net.citizensnpcs.util.Messages;
|
||||
import net.citizensnpcs.util.Messaging;
|
||||
import net.citizensnpcs.util.Anchor;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -44,7 +44,8 @@ public class Anchors extends Trait {
|
||||
for (DataKey sub : key.getRelative("list").getIntegerSubKeys())
|
||||
try {
|
||||
String[] parts = sub.getString("").split(";");
|
||||
anchors.add(new Anchor(parts[0], new Location(Bukkit.getServer().getWorld(parts[1]), Double.valueOf(parts[2]), Double.valueOf(parts[3]), Double.valueOf(parts[4]))));
|
||||
anchors.add(new Anchor(parts[0], new Location(Bukkit.getServer().getWorld(parts[1]), Double
|
||||
.valueOf(parts[2]), Double.valueOf(parts[3]), Double.valueOf(parts[4]))));
|
||||
} catch (NumberFormatException e) {
|
||||
Messaging.logTr(Messages.SKIPPING_INVALID_ANCHOR, sub.name(), e.getMessage());
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ public class Messages {
|
||||
public static final String ERROR_GETTING_ID_MAPPING = "citizens.nms-errors.getting-id-mapping";
|
||||
public static final String ERROR_INITALISING_SUB_PLUGIN = "citizens.sub-plugins.error-on-load";
|
||||
public static final String ERROR_LOADING_ECONOMY = "citizens.economy.error-loading";
|
||||
public static final String ERROR_SETTING_ENTITY_PERSISTENT = "citizens.nms-errors.error-setting-persistent";
|
||||
public static final String ERROR_SPAWNING_CUSTOM_ENTITY = "citizens.nms-errors.spawning-custom-entity";
|
||||
public static final String ERROR_STOPPING_NETWORK_THREADS = "citizens.nms-errors.stopping-network-threads";
|
||||
public static final String ERROR_UPDATING_NAVIGATION_WORLD = "citizens.nms-errors.updating-navigation-world";
|
||||
|
@ -42,6 +42,7 @@ public class NMS {
|
||||
private static final Map<EntityType, Float> MOVEMENT_SPEEDS = Maps.newEnumMap(EntityType.class);
|
||||
private static Field NAVIGATION_WORLD_FIELD;
|
||||
private static Field PATHFINDING_RANGE;
|
||||
private static Field PERSISTENT_FIELD;
|
||||
private static Field SPEED_FIELD;
|
||||
private static Field THREAD_STOPPER;
|
||||
|
||||
@ -171,6 +172,16 @@ public class NMS {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setPersistent(EntityLiving entity) {
|
||||
if (PERSISTENT_FIELD == null)
|
||||
return;
|
||||
try {
|
||||
PERSISTENT_FIELD.set(entity, true);
|
||||
} catch (Exception e) {
|
||||
Messaging.logTr(Messages.ERROR_SETTING_ENTITY_PERSISTENT, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static org.bukkit.entity.Entity spawnCustomEntity(org.bukkit.World world, Location at,
|
||||
Class<? extends Entity> clazz, EntityType type) {
|
||||
World handle = ((CraftWorld) world).getHandle();
|
||||
@ -259,6 +270,7 @@ public class NMS {
|
||||
NAVIGATION_WORLD_FIELD = getField(Navigation.class, "b");
|
||||
PATHFINDING_RANGE = getField(Navigation.class, "e");
|
||||
GOAL_FIELD = getField(PathfinderGoalSelector.class, "a");
|
||||
PERSISTENT_FIELD = getField(EntityLiving.class, "persistent");
|
||||
|
||||
try {
|
||||
Field field = getField(EntityTypes.class, "d");
|
||||
|
@ -1,6 +1,7 @@
|
||||
citizens.changed-implementation=Citizens implementation changed, disabling plugin.
|
||||
citizens.commands.citizens.save.help=Use the -a flag to save async (off the main server thread).
|
||||
citizens.commands.console-error=Please report this error: [See console]
|
||||
citizens.commands.errors.missing-world=World not found.
|
||||
citizens.commands.help.command-missing=Command /{0} not found.
|
||||
citizens.commands.help.header=Help
|
||||
citizens.commands.id-not-found=Couldn''t find any NPC with ID {0}.
|
||||
@ -41,7 +42,6 @@ citizens.commands.npc.lookclose.set=[[{0}]] will now rotate when players are nea
|
||||
citizens.commands.npc.lookclose.stopped=[[{0}]] will no longer rotate when players are nearby.
|
||||
citizens.commands.npc.mount.failed=Couldn''t mount [[{0}]].
|
||||
citizens.commands.npc.moveto.format=Format is x:y:z(:world) or x y z( world).
|
||||
citizens.commands.errors.missing-world=World not found.
|
||||
citizens.commands.npc.moveto.teleported=[[{0}]] teleported to {1}.
|
||||
citizens.commands.npc.owner.already-owner={0} is already the owner of {1}.
|
||||
citizens.commands.npc.owner.owner=[[{0}]]''s owner is [[{1}]].
|
||||
@ -77,14 +77,14 @@ citizens.commands.npc.tphere.teleported=[[{0}]] was teleported to your location.
|
||||
citizens.commands.npc.vulnerable.set=[[{0}]] is now vulnerable.
|
||||
citizens.commands.npc.vulnerable.stopped=[[{0}]] is no longer vulnerable.
|
||||
citizens.commands.page-missing=The page [[{0}]] does not exist.
|
||||
citizens.commands.requirements.too-few-arguments=Too few arguments.
|
||||
citizens.commands.requirements.too-many-arguments=Too many arguments.
|
||||
citizens.commands.requirements.missing-permission=You don't have permission to execute that command.
|
||||
citizens.commands.requirements.disallowed-mobtype=The NPC cannot be the mob type {0} to use that command.
|
||||
citizens.commands.requirements.missing-permission=You don't have permission to execute that command.
|
||||
citizens.commands.requirements.missing-required-trait=Missing required trait {0}.
|
||||
citizens.commands.requirements.must-be-ingame=You must be ingame to use that command.
|
||||
citizens.commands.requirements.must-be-owner=You must be the owner of this NPC to execute that command.
|
||||
citizens.commands.requirements.must-have-selected=You must have an NPC selected to execute that command.
|
||||
citizens.commands.requirements.too-few-arguments=Too few arguments.
|
||||
citizens.commands.requirements.too-many-arguments=Too many arguments.
|
||||
citizens.commands.script.compiled=Script compiled.
|
||||
citizens.commands.script.compiling=Script compiling...
|
||||
citizens.commands.script.file-missing=The file {0} doesn''t exist!
|
||||
@ -134,21 +134,6 @@ citizens.editors.text.realistic-looking-set=[[Realistic looking]] set to [[{0}]]
|
||||
citizens.editors.text.remove-prompt=Enter the index of the entry you wish to remove or [[page]] to view more pages.
|
||||
citizens.editors.text.removed-entry=[[Removed]] entry at index [[{0}]].
|
||||
citizens.editors.text.start-prompt=Type [[add]] to add an entry, [[edit]] to edit entries, [[remove]] to remove entries, [[close]] to toggle the NPC as a close talker, and [[random]] to toggle the NPC as a random talker. Type [[help]] to show this again.
|
||||
citizens.editors.waypoints.triggers.chat.prompt=Enter in chat lines to say. <br>Type in [[radius (radius)]] to set the block radius to broadcast the messages. <br> Type [[finish]] to finish the chat trigger or [[back]] to return to the previous prompt.
|
||||
citizens.editors.waypoints.triggers.remove.not-a-number=Index must be a number.
|
||||
citizens.editors.waypoints.triggers.chat.missing-radius=No radius supplied.
|
||||
citizens.editors.waypoints.triggers.chat.invalid-radius=The radius must be a number.
|
||||
citizens.editors.waypoints.triggers.remove.removed=Successfully removed trigger {0}.
|
||||
citizens.editors.waypoints.triggers.remove.index-out-of-range=Index must be in the range [[1-{0}]].
|
||||
citizens.editors.waypoints.triggers.remove.prompt=Enter in the index of the trigger to delete or [[back]] to return to the edit prompt. Current triggers are:
|
||||
citizens.editors.waypoints.triggers.teleport.prompt=Enter the destination in the format world:x:y:z. Type [[here]] to use your current location. Type [[back]] to return to the edit prompt.
|
||||
citizens.editors.waypoints.triggers.teleport.invalid-format=Invalid location given. Format is [[world]]:[[x]]:[[y]]:[[z]].
|
||||
citizens.editors.waypoints.triggers.delay.prompt=Enter the delay in [[server ticks]] to use. (20 ticks = 1 second)
|
||||
citizens.editors.waypoints.triggers.main.prompt=<b>Entered the waypoint trigger editor.<br> Type [[add]] to begin adding triggers and [[remove]] to remove triggers.<br><br> Current triggers are:
|
||||
citizens.editors.waypoints.triggers.main.missing-waypoint=Not editing a waypoint.
|
||||
citizens.editors.waypoints.triggers.add.added=<b>[[Added]] waypoint trigger successfully ({0}).
|
||||
citizens.editors.waypoints.triggers.add.invalid-trigger=Couldn''t create a trigger by the name [[{0}]].
|
||||
citizens.editors.waypoints.triggers.add.prompt=Enter in a trigger name to add or type [[back]] to return to the edit prompt. Valid trigger names are {0}.
|
||||
citizens.editors.waypoints.linear.added-waypoint=[[Added]] a waypoint at ({0}) ([[{1}]], [[{2}]])
|
||||
citizens.editors.waypoints.linear.begin=<b>Entered the linear waypoint editor!<br>[[Left click]] to add a waypoint, [[right click]] to remove.<br>Type [[toggle path]] to toggle showing entities at waypoints.
|
||||
citizens.editors.waypoints.linear.edit-slot-set=Editing slot set to [[{0}]] ({1}).
|
||||
@ -157,9 +142,25 @@ citizens.editors.waypoints.linear.not-showing-markers=[[Stopped]] showing waypoi
|
||||
citizens.editors.waypoints.linear.range-exceeded=Previous waypoint is {0} blocks away but the distance limit is {1}.
|
||||
citizens.editors.waypoints.linear.removed-waypoint=[[Removed]] a waypoint ([[{0}]] remaining) ([[{1}]])
|
||||
citizens.editors.waypoints.linear.showing-markers=[[Showing]] waypoint markers.
|
||||
citizens.editors.waypoints.triggers.add.added=<b>[[Added]] waypoint trigger successfully ({0}).
|
||||
citizens.editors.waypoints.triggers.add.invalid-trigger=Couldn''t create a trigger by the name [[{0}]].
|
||||
citizens.editors.waypoints.triggers.add.prompt=Enter in a trigger name to add or type [[back]] to return to the edit prompt. Valid trigger names are {0}.
|
||||
citizens.editors.waypoints.triggers.chat.invalid-radius=The radius must be a number.
|
||||
citizens.editors.waypoints.triggers.chat.missing-radius=No radius supplied.
|
||||
citizens.editors.waypoints.triggers.chat.prompt=Enter in chat lines to say. <br>Type in [[radius (radius)]] to set the block radius to broadcast the messages. <br> Type [[finish]] to finish the chat trigger or [[back]] to return to the previous prompt.
|
||||
citizens.editors.waypoints.triggers.delay.prompt=Enter the delay in [[server ticks]] to use. (20 ticks = 1 second)
|
||||
citizens.editors.waypoints.triggers.main.missing-waypoint=Not editing a waypoint.
|
||||
citizens.editors.waypoints.triggers.main.prompt=<b>Entered the waypoint trigger editor.<br> Type [[add]] to begin adding triggers and [[remove]] to remove triggers.<br><br> Current triggers are:
|
||||
citizens.editors.waypoints.triggers.remove.index-out-of-range=Index must be in the range [[1-{0}]].
|
||||
citizens.editors.waypoints.triggers.remove.not-a-number=Index must be a number.
|
||||
citizens.editors.waypoints.triggers.remove.prompt=Enter in the index of the trigger to delete or [[back]] to return to the edit prompt. Current triggers are:
|
||||
citizens.editors.waypoints.triggers.remove.removed=Successfully removed trigger {0}.
|
||||
citizens.editors.waypoints.triggers.teleport.invalid-format=Invalid location given. Format is [[world]]:[[x]]:[[y]]:[[z]].
|
||||
citizens.editors.waypoints.triggers.teleport.prompt=Enter the destination in the format world:x:y:z. Type [[here]] to use your current location. Type [[back]] to return to the edit prompt.
|
||||
citizens.limits.over-npc-limt=Over the NPC limit of {0}.
|
||||
citizens.load-task-error=NPC load task couldn''t be scheduled, disabling...
|
||||
citizens.nms-errors.clearing-goals=Could not clear goals: {0}.
|
||||
citizens.nms-errors.error-setting-persistent=Could not set NPC as persistent: {0}. NPC entity may despawn.
|
||||
citizens.nms-errors.getting-field=Could not fetch field {0}: {1}.
|
||||
citizens.nms-errors.getting-id-mapping=Could not fetch entity id mapping fields: {0}.
|
||||
citizens.nms-errors.spawning-custom-entity=Could not spawn custom entity: {0}.
|
||||
|
Loading…
Reference in New Issue
Block a user