Player-skin mobs

Discussion in 'Plugin Development' started by seanstar24, Jul 20, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    seanstar24

    I'm trying to create a plugin that spawns a mob that uses the player skin, I have seen this in mods before but I have searched and have no idea how to do so...
    Anyone know how to do this?
     
  2. Offline

    xTrollxDudex

    seanstar24
    That's probably another bukkit limitation...
     
  3. Offline

    seanstar24

    I know it's doable please help.
     
  4. Offline

    xTrollxDudex

    seanstar24
    Dude, I don't think so, try the spout forums. I've been around longer, know my stuff.

    Besides, it is only possible with a) a mob that is a Player b) a player mob with a name the same as a real player.
    Otherwise, look into an npc plugin like DwDNPC or Citizens

    Edit: also the server texture in server.properties
     
  5. Offline

    krazytraynz

    You could use this, or you could use SpoutCraft. I wouldn't recommend Spout however, as it requires the Players who join the server to have a client mod installed. But if the first method doesn't work, Spout probably would.
     
    xTrollxDudex likes this.
  6. Offline

    seanstar24

    On second thought... how would I make a player mob?
     
  7. Offline

    krazytraynz

    You mean an entirely new entity? Because that isn't possible with Bukkit. You can change the behaviors of an existing one, but that's about as far as you can get.
     
  8. Offline

    seanstar24

    krazytraynz
    I mean add an entity that behaves differently but uses the skin of a certain mob...
    For instance the "player" mob like in citizens or questx.
     
  9. Offline

    xTrollxDudex

    krazytraynz seanstar24
    Actually you can. An npc is created by making a new HumanEntity or something I don't have access to my notes right now. Let me check.

    Edit: you create a new EntityPlayer. It's got some nms to it tho.
    PHP:
    public class NPCSpawner{

            List<
    Utilityceptionnpcs = new ArrayList<Utilityception>();

            public 
    NPCSpawner(Player p){

                   
    Location l p.getLocation();
                   
    String s ""
                   
    WorldServer wS = ((CraftWorldl.getWorld()).getHandle();

                   
    NPCthing t = new NPCthing(((CraftServerBukkit.getServer()).getServer(), wSs, new PlayerInteractManager(wS));

                   
    t.setPositionRotation(l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch());

                   
    wS.addEntity(t);

                   
    Utilityception u = new NPCUtilities(t);

                   
    u.setNum(npcs.size() + 1);
                   
    ncps.add(u);

                   return 
    u;
            }

            private class 
    NPCthing extends EntityPlayer{

                    public 
    NPCthing(MinecraftServer seWorld wString sPlayerInteractManager mng){
                            
    super(sewsmng);
                    }
            }

            private class 
    NPCUtilities extends Utilityception{

                    public 
    NPCUtilities(NPCthing thing){
                            
    super(thing);
                    }

                    public 
    void animateArmSwing() {
                            ((
    WorldServergetEntity().world).tracker.a(getEntity(), new Packet18ArmAnimation(getEntity(), 1));
                    }

                    public 
    void actAsHurt() {
                            ((
    WorldServergetEntity().world).tracker.a(getEntity(), new Packet18ArmAnimation(getEntity(), 2));
                    }

                    public 
    void setItemInHand(Material mshort damage) {
                            ((
    HumanEntitygetEntity().getBukkitEntity()).setItemInHand(new ItemStack(m1damage));
                    }
            }

            private class 
    Utilityception{

                    
    Entity ent;
                    
    int id;

                    public 
    Utilityception(Entity ent){
                            
    this.ent ent;
                    }

                    public 
    Entity getEntity(){
                            return 
    ent;
                    }
                    
                    public 
    void getId(){
                            return 
    id;
                    }
                    public 
    void setId(int id){
                            
    this.id id;
                    }

                    public 
    void remove(Utilityception util){
                            if(
    ncps.get(util) != null){
                                    
    Utilityception ncp ncps.get(util);
                                    
    ncps.remove(util);
                                    
    ncp.removeFromWorld();
                            }
                    }
                    public 
    void remove(int id){
                            for(
    Utilityception u npcs){
                                    if(
    u.getId().equals(id){
                                            
    Utilityception ncp ncps.get(u);
                                            
    ncps.remove(u);
                                            
    ncp.removeFromWorld();
                                    }
                            }
                    }
            }
    }
     
  10. Offline

    seanstar24

  11. Offline

    xTrollxDudex

    seanstar24
    Net Minecraft Server. Even I need some work in that area.... Very complex
     
  12. Offline

    krazytraynz

    net.minecraft.server, the basic minecraft server classes.
    Edit: Ninja'd :p
     
    xTrollxDudex likes this.
  13. Offline

    seanstar24

    When I try to plug this into eclipse it gives a boatload of errors...
    I imported everything I could, but I have a feeling I'm importing the wrong things. Do you know if there are errors in the code and if you could say what needs to imported that would be awesome!
    ex:
    import net.minecraft.server.v1_6_R1.Entity;
    import net.minecraft.server.v1_6_R1.EntityPlayer;
    import net.minecraft.server.v1_6_R1.ItemStack;
    import net.minecraft.server.v1_6_R1.Material;
    import net.minecraft.server.v1_6_R1.MinecraftServer;
    import net.minecraft.server.v1_6_R1.Packet18ArmAnimation;
    import net.minecraft.server.v1_6_R1.PlayerInteractManager;
    import net.minecraft.server.v1_6_R1.World;
    import net.minecraft.server.v1_6_R1.WorldServer;
    (if you're up to it/can)
     
  14. Offline

    xTrollxDudex

    seanstar24
    Again this is very badly written code. Put all the classes into sub classes.
    I don't have access to my computer right now. I'm on an iPad actually so you're on your own on this.
     
  15. Offline

    seanstar24

  16. Offline

    monkeymanboy

    Do you mean like it has the head of the player on its head and the body is the same?
     
  17. Offline

    John Cameron

    If this works It'll be sooooooo awesome
     
Thread Status:
Not open for further replies.

Share This Page