예제 #1
0
 protected void drawGuiContainerForegroundLayer(int par1, int par2) {
   super.fontRendererObj.drawString(
       this.field_94082_v,
       super.xSize / 2 - super.fontRendererObj.getStringWidth(this.field_94082_v) / 2,
       6,
       CustomNpcResourceListener.DefaultTextColor);
   super.fontRendererObj.drawString(
       I18n.format("container.inventory", new Object[0]),
       8,
       super.ySize - 96 + 2,
       CustomNpcResourceListener.DefaultTextColor);
 }
예제 #2
0
 @Overrideprotected
 void func_146977_a(Slot slot) {
   if (slot instanceof SlotChiselInput) {
     GL11.glPushMatrix();
     GL11.glScalef(2, 2, 2);
     slot.xDisplayPosition -= 16;
     slot.yDisplayPosition -= 16;
     super.func_146977_a(slot);
     slot.xDisplayPosition += 16;
     slot.yDisplayPosition += 16;
     GL11.glPopMatrix();
   } else {
     super.func_146977_a(slot);
   }
 }
예제 #3
0
 public void initGui() {
   super.initGui();
   int i = (super.width - super.xSize) / 2;
   int j = (super.height - super.ySize) / 2;
   super.buttonList.add(
       this.nextRecipeButtonIndex =
           new GuiMerchantAdd.MerchantButton(1, i + 120 + 27, j + 24 - 1, true));
   super.buttonList.add(
       this.previousRecipeButtonIndex =
           new GuiMerchantAdd.MerchantButton(2, i + 36 - 19, j + 24 - 1, false));
   super.buttonList.add(new GuiNpcButton(4, i + super.xSize, j + 20, 60, 20, "gui.remove"));
   super.buttonList.add(new GuiNpcButton(5, i + super.xSize, j + 50, 60, 20, "gui.add"));
   this.nextRecipeButtonIndex.enabled = false;
   this.previousRecipeButtonIndex.enabled = false;
 }
  @Override
  public void initGui() {
    buttonList.add(new GraphicButton(0, (width / 2) + 65, (height / 2) - 100, Core, 0));
    buttonList.add(new GraphicButton(1, (width / 2) + 20, (height / 2) - 28, Core, 1));

    super.initGui();
  }
예제 #5
0
  @Override
  public void drawScreen(int mouseX, int mouseY, float par3) {
    boolean flag = Mouse.isButtonDown(0);

    if (flag) {
      if (!clicked) {
        int x = mouseX - guiLeft - 56;
        int y = mouseY - guiTop - 7;
        if (0 <= x && x < 130 && 0 <= y && y < 105) {
          System.out.println(String.format("%d %d", x, y));

          int value = scroller.getValue();
          int index = ((value + y) / 16) % 16;
          isMoveGui[index] = !isMoveGui[index];
        }
        clicked = true;
      }
    } else {
      clicked = false;
    }

    if (scroller.mouseOver(mouseX, mouseY)) {
      scroller.scrollTo(flag, mouseX, mouseY);
    }
    super.drawScreen(mouseX, mouseY, par3);
  }
예제 #6
0
 @Override
 public void handleMouseInput() {
   super.handleMouseInput();
   if (scroller.mouseOver()) {
     scroller.scrollTo();
   }
 }
예제 #7
0
  /** Handles mouse input. */
  public void handleMouseInput() {
    super.handleMouseInput();
    int i = Mouse.getEventDWheel();

    if (i != 0 && this.needsScrollBars()) {
      int j = ((CreativeInv.ContainerCreative) this.inventorySlots).itemList.size() / 9 - 5 + 1;

      if (i > 0) {
        i = 1;
      }

      if (i < 0) {
        i = -1;
      }

      this.currentScroll = (float) ((double) this.currentScroll - (double) i / (double) j);

      if (this.currentScroll < 0.0F) {
        this.currentScroll = 0.0F;
      }

      if (this.currentScroll > 1.0F) {
        this.currentScroll = 1.0F;
      }

      ((CreativeInv.ContainerCreative) this.inventorySlots).scrollTo(this.currentScroll);
    }
  }
예제 #8
0
  /** Adds the buttons (and other controls) to the screen in question. */
  public void initGui() {

    super.initGui();
    this.buttonList.clear();
    Keyboard.enableRepeatEvents(true);
    this.searchField =
        new GuiTextField(
            this.fontRendererObj,
            this.guiLeft + 82 + 100,
            this.guiTop + 6,
            89,
            this.fontRendererObj.FONT_HEIGHT);
    this.searchField.setMaxStringLength(15);
    this.searchField.setEnableBackgroundDrawing(false);
    this.searchField.setVisible(false);
    this.searchField.setTextColor(16777215);
    int i = selectedTabIndex;
    selectedTabIndex = -1;
    this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]);
    this.field_147059_E = new CreativeCrafting(this.mc);
    this.mc.thePlayer.inventoryContainer.addCraftingToCrafters(this.field_147059_E);
    int tabCount = CreativeTabs.creativeTabArray.length;
    if (tabCount > 12) {
      buttonList.add(new GuiButton(101, guiLeft, guiTop - 50, 20, 20, "<"));
      buttonList.add(new GuiButton(102, guiLeft + xSize - 20, guiTop - 50, 20, 20, ">"));
      maxPages = ((tabCount - 12) / 10) + 1;
    }
  }
예제 #9
0
 /**
  * Fired when a key is typed (except F11 who toggle full screen). This is the equivalent of
  * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl
  * Keyboard key code)
  */
 protected void keyTyped(char typedChar, int keyCode) throws IOException {
   if (this.nameField.textboxKeyTyped(typedChar, keyCode)) {
     this.renameItem();
   } else {
     super.keyTyped(typedChar, keyCode);
   }
 }
예제 #10
0
  @Override
  protected void drawGuiContainerForegroundLayer(int x, int y) {
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glPushMatrix();

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    // GL11.glBegin(GL11.GL_TRIANGLE_FAN);
    GL11.glBegin(GL11.GL_LINE_LOOP);
    for (int ii = 0; ii < 50; ii++) {
      float theta = 2.0f * 3.1415926f * ii / 50; // get the current angle

      float xLocation = 50 * (float) Math.cos(theta); // calculate the x component
      float yLocation = 50 * (float) Math.sin(theta); // calculate the y component

      GL11.glVertex2f(xLocation + 60f, yLocation + 60f); // output vertex
    }
    GL11.glEnd();

    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();

    super.drawGuiContainerForegroundLayer(x, y);
  }
  @Override
  public void drawScreen(int x, int y, float f) {
    super.drawScreen(x, y, f);

    String text1 =
        this.machine.storage.getEnergyStored()
            + "/"
            + this.machine.storage.getMaxEnergyStored()
            + " RF";
    if (x >= guiLeft + 16 && y >= guiTop + 5 && x <= guiLeft + 23 && y <= guiTop + 89) {
      this.func_146283_a(Collections.singletonList(text1), x, y);
    }
    String text3 =
        this.machine.tank.getFluidAmount()
            + "/"
            + this.machine.tank.getCapacity()
            + " mB "
            + FluidRegistry.WATER.getLocalizedName(this.machine.tank.getFluid());
    if (x >= guiLeft + 27 && y >= guiTop + 5 && x <= guiLeft + 33 && y <= guiTop + 70) {
      this.func_146283_a(Collections.singletonList(text3), x, y);
    }

    String text2 =
        this.machine.coffeeCacheAmount
            + "/"
            + this.machine.coffeeCacheMaxAmount
            + " "
            + StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.coffee");
    if (x >= guiLeft + 40 && y >= guiTop + 25 && x <= guiLeft + 49 && y <= guiTop + 56) {
      this.func_146283_a(Collections.singletonList(text2), x, y);
    }
  }
예제 #12
0
  /** Called when the mouse is clicked. */
  protected void mouseClicked(int var1, int var2, int var3) {
    int var4 = var1 - (this.width - this.xSize) / 2;
    int var5 = var2 - (this.height - this.ySize) / 2;

    if (var4 >= 117 && var5 >= 54 && var4 <= 131 && var5 <= 68) {
      if (var3 == 0) {
        ++this.tileDetect.mode;

        if (this.tileDetect.mode > 2) {
          this.tileDetect.mode = 0;
        }
      } else {
        --this.tileDetect.mode;

        if (this.tileDetect.mode < 0) {
          this.tileDetect.mode = 2;
        }
      }

      if (this.mc.theWorld.isRemote) {
        this.sendButton(this.tileDetect.mode);
      }
    }

    super.mouseClicked(var1, var2, var3);
  }
예제 #13
0
  @Override
  protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
    super.drawGuiContainerForegroundLayer(mouseX, mouseY);

    int xAxis = (mouseX - (width - xSize) / 2);
    int yAxis = (mouseY - (height - ySize) / 2);

    for (GuiElement element : guiElements) {
      element.renderForeground(xAxis, yAxis);
    }

    if (tileEntity != null) {
      Slot hovering = null;

      for (int i = 0; i < inventorySlots.inventorySlots.size(); i++) {
        Slot slot = (Slot) inventorySlots.inventorySlots.get(i);

        if (isMouseOverSlot(slot, mouseX, mouseY)) {
          hovering = slot;
          break;
        }
      }

      ItemStack stack = mc.thePlayer.inventory.getItemStack();

      if (stack != null && stack.getItem() instanceof ItemConfigurator && hovering != null) {
        SideData data = getFromSlot(hovering);

        if (data != null) {
          drawCreativeTabHoveringText(data.color.getName(), xAxis, yAxis);
        }
      }
    }
  }
예제 #14
0
  @Override
  public void drawScreen(int mouseX, int mouseY, float f1) {
    this.mouseX = mouseX - (width - xSize) / 2;
    this.mouseY = mouseY - (height - ySize) / 2;

    super.drawScreen(mouseX, mouseY, f1);
  }
예제 #15
0
  @Override
  public void drawScreen(int mouseX, int mouseY, float ticks) {
    super.drawScreen(mouseX, mouseY, ticks);

    int i = 0;

    if (prevHover.checkHover(mouseX, mouseY)) {
      i = -1;
    } else if (nextHover.checkHover(mouseX, mouseY)) {
      i = 1;
    }

    if (container.isRecipes() && i != 0) {
      ItemStack stack = container.getNextRecipe(i);

      drawCreativeTabHoveringText(stack.getDisplayName(), mouseX, mouseY);
    }

    if (container.isRecipes()
        && mouseX >= guiLeft + recipesX - 5
        && mouseX <= guiLeft + xSize - 5
        && mouseY >= guiTop + recipesY - 4
        && mouseY <= guiTop + recipesY + 10) {
      tooltips.clear();

      for (ItemStack stack : container.getRecipes()) {
        tooltips.add(stack.getDisplayName());
      }

      drawHoveringText(tooltips, mouseX, mouseY);
    }
  }
 public void initGui() {
   this.controlList.add(
       new GuiButton(0, this.width / 2 + 90, this.height / 2 + 80, 22, 16, "-->"));
   this.controlList.add(
       new GuiButton(1, this.width / 2 - 110, this.height / 2 + 80, 22, 16, "<--"));
   super.initGui();
 }
예제 #17
0
  @Override
  protected void mouseClicked(int mouseX, int mouseY, int code) throws IOException {
    super.mouseClicked(mouseX, mouseY, code);

    if (code == 0
        && mouseX >= guiLeft
        && mouseX <= guiLeft + 20
        && mouseY >= guiTop
        && mouseY <= guiTop + 20) {
      nextButton.playPressSound(mc.getSoundHandler());

      ItemStack[] items = new ItemStack[container.craftMatrix.getSizeInventory()];

      for (int i = 0; i < items.length; ++i) {
        items[i] = container.craftMatrix.removeStackFromSlot(i);
      }

      CraftingEX.NETWORK.sendToServer(new OpenCraftingMessage(pos, items));
    } else if (code == 0
        && mouseX <= guiLeft + xSize
        && mouseX >= guiLeft + xSize - 50
        && mouseY >= guiTop
        && mouseY <= guiTop + 20
        && container.isRecipes()) {
      mc.displayGuiScreen(new GuiCraftingResult(this, container.getRecipes()));
    }
  }
예제 #18
0
  @Override
  public void initGui() {
    Keyboard.enableRepeatEvents(true);

    super.initGui();

    if (prevButton == null) {
      prevButton = new GuiButton(0, 0, 0, 20, 20, "<");
      prevButton.visible = false;
    }

    prevButton.xPosition = guiLeft + 107;
    prevButton.yPosition = guiTop + 60;

    if (nextButton == null) {
      nextButton = new GuiButton(1, 0, 0, prevButton.width, prevButton.height, ">");
      nextButton.visible = false;
    }

    nextButton.xPosition = prevButton.xPosition + prevButton.width + 10;
    nextButton.yPosition = prevButton.yPosition;

    buttonList.add(prevButton);
    buttonList.add(nextButton);

    if (prevHover == null) {
      prevHover = new HoverChecker(prevButton, 0);
    }

    if (nextHover == null) {
      nextHover = new HoverChecker(nextButton, 0);
    }
  }
 public void drawScreen(int par1, int par2, float par3) {
   super.drawScreen(par1, par2, par3);
   boolean op = false; // TODO: Check if player is OP
   if (Keyboard.isKeyDown(Keyboard.KEY_O) && op) {
     player.openGui(ModUncrafting.instance, 1, worldObj, x, y, z);
   }
 }
예제 #20
0
  /** Handles mouse input. */
  @Override
  public void handleMouseInput() {
    super.handleMouseInput();
    int var1 = Mouse.getEventDWheel();

    if (var1 != 0 && needsScrollBars()) {
      final int invHeight = ((ContainerStorage) inventorySlots).inventory.getSizeInventory() / 9;

      if (var1 > 0) {
        var1 = 1;
      }

      if (var1 < 0) {
        var1 = -1;
      }

      currentScroll = currentScroll - var1;

      if (currentScroll < 0) {
        currentScroll = 0;
      }

      if (currentScroll > invHeight - 5) {
        currentScroll = invHeight - 5;
      }

      // ((ContainerStorage)this.inventorySlots).inventory.scroll =
      // currentScroll;
      PacketDispatcher.sendPacketToServer(
          PacketHandler.getScrollPacket(
              tabList.get(selectedTabIndex).icon.itemID, (int) currentScroll, x, y, z));
      // ((ContainerCreative)this.inventorySlots).scrollTo(this.currentScroll);
    }
  }
예제 #21
0
 @Overridepublic
 void updateScreen() {
   super.updateScreen();
   ItemStack held = player.getCurrentEquippedItem();
   if (held == null || !(held.getItem() instanceof IChiselItem)) {
     player.closeScreen();
   }
   boolean flag = false;
   /**
    * for(int c = 0; c < container.inventory.activeVariations; c++) {ItemStack stack =
    * container.inventory.getStackInSlot(c);if(stack.getItem() != null) {if (stack.getItem()
    * instanceof ItemCarvable) {BlockCarvable block = (BlockCarvable)
    * Block.getBlockFromItem(stack.getItem());if
    * (block.carverHelper.getVariation(stack.getItemDamage()).getType().equals(TextureType.CTMH)||
    * block.carverHelper.getVariation(stack.getItemDamage()).getType().equals(TextureType.CTMX)||
    * block.carverHelper.getVariation(stack.getItemDamage()).getType().equals(TextureType.CTMV))
    * {flag = true;}} else if(stack.getItem() instanceof ICarvable) {ICarvable block = (ICarvable)
    * Block.getBlockFromItem(stack.getItem());if
    * (block.getManager(stack.getItemDamage()).getType().equals(TextureType.CTMH)||
    * block.getManager(stack.getItemDamage()).getType().equals(TextureType.CTMX)||
    * block.getManager(stack.getItemDamage()).getType().equals(TextureType.CTMV)) {flag = true;}}if
    * (flag) {GuiDraw.drawTexturedModalRect(container.getSlot(c).xDisplayPosition,
    * container.getSlot(c).yDisplayPosition, 48, 202, 18, 18);}}}
    */
 }
예제 #22
0
 @Override
 protected void mouseClicked(int x, int y, int rightClick) throws IOException {
   // set active seed button clicked
   if (this.setActiveSeedButtons != null) {
     for (Component<ItemStack> component : setActiveSeedButtons) {
       if (component.isOverComponent(guiLeft + x, guiTop + y)) {
         this.setActiveSeed(component.getComponent());
         return;
       }
     }
   }
   // click to get seed out of the storage
   if (this.hasActiveSeed()) {
     for (Component<PlantStatsStorage> component : activeSeeds) {
       if (component.isOverComponent(x, y)) {
         PlantStatsStorage stats = component.getComponent();
         int stackSize = isShiftKeyDown() ? 64 : 1;
         this.container.moveStackFromTileEntityToPlayer(
             stats.id, new ItemStack(activeSeed, stackSize, activeMeta));
         this.updateScreen();
         return;
       }
     }
   }
   super.mouseClicked(x, y, rightClick);
 }
예제 #23
0
 @Override
 public void drawScreen(int x, int y, float f) {
   super.drawScreen(x, y, f);
   this.drawToolTips(x, y, FluidRegistry.WATER, 29, 26);
   this.drawToolTips(x, y, FluidRegistry.LAVA, 49, 26);
   this.drawToolTips(x, y, AMBlocks.pymParticles, 185, 26);
 }
  @Override
  protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
    this.drag_click.clear();

    if (btn == 1) {
      for (final Object o : this.buttonList) {
        final GuiButton guibutton = (GuiButton) o;
        if (guibutton.mousePressed(this.mc, xCoord, yCoord)) {
          super.mouseClicked(xCoord, yCoord, 0);
          return;
        }
      }
    }

    super.mouseClicked(xCoord, yCoord, btn);
  }
  @Override
  public void drawScreen(final int mouseX, final int mouseY, final float btn) {
    super.drawScreen(mouseX, mouseY, btn);

    final boolean hasClicked = Mouse.isButtonDown(0);
    if (hasClicked && this.scrollBar != null) {
      this.scrollBar.click(this, mouseX - this.guiLeft, mouseY - this.guiTop);
    }

    for (final Object c : this.buttonList) {
      if (c instanceof ITooltip) {
        final ITooltip tooltip = (ITooltip) c;
        final int x = tooltip.xPos(); // ((GuiImgButton) c).xPosition;
        int y = tooltip.yPos(); // ((GuiImgButton) c).yPosition;

        if (x < mouseX && x + tooltip.getWidth() > mouseX && tooltip.isVisible()) {
          if (y < mouseY && y + tooltip.getHeight() > mouseY) {
            if (y < 15) {
              y = 15;
            }

            final String msg = tooltip.getMessage();
            if (msg != null) {
              this.drawTooltip(x + 11, y + 4, 0, msg);
            }
          }
        }
      }
    }
  }
  @Override
  public void drawScreen(int x, int y, float par3) {
    super.drawScreen(x, y, par3);

    MerchantRecipeList recipes = this.villager.getRecipes(this.mc.thePlayer);
    if ((recipes != null) && !(recipes.isEmpty())) {
      int xCenter = (this.width - this.xSize) / 2;
      int yCenter = (this.height - this.ySize) / 2;

      MerchantRecipe recipe = (MerchantRecipe) recipes.get(this.currentRecipeIndex);

      ItemStack[] slot = new ItemStack[3];
      slot[0] = recipe.getItemToBuy();
      slot[1] = recipe.getSecondItemToBuy();
      slot[2] = recipe.getItemToSell();

      GL11.glPushMatrix();
      GL11.glPushAttrib(GL11.GL_ENABLE_BIT);

      RenderHelper.enableGUIStandardItemLighting();

      GL11.glEnable(GL12.GL_RESCALE_NORMAL);

      itemRender.zLevel = 100;
      itemRender.renderItemAndEffectIntoGUI(
          this.fontRendererObj, this.mc.renderEngine, slot[0], xCenter + 36, yCenter + 24);
      itemRender.renderItemOverlayIntoGUI(
          this.fontRendererObj, this.mc.renderEngine, slot[0], xCenter + 36, yCenter + 24);

      if (slot[1] != null) {
        itemRender.renderItemAndEffectIntoGUI(
            this.fontRendererObj, this.mc.renderEngine, slot[1], xCenter + 62, yCenter + 24);
        itemRender.renderItemOverlayIntoGUI(
            this.fontRendererObj, this.mc.renderEngine, slot[1], xCenter + 62, yCenter + 24);
      }

      itemRender.renderItemAndEffectIntoGUI(
          this.fontRendererObj, this.mc.renderEngine, slot[2], xCenter + 120, yCenter + 24);
      itemRender.renderItemOverlayIntoGUI(
          this.fontRendererObj, this.mc.renderEngine, slot[2], xCenter + 120, yCenter + 24);

      itemRender.zLevel = 0;

      GL11.glDisable(GL11.GL_LIGHTING);

      if (this.func_146978_c(36, 24, 16, 16, x, y)) {
        this.renderToolTip(slot[0], x, y);
      } else if ((slot[1] != null) && this.func_146978_c(62, 24, 16, 16, x, y)) {
        this.renderToolTip(slot[1], x, y);
      } else if (this.func_146978_c(120, 24, 16, 16, x, y)) {
        this.renderToolTip(slot[2], x, y);
      }

      RenderHelper.enableStandardItemLighting();

      GL11.glPopAttrib();
      GL11.glPopMatrix();
    }
  }
예제 #27
0
  @Override
  public void onGuiClosed() {
    super.onGuiClosed();

    for (GuiComponent guiComponent : getGuiComponents()) {
      guiComponent.onClose();
    }
  }
예제 #28
0
 @Override
 protected void keyTyped(char par1, int par2) {
   if (!textFieldAddTrustedPlayer.isFocused()) {
     super.keyTyped(par1, par2);
   } else {
     textFieldAddTrustedPlayer.textboxKeyTyped(par1, par2);
   }
 }
  protected void mouseClicked(int x, int y, int par3) {
    super.mouseClicked(x, y, par3);

    if (this.buttonGrounded.mousePressed(Minecraft.getMinecraft(), x, y)) {
      System.out.println("miaou");
      //	render.clientSetGrounded(!render.getGrounded());
    }
  }
예제 #30
0
 public void updateScreen() {
   super.updateScreen();
   Minecraft mc = Minecraft.getMinecraft();
   MerchantRecipeList merchantrecipelist = this.theIMerchant.getRecipes(mc.thePlayer);
   if (merchantrecipelist != null) {
     this.nextRecipeButtonIndex.enabled = this.currentRecipeIndex < merchantrecipelist.size() - 1;
     this.previousRecipeButtonIndex.enabled = this.currentRecipeIndex > 0;
   }
 }