コード例 #1
0
  public void initGui() {
    super.initGui();

    for (int i = 0; i < tileEntity.getNumberOfCustomizableOptions(); i++) {
      GuiPictureButton button =
          new GuiPictureButton(
              i,
              guiLeft + 130,
              (guiTop + 10) + (i * 25),
              20,
              20,
              "",
              itemRender,
              new ItemStack(ModuleUtils.getItemFromModule(tileEntity.getCustomizableOptions()[i])),
              "");
      this.buttonList.add(button);
      this.hoverCheckers[i] = new HoverChecker(button, 20);
    }
  }
コード例 #2
0
 protected void drawGuiContainerBackgroundLayer(
     float p_146976_1_, int p_146976_2_, int p_146976_3_) {
   GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
   this.mc
       .getTextureManager()
       .bindTexture(
           new ResourceLocation(
               "securitycraft:textures/gui/container/customize"
                   + tileEntity.getNumberOfCustomizableOptions()
                   + ".png"));
   int k = (this.width - this.xSize) / 2;
   int l = (this.height - this.ySize) / 2;
   this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
 }
コード例 #3
0
  public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    super.drawScreen(mouseX, mouseY, partialTicks);

    for (int i = 0; i < hoverCheckers.length; i++) {
      if (hoverCheckers[i] != null && hoverCheckers[i].checkHover(mouseX, mouseY)) {
        this.drawHoveringText(
            this.mc.fontRendererObj.listFormattedStringToWidth(
                tileEntity.getOptionDescriptions()[i], 150),
            mouseX,
            mouseY,
            this.mc.fontRendererObj);
      }
    }
  }
コード例 #4
0
  public void writeToNBT(NBTTagCompound par1NBTTagCompound) {
    super.writeToNBT(par1NBTTagCompound);

    NBTTagList nbttaglist = new NBTTagList();

    for (int i = 0; i < this.inventoryContents.length; ++i) {
      if (this.inventoryContents[i] != null) {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.setByte("Slot", (byte) i);
        this.inventoryContents[i].writeToNBT(nbttagcompound1);
        nbttaglist.appendTag(nbttagcompound1);
      }
    }

    par1NBTTagCompound.setTag("Items", nbttaglist);

    par1NBTTagCompound.setInteger("cooldown", cooldown);

    par1NBTTagCompound.setString("type", type);
  }
コード例 #5
0
  public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
    super.readFromNBT(par1NBTTagCompound);

    NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items", 10);
    this.inventoryContents = new ItemStack[this.getSizeInventory()];

    for (int i = 0; i < nbttaglist.tagCount(); ++i) {
      NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
      int j = nbttagcompound1.getByte("Slot") & 255;

      if (j >= 0 && j < this.inventoryContents.length) {
        this.inventoryContents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
      }
    }

    if (par1NBTTagCompound.hasKey("cooldown")) {
      this.cooldown = par1NBTTagCompound.getInteger("cooldown");
    }

    if (par1NBTTagCompound.hasKey("type")) {
      this.type = par1NBTTagCompound.getString("type");
    }
  }