Solved Cant see custom entity

Discussion in 'Spigot Plugin Development' started by Drakonn, Jun 23, 2018.

Thread Status:
Not open for further replies.
  1. Im trying to spawn a custom Entity with certain custom goals, equipment and name. based off my debugging the entity appears to be spawning with all the correct attributes however I can not actually see the entity. I have come to this conclusion based off the following debugging [​IMG]
    6 seconds after the entity is spawned it has a new pitch/yaw and moved location slightly, this is different every time the mob is spawned. However the entity doesn't actually show up.

    Heres all the relevant code and there are no errors in console.

    Code (Java):
      LivingEntity target = getTarget(targets);
                net.minecraft.server.v1_8_R3.Entity NMSentity = new ZombieMinion(location.getWorld(), target, player);
                Location randomLoc = Util.randomLocation(location);
                EntityTypes.spawnEntity(NMSentity , randomLoc);
                Entity entity = NMSentity.getBukkitEntity();
                Bukkit.broadcastMessage("Spawning minion at "+entity.getLocation().toString());
                Bukkit.broadcastMessage("minions name is "+entity.getName());
                new BukkitRunnable() {
                    public void run() {
                    if(entity.isDead()) {
                        Bukkit.broadcastMessage("entity dead");
                    Bukkit.broadcastMessage("killing entity");
                }.runTaskLater(ZydoxWeapons.getInstance(), minionStaff.getStayFor()*20);

    Code (Text):
        BAT_MINION("Bat", 65, BatMinion.class),
        ZOMBIE_MINION("Zombie", 54, ZombieMinion.class);

        private EntityTypes(String name, int id, Class<? extends Entity> custom)
            addToMaps(custom, name, id);

        public static void spawnEntity(Entity entity, Location loc)
            entity.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());

        private static void addToMaps(Class clazz, String name, int id)


    Code (Text):
        private Player master;

        public ZombieMinion(org.bukkit.World world, LivingEntity target, Player master)
            setEquipment(4, CraftItemStack.asNMSCopy(MinionStaff.getHelmet()));
            setEquipment(3, CraftItemStack.asNMSCopy(MinionStaff.getChestplate()));
            setEquipment(2, CraftItemStack.asNMSCopy(MinionStaff.getLeggings()));
            setEquipment(1, CraftItemStack.asNMSCopy(MinionStaff.getBoots()));
            setEquipment(0, CraftItemStack.asNMSCopy(MinionStaff.getWeapon()));
            if(target != null)
                setGoalTarget(((EntityLiving) ((CraftPlayer)target).getHandle()) , EntityTargetEvent.TargetReason.CUSTOM, true);
            this.master = master;

        public Player getMaster() {
            return master;
  2. FrostedSnowman

    Resource Staff

    you're never registering the entity.
  3. Thanks, somehow forgot to do that :eek:
Thread Status:
Not open for further replies.