コード例 #1
0
  public ContainerSaltFridge(IInventory par1IInventory, IInventory par2IInventory) {
    this.fridgeInventory = par2IInventory;
    this.numRows = par2IInventory.getSizeInventory() / 9;
    par2IInventory.openChest();
    int i = (this.numRows - 4) * 18;
    int j;
    int k;

    for (j = 0; j < this.numRows; ++j) {
      for (k = 0; k < 9; ++k) {
        this.addSlotToContainer(new Slot(par2IInventory, k + j * 9, 8 + k * 18, 18 + j * 18));
      }
    }

    for (j = 0; j < 3; ++j) {
      for (k = 0; k < 9; ++k) {
        this.addSlotToContainer(
            new Slot(par1IInventory, k + j * 9 + 9, 8 + k * 18, 103 + j * 18 + i));
      }
    }

    for (j = 0; j < 9; ++j) {
      this.addSlotToContainer(new Slot(par1IInventory, j, 8 + j * 18, 161 + i));
    }
  }
コード例 #2
0
  public ContainerElectricChest(
      InventoryPlayer inventory, TileEntityElectricChest tentity, IInventory inv, boolean b) {
    tileEntity = tentity;
    itemInventory = inv;
    isBlock = b;

    if (isBlock) {
      tileEntity.openChest();
      tileEntity.playersUsing.add(inventory.player);
    } else {
      itemInventory.openChest();
    }

    for (int slotY = 0; slotY < 6; slotY++) {
      for (int slotX = 0; slotX < 9; slotX++) {
        addSlotToContainer(
            new SlotElectricChest(getInv(), slotX + slotY * 9, 8 + slotX * 18, 26 + slotY * 18));
      }
    }

    addSlotToContainer(new SlotDischarge(getInv(), 54, 180, 11));

    int slotX;

    for (slotX = 0; slotX < 3; ++slotX) {
      for (int slotY = 0; slotY < 9; ++slotY) {
        addSlotToContainer(
            new SlotElectricChest(
                inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 148 + slotX * 18));
      }
    }

    for (slotX = 0; slotX < 9; ++slotX) {
      addSlotToContainer(new SlotElectricChest(inventory, slotX, 8 + slotX * 18, 206));
    }
  }