Package org.spout.api.inventory

Examples of org.spout.api.inventory.ItemStack


  public void onAttached() {
    super.onAttached();
    setEntityProtocol(new CreatureProtocol(CreatureType.IRON_GOLEM)); //Index 16 (byte): Unknown, example: 1
    DeathDrops dropComponent = getOwner().add(DeathDrops.class);
    Random random = getRandom();
    dropComponent.addDrop(new ItemStack(VanillaMaterials.IRON_INGOT, random.nextInt(2) + 3));
    dropComponent.addDrop(new ItemStack(VanillaMaterials.ROSE, random.nextInt(2)));
    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(100);
    }

    // Add metadata for whether the Entity was created by a player (opposite of naturally spawned)
View Full Code Here


  @Override
  public void onAttached() {
    super.onAttached();
    if (getAttachedCount() == 1) {
      getOwner().add(DeathDrops.class).addDrop(new ItemStack(VanillaMaterials.TNT, 1));
    }
  }
View Full Code Here

public class SnowGolem extends Living implements Utility {
  @Override
  public void onAttached() {
    super.onAttached();
    setEntityProtocol(new CreatureProtocol(CreatureType.SNOW_GOLEM));
    getOwner().add(DeathDrops.class).addDrop(new ItemStack(VanillaMaterials.SNOWBALL, getRandom().nextInt(15)));
    if (getAttachedCount() == 1) {
      getOwner().add(Health.class).setSpawnHealth(100);
    }
  }
View Full Code Here

    super(name, id, null);
  }

  @Override
  public ItemStack getResult() {
    return new ItemStack(VanillaMaterials.CLAY_BRICK, 1);
  }
View Full Code Here

      }

      // Change item if applicable
      Slot selected = PlayerUtil.getHeldSlot(entity);
      if (selected != null && !PlayerUtil.isCostSuppressed(entity)) {
        selected.set(new ItemStack(filled, 1));
      }

      // Change the clicked block to air
      final Cause<?> cause;
      if (entity instanceof Player) {
View Full Code Here

  public void onInteract(Entity entity, Block block, Action type, BlockFace face) {
    super.onInteract(entity, block, type, face);
    if (type == Action.RIGHT_CLICK) {
      Slot inv = PlayerUtil.getHeldSlot(entity);
      if (inv != null && !PlayerUtil.isCostSuppressed(entity)) {
        inv.set(new ItemStack(VanillaMaterials.BUCKET, 1));
      }
    }
  }
View Full Code Here

    }
  }

  @Override
  public ItemStack getResult() {
    return new ItemStack(Dye.CACTUS_GREEN, 1);
  }
View Full Code Here

  @Override
  public void onAttached() {
    super.onAttached();
    setEntityProtocol(new CreatureProtocol(CreatureType.SHEEP));
    DeathDrops dropComponent = getOwner().add(DeathDrops.class);
    dropComponent.addDrop(new ItemStack(VanillaMaterials.WOOL, 1));
    dropComponent.addXpDrop((short) (getRandom().nextInt(3) + 1));

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

  @Permissible ("vanilla.command.debug")
  @Filter (PlayerFilter.class)
  public void map(Player player, CommandArguments args) throws CommandException {
    args.assertCompletelyParsed();

    ItemStack i = new ItemStack(VanillaMaterials.MAP, ++mapId, 1);
    player.get(PlayerInventory.class).add(i);
  }
View Full Code Here

    args.assertCompletelyParsed();
    PlayerInventory inventory = player.get(PlayerInventory.class);
    if (inventory == null) {
      throw new CommandException("Player has no inventory.");
    }
    ItemStack i = inventory.getQuickbar().getSelectedSlot().get();
    if (i == null || !(i.getMaterial() instanceof Map)) {
      throw new CommandException("Held item is not a map");
    }
    Map m = (Map) i.getMaterial();
    int bx = args.popInteger("bx");
    int by = args.popInteger("by");
    int tx = args.popInteger("tx");
    int ty = args.popInteger("ty");
    int col = args.popInteger("col");
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.