How Do I spawn an Entity that's not an Creature?

Discussion in 'Plugin Development' started by WMisiedjan, Feb 26, 2011.

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

    WMisiedjan

    I think my Topic title say's enough,

    But here is more. The world.spawn functions are limited to Specific entities and not all entities. I want to be able to spawn a Primed TNT entity.

    I've done some research and I just couldn't find a way to spawn a other entity that Creatures or Players.

    I hope that someone can help out.

    Greetings, WMisiedjan
     
  2. Offline

    Edward Hand

    It requires interfacing with CraftBukkit and the minecraft server base classes.
    Code:
    CraftWorld cWorld = (CraftWorld)theWorld;
    EntityTNTPrimed tnt = new EntityTNTPrimed(cWorld.getHandle(),X,Y,Z);
    cWorld.getHandle().a(tnt);
     
  3. Offline

    Nohup

    I believe it would be like this:

    EntityTNTPrimed tnt = new EntityTNTPrimed((net.minecraft.server.World) event.getPlayer().getWorld(), X, Y, Z);

    Where the X, Y and Z are the coordinates. If you then want to use it with the bukkit wrapper you would need to do:

    CraftTNTPrimed tntp = new CraftTNTPrimed((CraftServer) event.getPlayer().getServer(), tnt);

    This is based on the PlayerListener event, but should give you what you need to do what you are looking for. You will have to include CraftBukkit as a dependency but this APPEARS to be what you need. I haven't tested it yet though :)

    ** EDIT **
    Bah, Edward snuck in while I was researching!
     
  4. Offline

    WMisiedjan

    Thank you, Both!
     
Thread Status:
Not open for further replies.

Share This Page