Search in sources :

Example 1 with CraftItem

use of org.bukkit.craftbukkit.v1_13_R1.entity.CraftItem in project Magma by magmafoundation.

the class CraftWorld method dropItem.

public Item dropItem(Location loc, ItemStack item) {
    Validate.notNull(item, "Cannot drop a Null item.");
    Validate.isTrue(item.getTypeId() != 0, "Cannot drop AIR.");
    EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), CraftItemStack.asNMSCopy(item));
    entity.pickupDelay = 10;
    world.spawnEntity(entity, SpawnReason.CUSTOM);
    // However, this entity is not at the moment backed by a server entity class so it may be left.
    return new CraftItem(world.getServer(), entity);
}
Also used : CraftItem(org.bukkit.craftbukkit.v1_12_R1.entity.CraftItem) EntityItem(net.minecraft.entity.item.EntityItem)

Aggregations

EntityItem (net.minecraft.entity.item.EntityItem)1 CraftItem (org.bukkit.craftbukkit.v1_12_R1.entity.CraftItem)1