Package org.spout.api.inventory

Examples of org.spout.api.inventory.ItemStack


  @Override
  public void close() {
    GridIterator iterator = inventory.getGrid().iterator();
    while (iterator.hasNext()) {
      ItemStack item = inventory.get(iterator.next());
      if (item != null) {
        getHuman().dropItem(item);
      }
    }
    inventory.clear();
View Full Code Here


    physics.activate(2f, new BoxShape(1f, 2f, 1f), false, true);
    physics.setFriction(10f);
    physics.setRestitution(0f);

    DeathDrops dropComponent = getOwner().add(DeathDrops.class);
    dropComponent.addDrop(new ItemStack(VanillaMaterials.ARROW, random.nextInt(2)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.BONE, random.nextInt(2)));
    dropComponent.addXpDrop((short) 5);

    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(20);
    }
View Full Code Here

  public void onAttached() {
    super.onAttached();
    setEntityProtocol(new CreatureProtocol(CreatureType.WITCH));
    DeathDrops dropComponent = getOwner().add(DeathDrops.class);
    Random random = getRandom();
    dropComponent.addDrop(new ItemStack(VanillaMaterials.GLASS_BOTTLE, random.nextInt(6)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.GLOWSTONE_DUST, random.nextInt(6)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.GUNPOWDER, random.nextInt(6)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.REDSTONE_DUST, random.nextInt(6)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.SPIDER_EYE, random.nextInt(6)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.STICK, random.nextInt(6)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.SUGAR, random.nextInt(6)));
    dropComponent.addXpDrop((short) 5);
    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(26);
    }
View Full Code Here

public class Blaze extends Living implements Hostile, Aggressive {
  @Override
  public void onAttached() {
    super.onAttached();
    setEntityProtocol(new CreatureProtocol(CreatureType.BLAZE));
    getOwner().add(DeathDrops.class).addDrop(new ItemStack(VanillaMaterials.BLAZE_ROD, getRandom().nextInt(1))).addXpDrop((short) 10);
    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(20);
    }
    Damage damage = getOwner().add(Damage.class);
    damage.getDamageLevel(Difficulty.EASY).setAmount(3);
View Full Code Here

      this.min = min;
      this.max = max;
    }

    private ItemStack getRandomStack(Random random) {
      return new ItemStack(loot, random.nextInt(max - min + 1) + min);
    }
View Full Code Here

  public void onAttached() {
    super.onAttached();
    setEntityProtocol(new CreatureProtocol(CreatureType.GHAST));
    DeathDrops dropComponent = getOwner().add(DeathDrops.class);
    Random random = getRandom();
    dropComponent.addDrop(new ItemStack(VanillaMaterials.GUNPOWDER, random.nextInt(2)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.GHAST_TEAR, random.nextInt(1)));
    dropComponent.addXpDrop((short) 5);
    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(10);
    }
View Full Code Here

  }

  private void fillDispenser(int xx, int yy, int zz) {
    final DispenserInventory inventory = getBlock(xx, yy, zz).get(Dispenser.class).getInventory();
    final Random random = getRandom();
    inventory.add(random.nextInt(inventory.size()), new ItemStack(VanillaMaterials.ARROW, random.nextInt(8) + 2));
  }
View Full Code Here

public class Wither extends Living implements Hostile {
  @Override
  public void onAttached() {
    super.onAttached();
    setEntityProtocol(new CreatureProtocol(CreatureType.WITHER));
    getOwner().add(DeathDrops.class).addDrop(new ItemStack(VanillaMaterials.NETHER_STAR, 1)).addXpDrop((short) 50);
    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(300);
    }

    Damage damage = getOwner().add(Damage.class);
View Full Code Here

public class Zombie extends Living implements Hostile {
  @Override
  public void onAttached() {
    super.onAttached();
    setEntityProtocol(new CreatureProtocol(CreatureType.ZOMBIE));
    getOwner().add(DeathDrops.class).addDrop(new ItemStack(VanillaMaterials.ROTTEN_FLESH, getRandom().nextInt(2))).addXpDrop((short) 5);
    getOwner().add(EntityInventory.class);
    getOwner().add(EntityItemCollector.class);

    PhysicsComponent physics = getOwner().getPhysics();
    physics.activate(2f, new BoxShape(1f, 2f, 1f), false, true);
View Full Code Here

  public void onAttached() {
    super.onAttached();
    setEntityProtocol(new CreatureProtocol(CreatureType.CAVE_SPIDER));
    DeathDrops dropComponent = getOwner().add(DeathDrops.class);
    Random random = getRandom();
    dropComponent.addDrop(new ItemStack(VanillaMaterials.STRING, random.nextInt(2)));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.SPIDER_EYE, random.nextInt(1)));
    dropComponent.addXpDrop((short) 3);
    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(12);
    }
    Damage damage = getOwner().add(Damage.class);
View Full Code Here

TOP

Related Classes of org.spout.api.inventory.ItemStack

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.