Line of sight.. Spawn invisible wither with nametag?

Discussion in 'Spigot Plugin Development' started by iHolden, Jul 9, 2015.

  1. Hello!

    I've been developing since May, I haven't really played around with the Mob AI yet, I've mainly used API's for quick stuff mediocre plugins. Anyways, At a players line of sight (Just one block out of the hit range) to spawn a wither that is invisible, & can customize the name.

    I don't have much, please no rude comments or such, we're all still learning.
    Here's my code:
    Code (Text):

    package me.iHolden.Wither;

    import org.bukkit.Bukkit;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.plugin.java.JavaPlugin;

    public class Core extends JavaPlugin implements Listener {
        public void onEnable() {
            Bukkit.getPluginManager().registerEvents(this, this);
        }
        public void onInteract(PlayerInteractEvent e) {
            Player p = (Player) e;
            p.getLineOfSight(Help, Me);
        }

    }
     
     
  2. sothatsit

    Patron

    Just use an api, if you are just learning the bukkit api then you definitely wont know how to spawn a wither in front of the player. This has to be done using either packets or custom entities, which if you cant do simple things like look at the javadocs for arguments of commands, will be out of your knowledge range. I would just find an API which you can use.
     
  3. That's the point, I've used BarAPI & BossBarAPI, I will have no real use for this considering I do not own a server, it was to better my knowledge of packets & the mob AI.
     
  4. Consider learning to do more simple tasks like spawning in any other entity (wither is a hard one) and making them invisible, custom names etc... like making your own custom zombie class that changes the way a xombie thinks, once you have mastered that it should be the same just with a wither
     
  5. How do you spawn in a wither?
     
  6. Im not the one ti ask my friend :) I would most likely lead you to somehow spawning a pig instead :/
     
    • Funny Funny x 1
  7. sothatsit

    Patron

    If you want to get into packets, take a look at ProtocolLib and ProtocolWrapper. Also take a look at wiki.vg, in particular the page about entity metadata.

    The packets you will need are the spawn entity living packet, entity destroy packet and the entity teleport packet. If you want to be more efficient you can also use entity move packet, but this can only move the entity 4 blocks at a time, so you would have to use a mixture of it and the teleport packet.

    Have fun!