Solved Spawning Dropped Entities?

Discussion in 'Spigot Plugin Development' started by Potters, May 16, 2016.

  1. Ok, I am making a drop party plugin. My effects work fine and there is nothing wrong with my actual code but what I do not know is how I can spawn in dropped entities of a certain type?

    I need to drop entities at a certain location in a world and they need to be a certain item. Anyone know how to do this?

    The current code I have tried is:

    Entity entity = p.getWorld().spawnEntity(new Location(Bukkit.getWorld("world"), 311, 62, -574), EntityType.DROPPED_ITEM);
  2. Example:
    (LOCATION).getWorld().spawnEntity((LOCATION), EntityType.COW);
    • Useful Useful x 1
  3. Code (Text):
    World.dropItem(Location, ItemStack);
    • Useful Useful x 1
  4. To spawn in DROPPED entities you do as following:
    Code (Text):
    world.dropItem(location, item);
    • Useful Useful x 2
  5. Thanks! I have got this to work!
  6. Please... Please... Please... Stop typing like that.
    • Agree Agree x 1
  7. If you want to just drop the item
    Code (Text):
            Location locationToDrop;
            ItemStack itemToDrop = new ItemStack(Material.DIAMOND);
            locationToDrop.getWorld().dropItemNaturally(locationToDrop, itemToDrop);
    However if you spawn a bunch of identical items in the same location, they'll most likely stack.