Пример #1
0
  public void openFurnace(TileEntityFurnace tileentityfurnace) {
    // CraftBukkit start - inventory open hook
    Container container =
        CraftEventFactory.callInventoryOpenEvent(
            this, new ContainerFurnace(this.inventory, tileentityfurnace));
    if (container == null) return;
    // CraftBukkit end

    this.nextContainerCounter();
    this.playerConnection.sendPacket(
        new Packet100OpenWindow(
            this.containerCounter, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
    this.activeContainer = container; // CraftBukkit - Use container passed to event
    this.activeContainer.windowId = this.containerCounter;
    this.activeContainer.addSlotListener(this);
  }
Пример #2
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);
  }
Пример #3
0
  public ItemStack b(int i) {
    ItemStack itemstack = null;
    Slot slot = (Slot) this.b.get(i);

    if (slot != null && slot.d()) {
      ItemStack itemstack1 = slot.getItem();

      itemstack = itemstack1.cloneItemStack();
      if (i == 2) {
        if (!this.a(itemstack1, 3, 39, true)) {
          return null;
        }

        slot.a(itemstack1, itemstack);
      } else if (i != 1 && i != 0) {
        if (RecipesFurnace.getInstance().getResult(itemstack1.getItem().id) != null) {
          if (!this.a(itemstack1, 0, 1, false)) {
            return null;
          }
        } else if (TileEntityFurnace.isFuel(itemstack1)) {
          if (!this.a(itemstack1, 1, 2, false)) {
            return null;
          }
        } else if (i >= 3 && i < 30) {
          if (!this.a(itemstack1, 30, 39, false)) {
            return null;
          }
        } else if (i >= 30 && i < 39 && !this.a(itemstack1, 3, 30, false)) {
          return null;
        }
      } else if (!this.a(itemstack1, 3, 39, false)) {
        return null;
      }

      if (itemstack1.count == 0) {
        slot.set((ItemStack) null);
      } else {
        slot.e();
      }

      if (itemstack1.count == itemstack.count) {
        return null;
      }

      slot.b(itemstack1);
    }

    return itemstack;
  }