Examples of Chest


Examples of games.stendhal.client.entity.Chest

   */
  @Override
  protected void buildActions(final List<String> list) {
    super.buildActions(list);

    Chest chest = (Chest) entity;
    if (chest != null && chest.isOpen()) {
      list.add(ActionType.INSPECT.getRepresentation());
      list.add(ActionType.CLOSE.getRepresentation());
    } else {
      list.add(ActionType.OPEN.getRepresentation());
    }
View Full Code Here

Examples of games.stendhal.client.entity.Chest

  @Override
  protected void update() {
    super.update();

    if (openChanged) {
      Chest chest = (Chest) entity;
      if (chest.isOpen()) {
        // we're wanted to open this?
        if (requestOpen) {
          showWindow();
        }
      } else {
View Full Code Here

Examples of games.stendhal.server.entity.mapstuff.chest.Chest

  public void testOnActionIteminChest() {
    MockStendlRPWorld.get();
    ChestTestHelper.generateRPClasses();
    final UseAction ua = new UseAction();
    final Player player = PlayerTestHelper.createPlayer("bob");
    final Chest chest = new Chest();
    final Item cheese = SingletonRepository.getEntityManager().getItem("cheese");
    chest.add(cheese);
    final StendhalRPZone zone = new StendhalRPZone("zone");
    zone.collisionMap.clear();
    player.setPosition(1, 1);
    chest.setPosition(1, 2);
    zone.add(player);
    zone.add(chest);
    chest.open();
    final RPAction action = new RPAction();
    action.put(BASEITEM, cheese.getID().getObjectID());
    action.put(BASEOBJECT, chest.getID().getObjectID());
    action.put(BASESLOT, "content");
    assertFalse(player.has("eating"));
    ua.onAction(player, action);
    assertTrue(player.has("eating"));
  }
View Full Code Here

Examples of games.stendhal.server.entity.mapstuff.chest.Chest

    buildKalavanHouseAreaChest(zone);
  }

  private void buildKalavanHouseAreaChest(final StendhalRPZone zone) {
      // load the stuff in the house with presents
    final Chest chest = new Chest();
    chest.setPosition(22, 2);
    chest.add(SingletonRepository.getEntityManager().getItem("wine"));
    chest.add(SingletonRepository.getEntityManager().getItem("easter egg"));
    chest.add(SingletonRepository.getEntityManager().getItem("mega potion"));
    chest.add(SingletonRepository.getEntityManager().getItem("present"));
    chest.add(SingletonRepository.getEntityManager().getItem("pie"));
    zone.add(chest);
  }
View Full Code Here

Examples of org.bukkit.block.Chest

                      // Chests set
                      worldBlock.setType(Material.getMaterial(diskBlockType));
                      worldBlock.setData(diskBlockData);
                      BlockState state = worldBlock.getState();
                      if (state instanceof Chest) {
                        Chest chest = (Chest) state;
                        if (items != null) {
                          int ii = 0;
                          chest.getInventory().clear();
                          for (ItemStack item : items) {
                            if (item != null) {
                              chest.getInventory().setItem(ii, item);
                              ii++;
                            }
                          }
                          chest.update(true);
                        }
                      }
                    } else if (diskBlockType == Material.DISPENSER.getId()) {
                      // Dispensers read
                      List<ItemStack> items = VolumeMapper.readInventoryString(invsReader.readLine());
View Full Code Here

Examples of org.bukkit.block.Chest

                    signsWriter.write(extra);
                    signsWriter.newLine();
                  }
                } else if (state instanceof Chest) {
                  // Chests
                  Chest chest = (Chest) state;
                  Inventory inv = chest.getInventory();
                  List<ItemStack> items = VolumeMapper.getItemListFromInv(inv);
                  invsWriter.write(VolumeMapper.buildInventoryStringFromItemList(items));
                  invsWriter.newLine();
                } else if (state instanceof Dispenser) {
                  // Dispensers
View Full Code Here

Examples of org.bukkit.block.Chest

                          // Chests set
                          worldBlock.setType(Material.getMaterial(diskBlockType));
                          worldBlock.setData(diskBlockData);
                          BlockState state = worldBlock.getState();
                          if (state instanceof Chest) {
                            Chest chest = (Chest) state;
                            if (items != null) {
                              int ii = 0;
                              chest.getInventory().clear();
                              for (ItemStack item : items) {
                                if (item != null) {
                                  chest.getInventory().setItem(ii, item);
                                  ii++;
                                }
                              }
                              chest.update(true);
                            }
                          }
                        } else if (diskBlockType == Material.DISPENSER.getId()) {
                          // Dispensers read
                          List<ItemStack> items = null;
View Full Code Here

Examples of org.bukkit.block.Chest

   */
  public void fillChest(final Block block) {
    try {
      if (!(block.getState() instanceof Chest))
        return;
      Chest chestB = ((Chest) block.getState());
      Inventory chest = chestB.getBlockInventory();
      for (int i = 0; i < plugin.getSingleRandom().nextInt(
          chest.getSize()); i++) {
        ItemStack cis = getItem();
        while (cis == null) {
          cis = getItem();
View Full Code Here

Examples of org.bukkit.block.Chest

   */
  public void fillChest(final Block block, final int size) {
    try {
      if (!(block.getState() instanceof Chest))
        return;
      Chest chestB = ((Chest) block.getState());
      Inventory chest = chestB.getBlockInventory();
      for (int i = 0; i < size; i++) {
        ItemStack cis = getItem();
        while (cis == null) {
          cis = getItem();
        }
View Full Code Here

Examples of org.bukkit.block.Chest

     */
    public boolean scan() {

        Block pump = getBackBlock();
        if (!(pump.getRelative(0, 1, 0).getType() == Material.CHEST)) return false;
        Chest c = (Chest) pump.getRelative(0, 1, 0).getState();
        for (int y = -1; y > -11; y--) {
            Block liquid = pump.getRelative(0, y, 0);
            if (check(c, liquid, 0)) return true;
        }
        return false;
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.