Package org.spout.vanilla.inventory.block

Examples of org.spout.vanilla.inventory.block.ChestInventory


  }

  public ChestInventory getLargestInventory() {
    final Block block = getBlock();
    final Block otherHalf = VanillaMaterials.CHEST.getOtherHalf(block);
    ChestInventory inventory = getInventory();
    if (otherHalf != null) {
      if (block.translate(BlockFace.EAST).equals(otherHalf) || block.translate(BlockFace.NORTH).equals(otherHalf)) {
        inventory = new ChestInventory(otherHalf.get(Chest.class).getInventory(), inventory);
      } else {
        inventory = new ChestInventory(inventory, otherHalf.get(Chest.class).getInventory());
      }
    }
    return inventory;
  }
View Full Code Here


  @Override
  public void placeObject(World w, int x, int y, int z) {
    final Block block = w.getBlock(x, y, z);
    VanillaMaterials.CHEST.onPlacement(block, (short) 0, null, null, false, null);
    final ChestInventory inventory = block.get(Chest.class).getInventory();
    final int numberOfStack = random.nextInt(maxNumberOfStacks - minNumberOfStacks + 1) + minNumberOfStacks;
    final int size = inventory.size();
    for (int i = 0; i < numberOfStack; i++) {
      inventory.set(random.nextInt(size), MathHelper.chooseWeightedRandom(random, loot).getRandomStack(random));
    }
  }
View Full Code Here

    String title = message.getTitle();
    switch (message.getType()) {
      case DEFAULT:
        break;
      case CHEST:
        ChestInventory inventory = new ChestInventory(message.getSlots());
        player.get(WindowHolder.class).openWindow(new ChestWindow(player, inventory, title));
        break;
      case CRAFTING_TABLE:
        player.get(WindowHolder.class).openWindow(new CraftingTableWindow(player, title));
        break;
View Full Code Here

TOP

Related Classes of org.spout.vanilla.inventory.block.ChestInventory

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.