entity

Discussion in 'Plugin Development' started by NoLiver92, Dec 24, 2012.

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

    NoLiver92

    i want to create an entity and change its meta data. i want to spawn a player entity. How can i do this?
     
  2. Offline

    Shiny Quagsire

    Try this library: Remote Entities.

    Human Entities have been removed for a while, but using modified packets you can "spawn" players. That's how most plugins that have NPCs do it. With that plugin you could do something like this:
    Code:
    EntityManager manager = RemoteEntities.createManager(this);
    RemoteEntity entity = manager.createEntity(RemoteEntity.Human, Bukkit.getWorld("world").getSpawnLocation(), true);
    Then you can add goals to make it do what you want.
     
  3. Offline

    NoLiver92

    Shiny Quagsire that hasnt been done for 1.4.6, it says 1.4.4/1.4.5 only
     
  4. Offline

    drampelt

    The forum post says 1.4.4/1.4.5 but you can download the 1.4-SNAPSHOT version from here which should work with 1.4.6.
     
  5. Offline

    NoLiver92

    ok but isnt there another way without including more libarys in my plugin?
     
  6. Offline

    drampelt

    You could do it manually using reflection, but using a library would make things go a lot easier.
     
  7. Offline

    NoLiver92

    ok but i currently have 8 diffrent libarys and im trying to cut them down. ive done 2, just 8 to go. theres surly a way to do it as in the apis you can spawn player (or can you spawn a vilager and set it to player)
     
  8. Offline

    fireblast709

    Create an net.minecraft.server.<version>.EntityPlayer and use that in the Packet20NamedEntitySpawn packet
     
  9. Offline

    NoLiver92

    how would i do the reflection thing?
     
  10. Offline

    drampelt

    I haven't seen any tutorial for player entities, but this or this may be helpful.
     
  11. Offline

    NoLiver92

    thanks but how would i initialise an entity to be a villager:

    Code:
    Entity ent = new Entity();
    thats what i tried but its wrong
     
  12. Offline

    drampelt

    Try something like this:
    Code:
    World w = getServer().getWorld("world")
    Entity ent = w.spawnEntity(Location, EntityType.VILLAGER);
    Edit: where Location is the org.bukkit.Location where you want it to spawn and w is the world you want it to spawn in
     
  13. Offline

    NoLiver92

    i know that works but im trying to do something else (set meta data as it works on other things). but i need to initalize the variable
     
Thread Status:
Not open for further replies.

Share This Page