mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-24 11:38:26 +01:00
Make NPC handles accessible from nms Entity (increase speed of NPCManager.getNPC), make Text trait respect despawned state, despawn NPCs on death event
This commit is contained in:
parent
15ebeab5a9
commit
d0575e3e22
@ -249,8 +249,8 @@ public class Citizens extends JavaPlugin {
|
|||||||
if (!key.keyExists("name"))
|
if (!key.keyExists("name"))
|
||||||
throw new NPCLoadException("Could not find a name for the NPC with ID '" + id + "'.");
|
throw new NPCLoadException("Could not find a name for the NPC with ID '" + id + "'.");
|
||||||
|
|
||||||
NPC npc = npcManager.createNPC(EntityType.valueOf(key.getString("traits.type").toUpperCase()), id, key
|
NPC npc = npcManager.createNPC(EntityType.valueOf(key.getString("traits.type").toUpperCase()), id,
|
||||||
.getString("name"), null);
|
key.getString("name"), null);
|
||||||
try {
|
try {
|
||||||
((CitizensNPC) npc).load(key);
|
((CitizensNPC) npc).load(key);
|
||||||
} catch (NPCException ex) {
|
} catch (NPCException ex) {
|
||||||
|
@ -22,6 +22,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
||||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||||
@ -138,6 +139,14 @@ public class EventListen implements Listener {
|
|||||||
npc.getCharacter().onRightClick(npc, player);
|
npc.getCharacter().onRightClick(npc, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityDeath(EntityDeathEvent event) {
|
||||||
|
if (!npcManager.isNPC(event.getEntity()))
|
||||||
|
return;
|
||||||
|
NPC npc = npcManager.getNPC(event.getEntity());
|
||||||
|
npc.despawn();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Player events
|
* Player events
|
||||||
*/
|
*/
|
||||||
|
@ -4,6 +4,7 @@ import java.lang.reflect.Constructor;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.minecraft.server.Entity;
|
import net.minecraft.server.Entity;
|
||||||
import net.minecraft.server.EntityLiving;
|
import net.minecraft.server.EntityLiving;
|
||||||
import net.minecraft.server.EntityTypes;
|
import net.minecraft.server.EntityTypes;
|
||||||
@ -19,7 +20,7 @@ public abstract class CitizensMobNPC extends CitizensNPC {
|
|||||||
protected CitizensMobNPC(CitizensNPCManager manager, int id, String name, Class<? extends EntityLiving> clazz) {
|
protected CitizensMobNPC(CitizensNPCManager manager, int id, String name, Class<? extends EntityLiving> clazz) {
|
||||||
super(manager, id, name);
|
super(manager, id, name);
|
||||||
try {
|
try {
|
||||||
this.constructor = clazz.getConstructor(World.class);
|
this.constructor = clazz.getConstructor(World.class, NPC.class);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw new IllegalStateException("unable to find an entity constructor");
|
throw new IllegalStateException("unable to find an entity constructor");
|
||||||
}
|
}
|
||||||
@ -29,7 +30,7 @@ public abstract class CitizensMobNPC extends CitizensNPC {
|
|||||||
|
|
||||||
private EntityLiving createEntityFromClass(World world) {
|
private EntityLiving createEntityFromClass(World world) {
|
||||||
try {
|
try {
|
||||||
return constructor.newInstance(world);
|
return constructor.newInstance(world, this);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
|
@ -13,10 +13,12 @@ import net.citizensnpcs.api.npc.NPCManager;
|
|||||||
import net.citizensnpcs.api.npc.character.Character;
|
import net.citizensnpcs.api.npc.character.Character;
|
||||||
import net.citizensnpcs.api.util.Storage;
|
import net.citizensnpcs.api.util.Storage;
|
||||||
import net.citizensnpcs.editor.Editor;
|
import net.citizensnpcs.editor.Editor;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.citizensnpcs.util.ByIdArray;
|
import net.citizensnpcs.util.ByIdArray;
|
||||||
import net.citizensnpcs.util.NPCBuilder;
|
import net.citizensnpcs.util.NPCBuilder;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -66,9 +68,14 @@ public class CitizensNPCManager implements NPCManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NPC getNPC(Entity entity) {
|
public NPC getNPC(Entity entity) {
|
||||||
for (NPC npc : npcs)
|
net.minecraft.server.Entity handle = ((CraftEntity) entity).getHandle();
|
||||||
if (npc.isSpawned() && npc.getBukkitEntity().getEntityId() == entity.getEntityId())
|
if (handle instanceof NPCHandle)
|
||||||
|
return ((NPCHandle) handle).getNPC();
|
||||||
|
for (NPC npc : npcs) { // fall back to linear search
|
||||||
|
if (npc.isSpawned() && npc.getBukkitEntity().getEntityId() == entity.getEntityId()) {
|
||||||
return npc;
|
return npc;
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
src/main/java/net/citizensnpcs/npc/ai/NPCHandle.java
Normal file
7
src/main/java/net/citizensnpcs/npc/ai/NPCHandle.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package net.citizensnpcs.npc.ai;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
|
|
||||||
|
public interface NPCHandle {
|
||||||
|
public NPC getNPC();
|
||||||
|
}
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityBlaze;
|
import net.minecraft.server.EntityBlaze;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensBlazeNPC extends CitizensMobNPC {
|
|||||||
return (Blaze) getHandle().getBukkitEntity();
|
return (Blaze) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityBlazeNPC extends EntityBlaze {
|
public static class EntityBlazeNPC extends EntityBlaze implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityBlazeNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityBlazeNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityCaveSpider;
|
import net.minecraft.server.EntityCaveSpider;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensCaveSpiderNPC extends CitizensMobNPC {
|
|||||||
return (CaveSpider) getHandle().getBukkitEntity();
|
return (CaveSpider) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityCaveSpiderNPC extends EntityCaveSpider {
|
public static class EntityCaveSpiderNPC extends EntityCaveSpider implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityCaveSpiderNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityCaveSpiderNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityChicken;
|
import net.minecraft.server.EntityChicken;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensChickenNPC extends CitizensMobNPC {
|
|||||||
return (Chicken) getHandle().getBukkitEntity();
|
return (Chicken) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityChickenNPC extends EntityChicken {
|
public static class EntityChickenNPC extends EntityChicken implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityChickenNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityChickenNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityCow;
|
import net.minecraft.server.EntityCow;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensCowNPC extends CitizensMobNPC {
|
|||||||
return (Cow) getHandle().getBukkitEntity();
|
return (Cow) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityCowNPC extends EntityCow {
|
public static class EntityCowNPC extends EntityCow implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityCowNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityCowNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityCreeper;
|
import net.minecraft.server.EntityCreeper;
|
||||||
import net.minecraft.server.EntityWeatherLighting;
|
import net.minecraft.server.EntityWeatherLighting;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
@ -21,10 +22,17 @@ public class CitizensCreeperNPC extends CitizensMobNPC {
|
|||||||
return (Creeper) getHandle().getBukkitEntity();
|
return (Creeper) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityCreeperNPC extends EntityCreeper {
|
public static class EntityCreeperNPC extends EntityCreeper implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityCreeperNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityCreeperNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityEnderDragon;
|
import net.minecraft.server.EntityEnderDragon;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensEnderDragonNPC extends CitizensMobNPC {
|
|||||||
return (EnderDragon) getHandle().getBukkitEntity();
|
return (EnderDragon) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityEnderDragonNPC extends EntityEnderDragon {
|
public static class EntityEnderDragonNPC extends EntityEnderDragon implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityEnderDragonNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityEnderDragonNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
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;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.citizensnpcs.util.Messaging;
|
import net.citizensnpcs.util.Messaging;
|
||||||
|
|
||||||
import net.minecraft.server.EntityEnderman;
|
import net.minecraft.server.EntityEnderman;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -58,10 +59,17 @@ public class CitizensEndermanNPC extends CitizensMobNPC implements Equipable {
|
|||||||
getTrait(Equipment.class).set(0, set);
|
getTrait(Equipment.class).set(0, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityEndermanNPC extends EntityEnderman {
|
public static class EntityEndermanNPC extends EntityEnderman implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityEndermanNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityEndermanNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityGhast;
|
import net.minecraft.server.EntityGhast;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensGhastNPC extends CitizensMobNPC {
|
|||||||
return (Ghast) getHandle().getBukkitEntity();
|
return (Ghast) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityGhastNPC extends EntityGhast {
|
public static class EntityGhastNPC extends EntityGhast implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityGhastNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityGhastNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityGiantZombie;
|
import net.minecraft.server.EntityGiantZombie;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensGiantNPC extends CitizensMobNPC {
|
|||||||
return (Giant) getHandle().getBukkitEntity();
|
return (Giant) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityGiantNPC extends EntityGiantZombie {
|
public static class EntityGiantNPC extends EntityGiantZombie implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityGiantNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityGiantNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityIronGolem;
|
import net.minecraft.server.EntityIronGolem;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensIronGolemNPC extends CitizensMobNPC {
|
|||||||
return (IronGolem) getHandle().getBukkitEntity();
|
return (IronGolem) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityIronGolemNPC extends EntityIronGolem {
|
public static class EntityIronGolemNPC extends EntityIronGolem implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityIronGolemNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityIronGolemNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityMagmaCube;
|
import net.minecraft.server.EntityMagmaCube;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensMagmaCubeNPC extends CitizensMobNPC {
|
|||||||
return (MagmaCube) getHandle().getBukkitEntity();
|
return (MagmaCube) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityMagmaCubeNPC extends EntityMagmaCube {
|
public static class EntityMagmaCubeNPC extends EntityMagmaCube implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityMagmaCubeNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityMagmaCubeNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
setSize(3);
|
setSize(3);
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityMushroomCow;
|
import net.minecraft.server.EntityMushroomCow;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensMushroomCowNPC extends CitizensMobNPC {
|
|||||||
return (MushroomCow) getHandle().getBukkitEntity();
|
return (MushroomCow) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityMushroomCowNPC extends EntityMushroomCow {
|
public static class EntityMushroomCowNPC extends EntityMushroomCow implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityMushroomCowNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityMushroomCowNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityOcelot;
|
import net.minecraft.server.EntityOcelot;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensOcelotNPC extends CitizensMobNPC {
|
|||||||
return (Ocelot) getHandle().getBukkitEntity();
|
return (Ocelot) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityOcelotNPC extends EntityOcelot {
|
public static class EntityOcelotNPC extends EntityOcelot implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityOcelotNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityOcelotNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityPig;
|
import net.minecraft.server.EntityPig;
|
||||||
import net.minecraft.server.EntityWeatherLighting;
|
import net.minecraft.server.EntityWeatherLighting;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
@ -21,10 +22,17 @@ public class CitizensPigNPC extends CitizensMobNPC {
|
|||||||
return (Pig) getHandle().getBukkitEntity();
|
return (Pig) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityPigNPC extends EntityPig {
|
public static class EntityPigNPC extends EntityPig implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityPigNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityPigNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityPigZombie;
|
import net.minecraft.server.EntityPigZombie;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensPigZombieNPC extends CitizensMobNPC {
|
|||||||
return (PigZombie) getHandle().getBukkitEntity();
|
return (PigZombie) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityPigZombieNPC extends EntityPigZombie {
|
public static class EntityPigZombieNPC extends EntityPigZombie implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityPigZombieNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityPigZombieNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntitySheep;
|
import net.minecraft.server.EntitySheep;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensSheepNPC extends CitizensMobNPC {
|
|||||||
return (Sheep) getHandle().getBukkitEntity();
|
return (Sheep) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntitySheepNPC extends EntitySheep {
|
public static class EntitySheepNPC extends EntitySheep implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntitySheepNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntitySheepNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntitySilverfish;
|
import net.minecraft.server.EntitySilverfish;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensSilverfishNPC extends CitizensMobNPC {
|
|||||||
return (Silverfish) getHandle().getBukkitEntity();
|
return (Silverfish) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntitySilverfishNPC extends EntitySilverfish {
|
public static class EntitySilverfishNPC extends EntitySilverfish implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntitySilverfishNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntitySilverfishNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntitySkeleton;
|
import net.minecraft.server.EntitySkeleton;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensSkeletonNPC extends CitizensMobNPC {
|
|||||||
return (Skeleton) getHandle().getBukkitEntity();
|
return (Skeleton) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntitySkeletonNPC extends EntitySkeleton {
|
public static class EntitySkeletonNPC extends EntitySkeleton implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntitySkeletonNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntitySkeletonNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntitySlime;
|
import net.minecraft.server.EntitySlime;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensSlimeNPC extends CitizensMobNPC {
|
|||||||
return (Slime) getHandle().getBukkitEntity();
|
return (Slime) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntitySlimeNPC extends EntitySlime {
|
public static class EntitySlimeNPC extends EntitySlime implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntitySlimeNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntitySlimeNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
setSize(3);
|
setSize(3);
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntitySnowman;
|
import net.minecraft.server.EntitySnowman;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensSnowmanNPC extends CitizensMobNPC {
|
|||||||
return (Snowman) getHandle().getBukkitEntity();
|
return (Snowman) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntitySnowmanNPC extends EntitySnowman {
|
public static class EntitySnowmanNPC extends EntitySnowman implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntitySnowmanNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntitySnowmanNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntitySpider;
|
import net.minecraft.server.EntitySpider;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensSpiderNPC extends CitizensMobNPC {
|
|||||||
return (Spider) getHandle().getBukkitEntity();
|
return (Spider) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntitySpiderNPC extends EntitySpider {
|
public static class EntitySpiderNPC extends EntitySpider implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntitySpiderNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntitySpiderNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntitySquid;
|
import net.minecraft.server.EntitySquid;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensSquidNPC extends CitizensMobNPC {
|
|||||||
return (Squid) getHandle().getBukkitEntity();
|
return (Squid) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntitySquidNPC extends EntitySquid {
|
public static class EntitySquidNPC extends EntitySquid implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntitySquidNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntitySquidNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityVillager;
|
import net.minecraft.server.EntityVillager;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensVillagerNPC extends CitizensMobNPC {
|
|||||||
return (Villager) getHandle().getBukkitEntity();
|
return (Villager) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityVillagerNPC extends EntityVillager {
|
public static class EntityVillagerNPC extends EntityVillager implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityVillagerNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityVillagerNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityWolf;
|
import net.minecraft.server.EntityWolf;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensWolfNPC extends CitizensMobNPC {
|
|||||||
return (Wolf) getHandle().getBukkitEntity();
|
return (Wolf) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityWolfNPC extends EntityWolf {
|
public static class EntityWolfNPC extends EntityWolf implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityWolfNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityWolfNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package net.citizensnpcs.npc.entity;
|
package net.citizensnpcs.npc.entity;
|
||||||
|
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.npc.CitizensMobNPC;
|
import net.citizensnpcs.npc.CitizensMobNPC;
|
||||||
import net.citizensnpcs.npc.CitizensNPCManager;
|
import net.citizensnpcs.npc.CitizensNPCManager;
|
||||||
|
import net.citizensnpcs.npc.ai.NPCHandle;
|
||||||
import net.minecraft.server.EntityZombie;
|
import net.minecraft.server.EntityZombie;
|
||||||
import net.minecraft.server.PathfinderGoalSelector;
|
import net.minecraft.server.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
@ -20,10 +21,17 @@ public class CitizensZombieNPC extends CitizensMobNPC {
|
|||||||
return (Zombie) getHandle().getBukkitEntity();
|
return (Zombie) getHandle().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EntityZombieNPC extends EntityZombie {
|
public static class EntityZombieNPC extends EntityZombie implements NPCHandle {
|
||||||
|
private final NPC npc;
|
||||||
|
|
||||||
public EntityZombieNPC(World world) {
|
@Override
|
||||||
|
public NPC getNPC() {
|
||||||
|
return this.npc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityZombieNPC(World world, NPC npc) {
|
||||||
super(world);
|
super(world);
|
||||||
|
this.npc = npc;
|
||||||
goalSelector = new PathfinderGoalSelector();
|
goalSelector = new PathfinderGoalSelector();
|
||||||
targetSelector = new PathfinderGoalSelector();
|
targetSelector = new PathfinderGoalSelector();
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,8 @@ public class Text extends Trait implements Runnable, Toggleable, ConversationAba
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!npc.isSpawned())
|
||||||
|
return;
|
||||||
EntityHuman search = null;
|
EntityHuman search = null;
|
||||||
EntityLiving handle = ((CitizensNPC) npc).getHandle();
|
EntityLiving handle = ((CitizensNPC) npc).getHandle();
|
||||||
if ((search = handle.world.findNearbyPlayer(handle, 5)) != null && talkClose) {
|
if ((search = handle.world.findNearbyPlayer(handle, 5)) != null && talkClose) {
|
||||||
|
Loading…
Reference in New Issue
Block a user