本文整理匯總了Java中net.minecraft.client.gui.GuiButton類的典型用法代碼示例。如果您正苦於以下問題:Java GuiButton類的具體用法?Java GuiButton怎麽用?Java GuiButton使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GuiButton類屬於net.minecraft.client.gui包,在下文中一共展示了GuiButton類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: actionPerformed
import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
/**
* Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
*/
protected void actionPerformed(GuiButton button)
{
if (button.enabled)
{
if (button.id < 200 && button instanceof GuiOptionButton)
{
this.settings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1);
button.displayString = this.settings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id));
}
if (button.id == 200)
{
this.mc.gameSettings.saveOptions();
this.mc.displayGuiScreen(this.prevScreen);
}
if (button.id != GameSettings.Options.AA_LEVEL.ordinal())
{
ScaledResolution scaledresolution = new ScaledResolution(this.mc);
this.setWorldAndResolution(this.mc, scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight());
}
}
}
示例2: actionPerformed
import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
/**
* Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
*/
protected void actionPerformed(GuiButton button) throws IOException
{
if (button.id == 0)
{
this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.getStatFileWriter()));
}
if (button.id == 1)
{
this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter()));
}
if (button.id == 101)
{
tabPage = Math.max(tabPage - 1, 0);
}
else if (button.id == 102)
{
tabPage = Math.min(tabPage + 1, maxPages);
}
}
示例3: initGui
import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
public void initGui() {
super.initGui();
this.nameField = new GuiTextField(NAME_FIELD, this.fontRendererObj, this.guiLeft + 11, this.guiTop + 120, 211, 18);
this.nameField.setMaxStringLength(23);
this.nameField.setText("");
this.nameField.setFocused(false);
this.nameField.setVisible(false);
this.addControl(this.nameField);
this.searchField = new GuiTextField(SEARCH_FIELD, this.fontRendererObj, this.guiLeft + 11, this.guiTop + 5, 211, 18);
this.searchField.setMaxStringLength(23);
this.searchField.setText("");
this.searchField.setFocused(true);
this.searchField.setVisible(true);
this.addControl(this.searchField);
this.securedBtn = new GuiButton(SECURED_BUTTON, this.guiLeft + 50, this.guiTop + 167, 100, 18, "Not Secured");
this.securedBtn.visible = false;
this.addControl(this.securedBtn);
}
示例4: drawGuiContainerForegroundLayer
import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
GlStateManager.pushMatrix();
GlStateManager.translate(-guiLeft, -guiTop, 0);
for (Gui control : this.controls) {
if (control instanceof GuiTextField) {
((GuiTextField)control).drawTextBox();
} else if (control instanceof GuiButton) {
((GuiButton)control).drawButton(this.mc, mouseX, mouseY);
}
}
GlStateManager.popMatrix();
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
}
示例5: initGui
import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
public void initGui() {
super.initGui();
int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2;
statusStat = addAnimatedStat("Security Status", new ItemStack(Blockss.SECURITY_STATION), 0xFFFFAA00, false);
accessStat = addAnimatedStat("Shared Users", new ItemStack(Items.SKULL, 1, 3), 0xFF005500, false);
Rectangle accessButtonRectangle = accessStat.getButtonScaledRectangle(145, 10, 20, 20);
addButton = getButtonFromRectangle(1, accessButtonRectangle, "+");
rebootButton = new GuiButton(2, xStart + 110, yStart + 20, 60, 20, "Reboot");
sharedUserTextField = getTextFieldFromRectangle(accessStat.getButtonScaledRectangle(20, 15, 120, 10));
accessStat.addWidget(sharedUserTextField);
accessStat.addWidget(addButton);
buttonList.add(new GuiButton(3, guiLeft + 108, guiTop + 103, 64, 20, I18n.format("gui.securityStation.test")));
buttonList.add(rebootButton);
buttonList.add(new GuiButton(-1, guiLeft + 108, guiTop + 125, 64, 20, I18n.format("gui.universalSensor.button.showRange")));
updateUserRemoveButtons();
nodeHandler = new NetworkConnectionBackground(this, te, xStart + 25, yStart + 30, 18, 0xFF2222FF);
}
示例6: actionPerformed
import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
protected void actionPerformed(GuiButton button) throws IOException
{
if(!button.enabled)
return;
WurstClient wurst = WurstClient.INSTANCE;
switch(button.id)
{
case 0:
feature.doPrimaryAction();
primaryButton.displayString = feature.getPrimaryAction();
break;
case 1:
MiscUtils.openLink("https://www.wurstclient.net/wiki/"
+ feature.getHelpPage() + "/");
wurst.navigator.analytics.trackEvent("help", "open",
feature.getName());
break;
}
wurst.navigator.addPreference(feature.getName());
ConfigFiles.NAVIGATOR.save();
}
示例7: mouseClicked
import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
/**
* Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
*/
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
{
super.mouseClicked(mouseX, mouseY, mouseButton);
if (mouseButton == 1)
{
GuiButton guibutton = this.getSelectedButton(mouseX, mouseY);
if (guibutton instanceof GuiButtonShaderOption)
{
GuiButtonShaderOption guibuttonshaderoption = (GuiButtonShaderOption)guibutton;
ShaderOption shaderoption = guibuttonshaderoption.getShaderOption();
if (shaderoption.isChanged())
{
guibuttonshaderoption.playPressSound(this.mc.getSoundHandler());
shaderoption.resetValue();
this.changed = true;
this.updateAllButtons();
}
}
}
}
示例8: actionPerformed
import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
protected final void actionPerformed(GuiButton button) {
if (button.enabled) {
switch (button.id) {
case 0:
if (StringUtils.isNotEmpty(urlBox.getText())) {
Thread t = new InstallThread(urlBox.getText());
t.setDaemon(true);
t.start();
} else {
this.message = "Enter a valid url!";
}
break;
case 1:
this.mc.displayGuiScreen(this.prevScreen);
}
}
}
示例9: initGui
import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
public void initGui() {
super.initGui();
buttonList.clear();
upgradePages.clear();
upgradePageNames.clear();
addPages();
for (int i = 0; i < upgradePages.size(); i++) {
GuiButton button = new GuiButton(100 + i, 210, 20 + i * 22, 200, 20, upgradePages.get(i).getPageName());
if (page == i) button.enabled = false;
buttonList.add(button);
}
if (page > upgradePages.size() - 1) {
page = upgradePages.size() - 1;
}
GuiKeybindCheckBox checkBox = new GuiKeybindCheckBox(100, 40, 12, 0xFFFFFFFF,
I18n.format("gui.enableModule", I18n.format("pneumaticHelmet.upgrade." + upgradePageNames.get(page))),
"pneumaticHelmet.upgrade." + upgradePageNames.get(page));
if (upgradePages.get(page).canBeTurnedOff()) addWidget(checkBox);
upgradePages.get(page).initGui(this);
}
示例10: initGui
import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
public void initGui()
{
buttonList.clear();
buttonList.add(new GuiButton(0, width / 2 - 100, height / 4 + 144 - 16,
200, 20, "Back"));
buttonList.add(new GuiButton(1, width / 2 - 79, height / 4 + 24 - 16,
158, 20, "Zoom Key: " + Keyboard
.getKeyName(WurstClient.INSTANCE.options.zoom.keybind)));
buttonList.add(new GuiButton(2, width / 2 - 79, height / 4 + 72 - 16,
50, 20, "More"));
buttonList.add(new GuiButton(3, width / 2 - 25, height / 4 + 72 - 16,
50, 20, "Less"));
buttonList.add(new GuiButton(4, width / 2 + 29, height / 4 + 72 - 16,
50, 20, "Default"));
buttonList.add(new GuiButton(5, width / 2 - 79, height / 4 + 96 - 16,
158, 20, "Use Mouse Wheel: "
+ (WurstClient.INSTANCE.options.zoom.scroll ? "ON" : "OFF")));
WurstClient.INSTANCE.analytics.trackPageView("/options/keybind-manager",
"Keybind Manager");
}
示例11: actionPerformed
import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
public void actionPerformed(GuiButton gui){
switch (gui.id){
case BUTTON_START_PROFILE_ID:
startProfile();
break;
case BUTTON_SHOW_TOGGLE:
if(lagOverlayGui.isShowing.get()) {
lagOverlayGui.hide();
Minecraft.getMinecraft().displayGuiScreen(null);
}else{
lagOverlayGui.show();
Minecraft.getMinecraft().displayGuiScreen(null);
}
break;
case BUTTON_ANALYZE_RESULTS:
analyzeResults();
break;
case BUTTON_DONATE:
DonateButton.donate();
break;
case BUTTON_OPTIONS:
mc.displayGuiScreen(new GuiInGameConfig(this));
break;
}
}
示例12: initGui
import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
public void initGui()
{
buttonList.add(new GuiButton(0, width / 2 - 150, height / 3 * 2, 100,
20, "MC 1.12"));
buttonList.add(new GuiButton(1, width / 2 - 50, height / 3 * 2, 100, 20,
"MC 1.12.1"));
buttonList.add(new GuiButton(2, width / 2 + 50, height / 3 * 2, 100, 20,
"MC 1.12.2"));
buttonList.add(
new GuiButton(-1, width / 2 - 100, height / 3 * 2 + 40, "Cancel"));
int version = WurstClient.INSTANCE.options.mc112x_compatibility;
if(version >= 0 && version < buttonList.size() - 1)
buttonList.get(version).enabled = false;
}
示例13: initGui
import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
public void initGui()
{
int i = this.width / 3;
int j = i - 130;
this.buttonList.add(new GuiButton(1, i * 0 + j / 2, this.height - 70, 130, 20, I18n.format("stream.userinfo.timeout", new Object[0])));
this.buttonList.add(new GuiButton(0, i * 1 + j / 2, this.height - 70, 130, 20, I18n.format("stream.userinfo.ban", new Object[0])));
this.buttonList.add(new GuiButton(2, i * 2 + j / 2, this.height - 70, 130, 20, I18n.format("stream.userinfo.mod", new Object[0])));
this.buttonList.add(new GuiButton(5, i * 0 + j / 2, this.height - 45, 130, 20, I18n.format("gui.cancel", new Object[0])));
this.buttonList.add(new GuiButton(3, i * 1 + j / 2, this.height - 45, 130, 20, I18n.format("stream.userinfo.unban", new Object[0])));
this.buttonList.add(new GuiButton(4, i * 2 + j / 2, this.height - 45, 130, 20, I18n.format("stream.userinfo.unmod", new Object[0])));
int k = 0;
for (IChatComponent ichatcomponent : this.field_152332_r)
{
k = Math.max(k, this.fontRendererObj.getStringWidth(ichatcomponent.getFormattedText()));
}
this.field_152334_t = this.width / 2 - k / 2;
}
示例14: actionPerformed
import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
if (hasBackButton() && back == button) {
onBackButton();
}
if (hasPageRight() && right == button) {
onRightButton();
}
if (hasPageLeft() && left == button) {
onLeftButton();
}
if (button instanceof CategoryEntryButton) {
for (BookCategory category : BookCategory.values()) {
for (ResourceLocation location : category.getEntries().keySet()) {
if (((CategoryEntryButton) button).getEntry().equals(category.getEntries().get(location))) {
this.mc.displayGuiScreen(new GUIBookPage(this, this, category.getEntries().get(location)));
}
}
}
}
}
示例15: actionPerformed
import net.minecraft.client.gui.GuiButton; //導入依賴的package包/類
@Override
protected void actionPerformed(GuiButton button) {
if (getPermission(button.id) != null)
//noinspection ConstantConditions
logger.info("Button-action id: " + button.id + " text: " + button.displayString + " permission: " + getPermission(button.id).getName());
if (button.id == 0) {
((WurstSDK) SDK.getClient()).saveConfig();
mc.displayGuiScreen(parent);
return;
} else {
if (button.displayString.equals("Enable")) {
((WurstSDK) SDK.getClient()).getConfig().change(plugin, getPermission(button.id), true, this);
} else {
((WurstSDK) SDK.getClient()).getConfig().change(plugin, getPermission(button.id), false, this);
}
((WurstSDK) SDK.getClient()).saveConfig();
}
mc.displayGuiScreen(new GuiPluginInfo(plugin, parent));
}