net.minecraft.client.Minecraft.displayGuiScreen()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(10.2k)|赞(0)|评价(0)|浏览(211)

本文整理了Java中net.minecraft.client.Minecraft.displayGuiScreen()方法的一些代码示例,展示了Minecraft.displayGuiScreen()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Minecraft.displayGuiScreen()方法的具体详情如下:
包路径:net.minecraft.client.Minecraft
类名称:Minecraft
方法名:displayGuiScreen

Minecraft.displayGuiScreen介绍

暂无

代码示例

代码示例来源:origin: Vazkii/Botania

private void openEntry(int index) {
  if(index >= entriesToDisplay.size())
    return;
  LexiconEntry entry = entriesToDisplay.get(index);
  mc.displayGuiScreen(new GuiLexiconEntry(entry, this));
  ClientTickHandler.notifyPageChange();
}

代码示例来源:origin: Vazkii/Botania

@Override
protected void actionPerformed(GuiButton par1GuiButton) {
  if(par1GuiButton.id >= BOOKMARK_START)
    super.actionPerformed(par1GuiButton);
  else if(par1GuiButton.id == 12) {
    mc.displayGuiScreen(parent);
    ClientTickHandler.notifyPageChange();
  } else if(par1GuiButton instanceof GuiButtonChallengeIcon) {
    GuiButtonChallengeIcon cbutton = (GuiButtonChallengeIcon) par1GuiButton;
    mc.displayGuiScreen(new GuiLexiconChallenge(this, cbutton.challenge));
  } else if(par1GuiButton.id == NOTES_BUTTON_ID)
    notesEnabled = !notesEnabled;
}

代码示例来源:origin: Vazkii/Botania

@Override
protected void keyTyped(char par1, int par2) throws IOException {
  if(par2 == 14 && !notesEnabled) // Backspace
    back();
  else if(par2 == 199) { // Home
    mc.displayGuiScreen(new GuiLexicon());
    ClientTickHandler.notifyPageChange();
  }
  super.keyTyped(par1, par2);
}

代码示例来源:origin: Vazkii/Botania

@Override
protected void keyTyped(char par1, int par2) throws IOException {
  if(par2 == 14 && !notesEnabled) // Backspace
    back();
  else if(par2 == 199) { // Home
    mc.displayGuiScreen(new GuiLexicon());
    ClientTickHandler.notifyPageChange();
  }
  super.keyTyped(par1, par2);
}

代码示例来源:origin: Vazkii/Botania

@Override
@SideOnly(Side.CLIENT)
public void onActionPerformed(IGuiLexiconEntry gui, GuiButton button) {
  if(button == buttonText) {
    GuiLexicon.startTutorial();
    Minecraft.getMinecraft().displayGuiScreen(new GuiLexicon());
    Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation("botaniamisc.tutorialStarted").setStyle(new Style().setColor(TextFormatting.GREEN)));
  } else if(button == buttonVideo && Desktop.isDesktopSupported()) {
    try {
      Desktop.getDesktop().browse(new URI("https://www.youtube.com/watch?v=D75Aad-5QgQ"));
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: Vazkii/Botania

@Override
protected void keyTyped(char par1, int par2) {
  handleNoteKey(par1, par2);
  LexiconPage page = entry.pages.get(this.page);
  page.onKeyPressed(par1, par2);
  if(par2 == 1) {
    mc.displayGuiScreen(null);
    mc.setIngameFocus();
  } else if(par2 == 203 || par2 == 200 || par2 == 201) // Left, Up, Page Up
    prevPage();
  else if(par2 == 205 || par2 == 208 || par2 == 209) // Right, Down Page Down
    nextPage();
  if(par2 == 14 && !notesEnabled) // Backspace
    back();
  else if(par2 == 199) { // Home
    mc.displayGuiScreen(new GuiLexicon());
    ClientTickHandler.notifyPageChange();
  }
}

代码示例来源:origin: Vazkii/Botania

@Override
protected void actionPerformed(GuiButton par1GuiButton) {
  if(par1GuiButton.id >= BOOKMARK_START)
    super.actionPerformed(par1GuiButton);
  else if(par1GuiButton.id == 12) {
    mc.displayGuiScreen(parent);
    ClientTickHandler.notifyPageChange();
  } else if(par1GuiButton.id == 13) {
    challenge.complete = !challenge.complete;
    setCompleteButtonTitle();
    PersistentVariableHelper.saveSafe();
  } else if(par1GuiButton.id == NOTES_BUTTON_ID)
    notesEnabled = !notesEnabled;
}

代码示例来源:origin: Vazkii/Botania

public void handleBookmark(GuiButton par1GuiButton) {
  boolean modified = false;
  int i = par1GuiButton.id - BOOKMARK_START;
  String key = getNotesKey();
  if(i == bookmarks.size()) {
    if(!bookmarkKeys.contains(key)) {
      bookmarks.add(copy());
      bookmarkKeys.add(key);
      modified = true;
    }
  } else {
    if(isShiftKeyDown()) {
      bookmarks.remove(i);
      bookmarkKeys.remove(i);
      modified = true;
    } else {
      GuiLexicon bookmark = bookmarks.get(i).copy();
      if(!bookmark.getTitle().equals(getTitle())) {
        Minecraft.getMinecraft().displayGuiScreen(bookmark);
        if(bookmark instanceof IParented)
          ((IParented) bookmark).setParent(this);
        ClientTickHandler.notifyPageChange();
      }
    }
  }
  bookmarksNeedPopulation = true;
  if(modified)
    PersistentVariableHelper.saveSafe();
}

代码示例来源:origin: Vazkii/Botania

if(par1GuiButton.id >= BOOKMARK_START + MAX_BOOKMARK_COUNT) {
    if(par1GuiButton instanceof GuiButtonChallengeInfo)
      mc.displayGuiScreen(new GuiLexiconEntry(LexiconData.challenges, this));
    else mc.displayGuiScreen(new GuiLexiconHistory());
    ClientTickHandler.notifyPageChange();
  } else handleBookmark(par1GuiButton);
  mc.displayGuiScreen(new GuiLexiconIndex(category));
  ClientTickHandler.notifyPageChange();
} else switch(par1GuiButton.id) {
case -1 :
  mc.displayGuiScreen(new GuiBotaniaConfig(this));
  break;
case -2 :
  if(mc.player != null) {
    GuiScreenAdvancements gui = new GuiScreenAdvancements(this.mc.player.connection.getAdvancementManager());
    this.mc.displayGuiScreen(gui);
    ResourceLocation tab = new ResourceLocation(LibMisc.MOD_ID, "main/root");
    gui.setSelectedTab(mc.player.connection.getAdvancementManager().getAdvancementList().getAdvancement(tab));
  mc.displayGuiScreen(new GuiLexiconChallengesList());
  break;
case -4:
  mc.displayGuiScreen(new GuiLexicon());
  break;
case -98 :

代码示例来源:origin: Vazkii/Botania

@Override
public void onInitGui() {
  super.onInitGui();
  buttonList.add(backButton = new GuiButtonBackWithShift(0, left + guiWidth / 2 - 8, top + guiHeight + 2));
  buttonList.add(leftButton = new GuiButtonPage(1, left, top + guiHeight - 10, false));
  buttonList.add(rightButton = new GuiButtonPage(2, left + guiWidth - 18, top + guiHeight - 10, true));
  buttonList.add(new GuiButtonShare(3, left + guiWidth - 6, top - 2));
  if(entry.getWebLink() != null)
    buttonList.add(new GuiButtonViewOnline(4, left - 8, top + 12));
  if(!GuiLexicon.isValidLexiconGui(this))	{
    currentOpenLexicon = new GuiLexicon();
    mc.displayGuiScreen(currentOpenLexicon);
    ClientTickHandler.notifyPageChange();
    return;
  }
  LexiconPage page = entry.pages.get(this.page);
  page.onOpened(this);
  updatePageButtons();
  GuiLexiconHistory.visit(entry);
}

代码示例来源:origin: Vazkii/Botania

@Override
public void onInitGui() {
  super.onInitGui();
  if(!GuiLexicon.isValidLexiconGui(this))	{
    currentOpenLexicon = new GuiLexicon();
    mc.displayGuiScreen(currentOpenLexicon);
    ClientTickHandler.notifyPageChange();
    return;
  }
  buttonList.add(backButton = new GuiButtonBack(12, left + guiWidth / 2 - 8, top + guiHeight + 2));
  buttonList.add(leftButton = new GuiButtonPage(13, left, top + guiHeight - 10, false));
  buttonList.add(rightButton = new GuiButtonPage(14, left + guiWidth - 18, top + guiHeight - 10, true));
  searchField = new GuiTextField(15, fontRenderer, left + guiWidth / 2 + 28, top + guiHeight + 6, 200, 10);
  searchField.setCanLoseFocus(false);
  searchField.setFocused(true);
  searchField.setEnableBackgroundDrawing(false);
  updateAll();
}

代码示例来源:origin: Vazkii/Botania

@Override
protected void keyTyped(char par1, int par2) throws IOException {
  if(par2 == 203 || par2 == 200 || par2 == 201) // Left, Up, Page Up
    prevPage();
  else if(par2 == 205 || par2 == 208 || par2 == 209) // Right, Down Page Down
    nextPage();
  else if(par2 == 14 && !notesEnabled && searchField.getText().isEmpty()) // Backspace
    back();
  else if(par2 == 199) { // Home
    mc.displayGuiScreen(new GuiLexicon());
    ClientTickHandler.notifyPageChange();
  } else if(par2 == 28 && entriesToDisplay.size() == 1) // Enter
    openEntry(0);
  if(!notesEnabled) {
    String search = searchField.getText();
    searchField.textboxKeyTyped(par1, par2);
    if(!searchField.getText().equalsIgnoreCase(search))
      updateAll();
  }
  super.keyTyped(par1, par2);
}

代码示例来源:origin: Vazkii/Botania

case 0 :
  currentPage.onClosed(this);
  mc.displayGuiScreen(GuiScreen.isShiftKeyDown() ? new GuiLexicon() : parent);
  ClientTickHandler.notifyPageChange();
  break;

代码示例来源:origin: Vazkii/Botania

@Override
protected void keyTyped(char par1, int par2) throws IOException {
  handleNoteKey(par1, par2);
  if(!notesEnabled && closeScreenOnInvKey() && mc.gameSettings.keyBindInventory.getKeyCode() == par2) {
    mc.displayGuiScreen(null);
    mc.setIngameFocus();
  }
  if(konamiTime == 0 && par2 == KONAMI_CODE[konamiIndex]) {
    konamiIndex++;
    if(konamiIndex >= KONAMI_CODE.length) {
      mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(ModSounds.way, 1.0F));
      konamiIndex = 0;
      konamiTime = 240;
    }
  } else konamiIndex = 0;
  super.keyTyped(par1, par2);
}

代码示例来源:origin: Vazkii/Botania

switch(par1GuiButton.id) {
case 12 :
  mc.displayGuiScreen(parent);
  ClientTickHandler.notifyPageChange();
  break;

代码示例来源:origin: Vazkii/Botania

@SideOnly(Side.CLIENT)
public void renderItem(IGuiLexiconEntry gui, int xPos, int yPos, ItemStack stack) {
  RenderItem render = Minecraft.getMinecraft().getRenderItem();
  boolean mouseDown = Mouse.isButtonDown(0);
  GlStateManager.pushMatrix();
  GlStateManager.enableBlend();
  GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
  RenderHelper.enableGUIStandardItemLighting();
  GlStateManager.enableRescaleNormal();
  GlStateManager.enableDepth();
  render.renderItemAndEffectIntoGUI(stack, xPos, yPos);
  render.renderItemOverlays(Minecraft.getMinecraft().fontRenderer, stack, xPos, yPos);
  RenderHelper.disableStandardItemLighting();
  GlStateManager.popMatrix();
  if(relativeMouseX >= xPos && relativeMouseY >= yPos && relativeMouseX <= xPos + 16 && relativeMouseY <= yPos + 16) {
    tooltipStack = stack;
    EntryData data = LexiconRecipeMappings.getDataForStack(tooltipStack);
    if(data != null && (data.entry != gui.getEntry() || data.page != gui.getPageOn())) {
      tooltipEntry = true;
      if(!mouseDownLastTick && mouseDown && GuiScreen.isShiftKeyDown()) {
        GuiLexiconEntry newGui = new GuiLexiconEntry(data.entry, (GuiScreen) gui);
        newGui.page = data.page;
        Minecraft.getMinecraft().displayGuiScreen(newGui);
      }
    }
  }
  GlStateManager.disableLighting();
}

代码示例来源:origin: Vazkii/Quark

@Override
protected void actionPerformed(GuiButton button) throws IOException {
  super.actionPerformed(button);
  switch(button.id) {
  case 1: // Configure
    mc.displayGuiScreen(new GuiConfigRoot(parent));
    break;
  case 2: // Import Config
    tryOpenWebsite(LibMisc.MOD_WEBSITE);
    break;
  }
}

代码示例来源:origin: Vazkii/Botania

GuiLexiconEntry newGui = new GuiLexiconEntry(data.entry, (GuiScreen) gui);
newGui.page = data.page;
Minecraft.getMinecraft().displayGuiScreen(newGui);

代码示例来源:origin: sinkillerj/ProjectE

@Override
  public void run() {
    Minecraft.getMinecraft().displayGuiScreen(new GUIAlchChest(Minecraft.getMinecraft().player.inventory, EnumHand.OFF_HAND, new ItemStackHandler(104)));
    Minecraft.getMinecraft().player.openContainer.windowId = message.windowId;
  }
});

代码示例来源:origin: Vazkii/Quark

@Override
public void updateScreen() {
  super.updateScreen();
  
  recipeButton.y = recipeButtonY;
  
  if(!Backpacks.isEntityWearingBackpack(player)) {
    ItemStack curr = player.inventory.getItemStack();
    closeHack = true;
    NetworkHandler.INSTANCE.sendToServer(new MessageHandleBackpack(false));
    mc.displayGuiScreen(new GuiInventory(player));
    player.inventory.setItemStack(curr);
  }
}

相关文章