Ejemplo n.º 1
0
  public void a(IInventory iinventory) {
    if (this.bM != this.bL) {
      this.h();
    }
    // CanaryMod: InventoryHook
    Inventory inventory = null;

    if (iinventory instanceof TileEntityChest) {
      inventory = ((TileEntityChest) iinventory).getCanaryChest();
    } else if (iinventory instanceof InventoryLargeChest) {
      inventory = new CanaryDoubleChest((InventoryLargeChest) iinventory);
    } else if (iinventory instanceof InventoryEnderChest) {
      inventory = new CanaryEnderChestInventory((InventoryEnderChest) iinventory, getPlayer());
    } else if (iinventory instanceof EntityMinecartChest) {
      inventory = (CanaryChestMinecart) ((EntityMinecartChest) iinventory).getCanaryEntity();
    }

    if (inventory != null) {
      InventoryHook hook = new InventoryHook(getPlayer(), inventory, false);

      Canary.hooks().callHook(hook);
      if (hook.isCanceled()) {
        return;
      }
    }
    //

    this.ct();
    this.a.b(new Packet100OpenWindow(this.cu, 0, iinventory.b(), iinventory.j_(), iinventory.c()));
    this.bM = new ContainerChest(this.bK, iinventory);
    this.bM.d = this.cu;
    this.bM.a((ICrafting) this);
  }
Ejemplo n.º 2
0
  public void a(int i0, int i1, int i2, String s0) {
    // CanaryMod: InventoryHook
    ContainerEnchantment container = new ContainerEnchantment(this.bK, this.q, i0, i1, i2);
    CanaryEnchantmentTable table = new CanaryEnchantmentTable(container);
    InventoryHook hook = new InventoryHook(getPlayer(), table, false);

    Canary.hooks().callHook(hook);
    if (hook.isCanceled()) {
      return;
    }
    //

    this.ct();
    this.a.b(new Packet100OpenWindow(this.cu, 4, s0 == null ? "" : s0, 9, s0 != null));
    this.bM = container;
    this.bM.d = this.cu;
    this.bM.a((ICrafting) this);
  }
Ejemplo n.º 3
0
  public void b(int i0, int i1, int i2) {
    // CanaryMod: InventoryHook
    ContainerWorkbench container = new ContainerWorkbench(this.bK, this.q, i0, i1, i2);
    CanaryWorkbench bench = new CanaryWorkbench(container);
    InventoryHook hook = new InventoryHook(getPlayer(), bench, false);

    Canary.hooks().callHook(hook);
    if (hook.isCanceled()) {
      return;
    }
    //

    this.ct();
    this.a.b(new Packet100OpenWindow(this.cu, 1, bench.getInventoryName(), 9, true));
    this.bM = container;
    this.bM.d = this.cu;
    this.bM.a((ICrafting) this);
  }
Ejemplo n.º 4
0
  public void a(TileEntityFurnace tileentityfurnace) {
    // CanaryMod: InventoryHook
    InventoryHook hook =
        new InventoryHook(getPlayer(), tileentityfurnace.getCanaryFurnace(), false);

    Canary.hooks().callHook(hook);
    if (hook.isCanceled()) {
      return;
    }
    //

    this.ct();
    this.a.b(
        new Packet100OpenWindow(
            this.cu, 2, tileentityfurnace.b(), tileentityfurnace.j_(), tileentityfurnace.c()));
    this.bM = new ContainerFurnace(this.bK, tileentityfurnace);
    this.bM.d = this.cu;
    this.bM.a((ICrafting) this);
  }
Ejemplo n.º 5
0
  public void a(TileEntityBrewingStand tileentitybrewingstand) {
    // CanaryMod: InventoryHook
    InventoryHook hook =
        new InventoryHook(getPlayer(), tileentitybrewingstand.getCanaryBrewingStand(), false);

    Canary.hooks().callHook(hook);
    if (hook.isCanceled()) {
      return;
    }
    //

    this.ct();
    this.a.b(
        new Packet100OpenWindow(
            this.cu,
            5,
            tileentitybrewingstand.b(),
            tileentitybrewingstand.j_(),
            tileentitybrewingstand.c()));
    this.bM = new ContainerBrewingStand(this.bK, tileentitybrewingstand);
    this.bM.d = this.cu;
    this.bM.a((ICrafting) this);
  }
Ejemplo n.º 6
0
  public void a(TileEntityDispenser tileentitydispenser) {
    // CanaryMod: InventoryHook
    InventoryHook hook =
        new InventoryHook(getPlayer(), tileentitydispenser.getCanaryDispenser(), false);

    Canary.hooks().callHook(hook);
    if (hook.isCanceled()) {
      return;
    }
    //

    this.ct();
    this.a.b(
        new Packet100OpenWindow(
            this.cu,
            tileentitydispenser instanceof TileEntityDropper ? 10 : 3,
            tileentitydispenser.b(),
            tileentitydispenser.j_(),
            tileentitydispenser.c()));
    this.bM = new ContainerDispenser(this.bK, tileentitydispenser);
    this.bM.d = this.cu;
    this.bM.a((ICrafting) this);
  }