Package org.spout.vanilla.inventory.util

Examples of org.spout.vanilla.inventory.util.InventoryConverter


  public DefaultWindow(Player owner) {
    super(owner, WindowType.DEFAULT, "Inventory", 9);
    PlayerInventory inventory = getPlayerInventory();

    addInventoryConverter(new InventoryConverter(inventory.getArmor(), "8, 7, 6, 5", new Vector2f[] {
        Vector2f.ZERO, Vector2f.ZERO, Vector2f.ZERO, Vector2f.ZERO
    }));

    addInventoryConverter(new InventoryConverter(inventory.getCraftingGrid(), "3-4, 1-2, 0", new Vector2f[] {
        Vector2f.ZERO, Vector2f.ZERO, Vector2f.ZERO, Vector2f.ZERO, Vector2f.ZERO
    }));
  }
View Full Code Here


import org.spout.vanilla.inventory.window.WindowType;

public class VillagerWindow extends Window {
  public VillagerWindow(Player owner, VillagerInventory inventory, String title) {
    super(owner, WindowType.VILLAGER, title, 3);
    addInventoryConverter(new InventoryConverter(inventory, "0-2", new Vector2f[0]));
  }
View Full Code Here

   * Clears all inventory converters
   */
  public void removeAllInventoryConverters() {
    Iterator<InventoryConverter> i = converters.iterator();
    while (i.hasNext()) {
      InventoryConverter converter = i.next();
      converter.getInventory().removeViewer(this);
      i.remove();
    }
  }
View Full Code Here

    }
  }

  @Override
  public void onSlotSet(Inventory inventory, int slot, ItemStack item, ItemStack previous) {
    InventoryConverter slots = getInventoryConverter(inventory);
    if (slots == null) {
      return;
    }
    switch (VanillaPlugin.getInstance().getEngine().getPlatform()) {
      case PROXY:
      case SERVER:
        QuickbarInventory quickbar = getPlayerInventory().getQuickbar();
        //debug("[Window - " + title + "] Slot changed: " + slot + " = " + item);
        //callProtocolEvent(new WindowSlotEvent(this, inventory, slots.revert(slot), item));
        reload();
        // Update the held item
        if (inventory instanceof QuickbarInventory && slot == quickbar.getSelectedSlot().getIndex()) {
          ((QuickbarInventory) inventory).updateHeldItem(getPlayer());
        }
        break;
      case CLIENT:
        slots.getWidgets()[slot].update();
        break;
      default:
        throw new IllegalStateException("Unknown platform: " + VanillaPlugin.getInstance().getEngine().getPlatform());
    }
  }
View Full Code Here

public class BrewingStandWindow extends Window {
  private BrewingStand brewingStand;

  public BrewingStandWindow(Player owner, BrewingStandInventory inventory, String title) {
    super(owner, WindowType.BREWING_STAND, title, 4);
    addInventoryConverter(new InventoryConverter(inventory, new int[] {0, 1, 2, 3}, new Vector2f[0]));
  }
View Full Code Here

  private Beacon beacon;
  private BeaconInventory inventory;

  public BeaconWindow(Player owner, BeaconInventory inventory) {
    super(owner, WindowType.BEACON, "Beacon", 1);
    addInventoryConverter(new InventoryConverter(inventory, "0", new Vector2f[0]));
    this.inventory = inventory;
  }
View Full Code Here

    this(owner, "Crafting");
  }

  public CraftingTableWindow(Player owner, String title) {
    super(owner, WindowType.CRAFTING_TABLE, title, 10);
    addInventoryConverter(new InventoryConverter(inventory, "7-9, 4-6, 1-3, 0", new Vector2f[0]));
  }
View Full Code Here

    this.furnace = furnace;
  }

  public FurnaceWindow(Player owner, FurnaceInventory inventory, String title) {
    super(owner, WindowType.FURNACE, title, 3);
    addInventoryConverter(new InventoryConverter(inventory, "1, 0, 2", new Vector2f[0]));
  }
View Full Code Here

  public AnvilWindow(Player owner, AnvilInventory inventory, Block block) {
    super(owner, WindowType.ANVIL, "Anvil", 3);
    this.inventory = inventory;
    this.block = block;
    addInventoryConverter(new InventoryConverter(inventory, "0-3", new Vector2f[0]));
  }
View Full Code Here

  private final int[] levels = new int[3];

  public EnchantmentTableWindow(Player owner, EnchantmentTable enchantmentTable, EnchantmentTableInventory inventory, String title) {
    super(owner, WindowType.ENCHANTMENT_TABLE, title, 1);
    this.inventory = inventory;
    addInventoryConverter(new InventoryConverter(inventory, "0", new Vector2f[0]));
    this.enchantmentTable = enchantmentTable;
  }
View Full Code Here

TOP

Related Classes of org.spout.vanilla.inventory.util.InventoryConverter

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.