Package org.spout.api.inventory

Examples of org.spout.api.inventory.Slot.addAmount()


  public void onInteractBy(Entity entity, Block block, Action type, BlockFace clickedFace) {
    super.onInteractBy(entity, block, type, clickedFace);
    Slot inv = PlayerUtil.getHeldSlot(entity);
    if (inv != null && inv.get() != null && type.equals(Action.RIGHT_CLICK)) {
      if (grow(block, inv.get().getMaterial()) && !PlayerUtil.isCostSuppressed(entity)) {
        inv.addAmount(-1);
      }
    }
  }

  @Override
View Full Code Here


    if (material == null) {
      return;
    }
    block.setMaterial(material);
    if (!PlayerUtil.isCostSuppressed(entity)) {
      selected.addAmount(-1);
    }
  }

  @Override
  public void initialize() {
View Full Code Here

  @Override
  public void onInteractBy(Entity entity, Block block, Action type, BlockFace clickedFace) {
    Slot inv = PlayerUtil.getHeldSlot(entity);
    if (inv != null && inv.get() != null && type.equals(Action.RIGHT_CLICK)) {
      if (grow(block, inv.get().getMaterial()) && !PlayerUtil.isCostSuppressed(entity)) {
        inv.addAmount(-1);
      }
    }
  }
}
View Full Code Here

      Slot inv = PlayerUtil.getHeldSlot(entity);
      if (inv != null && inv.get() != null) {
        // get color from holding item
        sheep.setColor(Wool.WoolColor.getById((short) (0xF - inv.get().getData())));
        if (!PlayerUtil.isCostSuppressed(entity)) {
          inv.addAmount(-1);
        }
      }
    }
  }
View Full Code Here

          //TODO Subtract from inventory component
          // Subtract item
          Slot inv = PlayerUtil.getHeldSlot(entity);
          if (inv != null && !PlayerUtil.isCostSuppressed(entity)) {
            inv.addAmount(-1);
          }
        }
        break;
      }
    }
View Full Code Here

        }
        sound.playGlobal(placedBlock.getPosition(), 0.8f, 0.8f);

        // Remove block from inventory
        if (!PlayerUtil.isCostSuppressed(player) && holdingMat == (currentSlot.get() != null ? currentSlot.get().getMaterial() : null)) {
          currentSlot.addAmount(-1);
        }
      }

      refreshClient(player, clickedBlock, clickedFace, rm);
    }
View Full Code Here

        entity.get(PlayerInventory.class).getQuickbar().add(fullbottle);
        if (!fullbottle.isEmpty()) {
          entity.get(PlayerInventory.class).getMain().add(fullbottle);
        }
        if (fullbottle.isEmpty() && !PlayerUtil.isCostSuppressed(entity)) {
          slot.addAmount(-1);
        }
      }
    }
  }
}
View Full Code Here

    }
    Slot slot = PlayerUtil.getHeldSlot(entity);
    if (slot == null || slot.get() == null || !slot.get().isMaterial(this)) {
      return;
    }
    slot.addAmount(-1);
  }
}
View Full Code Here

        // Default ender eye placement
        if (!VanillaMaterials.END_PORTAL_FRAME.hasEyeOfTheEnder(block)) {
          VanillaMaterials.END_PORTAL_FRAME.setEyeOfTheEnder(block, true);
          Slot held = PlayerUtil.getHeldSlot(entity);
          if (held != null && !PlayerUtil.isCostSuppressed(entity)) {
            held.addAmount(-1);
          }
        }
      }
    }
  }
View Full Code Here

    if (inv != null && inv.get() != null && type.equals(Action.RIGHT_CLICK) && clickedFace.equals(BlockFace.TOP) && block.translate(BlockFace.TOP).isMaterial(VanillaMaterials.AIR)) {
      if (inv.get().isMaterial(VanillaMaterials.CARROT)) {
        block.translate(clickedFace).setMaterial(VanillaMaterials.CARROT_CROP);
        if (!(PlayerUtil.isCostSuppressed(entity))) {
          inv.addAmount(-1);
        }
      }

      if (inv.get().isMaterial(VanillaMaterials.POTATO)) {
        block.translate(clickedFace).setMaterial(VanillaMaterials.POTATO_CROP);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.