Package org.spout.api.material

Examples of org.spout.api.material.Material


public class EntityArmorInventory extends ArmorInventory {
  @Override
  public boolean canSet(int slot, ItemStack item) {
    if (item != null) {
      Material material = item.getMaterial();
      switch (slot) {
        case BOOT_SLOT:
          return material instanceof Boots;
        case LEGGINGS_SLOT:
          return material instanceof Leggings;
View Full Code Here


  public static final int ARMOR_SLOT = 1;

  @Override
  public boolean canSet(int slot, ItemStack item) {
    if (item != null) {
      Material material = item.getMaterial();
      switch (slot) {
        case SADDLE_SLOT:
          return material.isMaterial(VanillaMaterials.SADDLE);
        case ARMOR_SLOT:
          return material instanceof HorseArmor;
        default:
          return false;
      }
View Full Code Here

    }
    return true;
  }

  public int getArmorTypeId() {
    Material material = get(ARMOR_SLOT) != null ? get(ARMOR_SLOT).getMaterial() : null;
     if (material instanceof HorseArmor) {
      return ((HorseArmor) material).getTypeId();
    } else {
      return 0;
    }
View Full Code Here

  public abstract void updateSlot(int i, ItemStack item, Entity entity);

  @Override
  public boolean canSet(int slot, ItemStack item) {
    if (item != null) {
      Material material = item.getMaterial();
      switch (slot) {
        case BOOT_SLOT:
          return material instanceof Boots;
        case LEGGINGS_SLOT:
          return material instanceof Leggings;
View Full Code Here

public class PlayerArmorInventory extends EntityArmorInventory {
  @Override
  public boolean canSet(int slot, ItemStack item) {
    if (item != null) {
      Material material = item.getMaterial();
      switch (slot) {
        case BOOT_SLOT:
          return material instanceof Boots;
        case LEGGINGS_SLOT:
          return material instanceof Leggings;
View Full Code Here

    // NO INSTANCES FOR YOU, FOOL!
  }

  public static Material popMaterial(String argName, CommandArguments args) throws ArgumentParseException {
    String arg = args.currentArgument(argName);
    Material mat;
    try {
      mat = VanillaMaterials.getMaterial((short) Integer.parseInt(arg));
    } catch (NumberFormatException ex) {
      mat = MaterialRegistry.get(arg);
    }
View Full Code Here

   *
   * @return true if the action completed successfully.
   */
  public boolean onShiftClick(int slot, PlayerInventory toInventory) {
    ItemStack result = get(getOutputSlot());
    Material resultMat = (result != null ? result.getMaterial() : null);
    if (slot == getOutputSlot() + getOffset() && result != null) {
      while (result != null && !result.isEmpty()) {
        toInventory.add(result);
        set(getOutputSlot(), null);
        result = get(getOutputSlot());
View Full Code Here

    List<Material> shapeless = new ArrayList<Material>();
    int cntr = 0;
    while (iterator.hasNext()) {
      ItemStack item = get(iterator.next());
      cntr++;
      Material mat = null;
      if (item != null) {
        mat = item.getMaterial();
      }
      current.add(mat);
      if (mat != null) {
View Full Code Here

      }

      @Override
      public void setValue(Integer value) {
        int fullState = value.intValue();
        Material material = VanillaMaterials.getMaterial((short) (fullState & 0xFFFF), (short) (fullState >> 16));
        if (material instanceof BlockMaterial) {
          setDisplayedBlock((BlockMaterial) material);
        } else {
          setDisplayedBlock(VanillaMaterials.AIR);
        }
View Full Code Here

  public static ItemStack readItemStack(ByteBuf buffer) throws IOException {
    short id = buffer.readShort();
    if (id < 0) {
      return null;
    } else {
      Material material = VanillaMaterials.getMaterial(id);
      if (material == null) {
        throw new IOException("Unknown material with id of " + id);
      }
      int count = buffer.readUnsignedByte();
      int damage = buffer.readUnsignedShort();
View Full Code Here

TOP

Related Classes of org.spout.api.material.Material

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.