Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.mcnanotech.nhg.client;
- import java.util.Iterator;
- import java.util.List;
- import org.lwjgl.input.Keyboard;
- import fr.mcnanotech.kevin_68.thespotlightmod.client.gui.GuiBooleanButton;
- import fr.mcnanotech.nhg.client.gui.NHGPanorama;
- import fr.mcnanotech.nhg.client.gui.replaced.NHGGuiIngameMenu;
- import fr.mcnanotech.nhg.common.ModNanotechHungerGames;
- import fr.mcnanotech.nhg.common.NHGCommon;
- import fr.mcnanotech.nhg.common.capabilities.INHGCapability;
- import fr.mcnanotech.nhg.common.kit.Kit;
- import fr.mcnanotech.nhg.common.network.NHGNetwork;
- import fr.mcnanotech.nhg.common.network.packets.PacketRequestCrafterGui;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.audio.PositionedSoundRecord;
- import net.minecraft.client.audio.SoundHandler;
- import net.minecraft.client.gui.*;
- import net.minecraft.client.gui.inventory.GuiInventory;
- import net.minecraft.client.multiplayer.GuiConnecting;
- import net.minecraft.client.renderer.BufferBuilder;
- import net.minecraft.client.renderer.GlStateManager;
- import net.minecraft.client.renderer.Tessellator;
- import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
- import net.minecraft.client.resources.I18n;
- import net.minecraft.client.settings.GameSettings;
- import net.minecraft.init.SoundEvents;
- import net.minecraft.network.NetworkManager;
- import net.minecraft.util.ResourceLocation;
- import net.minecraft.util.SoundCategory;
- import net.minecraft.util.TabCompleter;
- import net.minecraft.util.Timer;
- import net.minecraft.util.math.MathHelper;
- import net.minecraft.util.text.TextFormatting;
- import net.minecraftforge.client.event.GuiScreenEvent;
- import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
- import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
- import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.relauncher.SideOnly;
- @EventBusSubscriber(modid = ModNanotechHungerGames.MODID, value = Side.CLIENT)
- public class GuiEventHandler
- {
- private static final ResourceLocation white = new ResourceLocation(ModNanotechHungerGames.MODID, "textures/gui/white.png");
- private static Timer timer = null;
- @SideOnly(Side.CLIENT)
- @SubscribeEvent
- public static void onGuiInitPost(GuiScreenEvent.InitGuiEvent.Post event)
- {
- if(event.getGui().getClass().equals(GuiIngameMenu.class))
- {
- NHGClient.mc.displayGuiScreen(new NHGGuiIngameMenu());
- }
- else if(event.getGui().getClass().equals(GuiInventory.class))
- {
- if(NHGClient.hasGameStarted() && NHGClient.mc.player != null)
- {
- if(NHGClient.mc.player.hasCapability(NHGCommon.NHG_CAP, null))
- {
- final INHGCapability cap = NHGClient.mc.player.getCapability(NHGCommon.NHG_CAP, null);
- Kit kit = cap.getKit();
- if(kit.hasIntegratedCraft())
- {
- event.getButtonList().add(new GuiButton(200, event.getGui().width / 2 + 10, event.getGui().height / 2 - 21, 16, 16, "")
- {
- @SideOnly(Side.CLIENT)
- @Override
- public void drawButton(Minecraft mcIn, int mouseX, int mouseY, float partialTicks)
- {
- if(this.visible)
- {
- mcIn.getTextureManager().bindTexture(new ResourceLocation("nhg", "textures/gui/buttons.png"));
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- int x = mcIn.player.getActivePotionEffects().isEmpty() ? 0 : 60;
- this.hovered = mouseX >= this.x + x && mouseY >= this.y && mouseX < this.x + x + this.width && mouseY < this.y + this.height;
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
- GlStateManager.blendFunc(770, 771);
- this.drawTexturedModalRect(this.x + x, this.y, 0, 0, 16, 16);
- this.mouseDragged(mcIn, mouseX, mouseY);
- }
- }
- @SideOnly(Side.CLIENT)
- @Override
- public boolean mousePressed(Minecraft mcIn, int mouseX, int mouseY)
- {
- int x = mcIn.player.getActivePotionEffects().isEmpty() ? 0 : 60;
- return this.enabled && this.visible && mouseX >= this.x + x && mouseY >= this.y && mouseX < this.x + this.width + x && mouseY < this.y + this.height;
- }
- });
- event.getButtonList().add(new GuiButton(201, event.getGui().width / 2 + 28, event.getGui().height / 2 - 21, 16, 16, "")
- {
- @SideOnly(Side.CLIENT)
- @Override
- public void drawButton(Minecraft mcIn, int mouseX, int mouseY, float partialTicks)
- {
- if(this.visible)
- {
- mcIn.getTextureManager().bindTexture(new ResourceLocation("nhg", "textures/gui/buttons.png"));
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- int x = mcIn.player.getActivePotionEffects().isEmpty() ? 0 : 60;
- this.hovered = mouseX >= this.x + x && mouseY >= this.y && mouseX < this.x + x + this.width && mouseY < this.y + this.height;
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
- GlStateManager.blendFunc(770, 771);
- this.drawTexturedModalRect(this.x + x, this.y, cap.getIntegratedFurnace().isBurning() ? 32 : 16, 0, 16, 16);
- this.mouseDragged(mcIn, mouseX, mouseY);
- }
- }
- @SideOnly(Side.CLIENT)
- @Override
- public boolean mousePressed(Minecraft mcIn, int mouseX, int mouseY)
- {
- int x = mcIn.player.getActivePotionEffects().isEmpty() ? 0 : 60;
- return this.enabled && this.visible && mouseX >= this.x + x && mouseY >= this.y && mouseX < this.x + this.width + x && mouseY < this.y + this.height;
- }
- });
- }
- if(kit.hasIntegratedEnchantTable())
- {
- event.getButtonList().add(new GuiButton(202, event.getGui().width / 2 + 46, event.getGui().height / 2 - 21, 16, 16, "")
- {
- @SideOnly(Side.CLIENT)
- @Override
- public void drawButton(Minecraft mcIn, int mouseX, int mouseY, float partialTicks)
- {
- if(this.visible)
- {
- mcIn.getTextureManager().bindTexture(new ResourceLocation("nhg", "textures/gui/buttons.png"));
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- int x = mcIn.player.getActivePotionEffects().isEmpty() ? 0 : 60;
- this.hovered = mouseX >= this.x + x && mouseY >= this.y && mouseX < this.x + x + this.width && mouseY < this.y + this.height;
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
- GlStateManager.blendFunc(770, 771);
- this.drawTexturedModalRect(this.x + x, this.y, 16, 16, 16, 16);
- this.mouseDragged(mcIn, mouseX, mouseY);
- }
- }
- @SideOnly(Side.CLIENT)
- @Override
- public boolean mousePressed(Minecraft mcIn, int mouseX, int mouseY)
- {
- int x = mcIn.player.getActivePotionEffects().isEmpty() ? 0 : 60;
- return this.enabled && this.visible && mouseX >= this.x + x && mouseY >= this.y && mouseX < this.x + this.width + x && mouseY < this.y + this.height;
- }
- });
- }
- if(kit.hasIntegratedAnvil())
- {
- event.getButtonList().add(new GuiButton(203, event.getGui().width / 2 + 64, event.getGui().height / 2 - 21, 16, 16, "")
- {
- @SideOnly(Side.CLIENT)
- @Override
- public void drawButton(Minecraft mcIn, int mouseX, int mouseY, float partialTicks)
- {
- if(this.visible)
- {
- mcIn.getTextureManager().bindTexture(new ResourceLocation("nhg", "textures/gui/buttons.png"));
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- int x = mcIn.player.getActivePotionEffects().isEmpty() ? 0 : 60;
- this.hovered = mouseX >= this.x + x && mouseY >= this.y && mouseX < this.x + x + this.width && mouseY < this.y + this.height;
- GlStateManager.enableBlend();
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
- GlStateManager.blendFunc(770, 771);
- this.drawTexturedModalRect(this.x + x, this.y, 32, 16, 16, 16);
- this.mouseDragged(mcIn, mouseX, mouseY);
- }
- }
- @SideOnly(Side.CLIENT)
- @Override
- public boolean mousePressed(Minecraft mcIn, int mouseX, int mouseY)
- {
- int x = mcIn.player.getActivePotionEffects().isEmpty() ? 0 : 60;
- return this.enabled && this.visible && mouseX >= this.x + x && mouseY >= this.y && mouseX < this.x + this.width + x && mouseY < this.y + this.height;
- }
- });
- }
- }
- }
- }
- else if(event.getGui().getClass().equals(GuiChat.class))
- {
- if(ClientEventHandler.INSTANCE.isTeamEnabled() && NHGClient.mc.player.hasCapability(NHGCommon.NHG_CAP, null))
- {
- if(NHGClient.mc.player.getCapability(NHGCommon.NHG_CAP, null).hasTeam())
- {
- GuiBooleanButton teamButton = new GuiBooleanButton(150, event.getGui().width / 2 - 60, 10, 120, 20, "", NHGClient.teamChatOnly());
- teamButton.setTexts(I18n.format("gui.chat.team", TextFormatting.GREEN + I18n.format("gui.yes")), I18n.format("gui.chat.team", I18n.format("gui.no")));
- event.getButtonList().add(teamButton);
- }
- }
- }
- else if(event.getGui().getClass().equals(GuiScreenOptionsSounds.class))
- {
- event.getButtonList().clear();
- int i = 0;
- event.getButtonList().add(new SndButton(SoundCategory.MASTER.ordinal(), event.getGui().width / 2 - 155 + i % 2 * 160, event.getGui().height / 6 - 12 + 24 * (i >> 1), SoundCategory.MASTER, true));
- i = i + 2;
- for(SoundCategory soundcategory : SoundCategory.values())
- {
- if(soundcategory != SoundCategory.MASTER)
- {
- event.getButtonList().add(new SndButton(soundcategory.ordinal(), event.getGui().width / 2 - 155 + i % 2 * 160, event.getGui().height / 6 - 12 + 24 * (i >> 1), soundcategory, false));
- ++i;
- }
- }
- int j = event.getGui().width / 2 - 75;
- int k = event.getGui().height / 6 - 12;
- ++i;
- event.getButtonList().add(new GuiOptionButton(201, j, k + 24 * (i >> 1), GameSettings.Options.SHOW_SUBTITLES, NHGClient.mc.gameSettings.getKeyBinding(GameSettings.Options.SHOW_SUBTITLES)));
- event.getButtonList().add(new GuiButton(200, event.getGui().width / 2 - 100, event.getGui().height / 6 + 168, I18n.format("gui.done")));
- }
- }
- @SideOnly(Side.CLIENT)
- @SubscribeEvent
- public static void onActionPerformedPre(GuiScreenEvent.ActionPerformedEvent.Pre event)
- {
- if(event.getGui().getClass().equals(GuiInventory.class))
- {
- if(NHGClient.hasGameStarted() && NHGClient.mc.player != null)
- {
- if(event.getButton().id == 200)
- {
- NHGNetwork.network.sendToServer(new PacketRequestCrafterGui(0));
- }
- else if(event.getButton().id == 201)
- {
- NHGNetwork.network.sendToServer(new PacketRequestCrafterGui(1));
- }
- else if(event.getButton().id == 202)
- {
- NHGNetwork.network.sendToServer(new PacketRequestCrafterGui(3));
- }
- else if(event.getButton().id == 203)
- {
- NHGNetwork.network.sendToServer(new PacketRequestCrafterGui(4));
- }
- }
- }
- else if(event.getGui().getClass().equals(GuiChat.class))
- {
- if(event.getButton().id == 150)
- {
- ((GuiBooleanButton)event.getButton()).toggle();
- NHGClient.toogleTeamChatOnly();
- }
- }
- }
- @SideOnly(Side.CLIENT)
- @SubscribeEvent
- public static void onGuiKeyTyped(GuiScreenEvent.KeyboardInputEvent.Pre event)
- {
- if(event.getGui().getClass().equals(GuiChat.class) && ClientEventHandler.INSTANCE.isTeamEnabled())
- {
- if(NHGClient.mc.player.hasCapability(NHGCommon.NHG_CAP, null))
- {
- if(NHGClient.mc.player.getCapability(NHGCommon.NHG_CAP, null).hasTeam())
- {
- char typedChar = Keyboard.getEventCharacter();
- if(Keyboard.getEventKey() == 0 && typedChar >= 32 || Keyboard.getEventKeyState())
- {
- event.setCanceled(true);
- TabCompleter tabCompleter = ObfuscationReflectionHelper.getPrivateValue(GuiChat.class, (GuiChat)event.getGui(), "tabCompleter", "field_184096_i");
- GuiTextField inputField = ObfuscationReflectionHelper.getPrivateValue(GuiChat.class, (GuiChat)event.getGui(), "inputField", "field_146415_a");
- int keyCode = Keyboard.getEventKey();
- tabCompleter.resetRequested();
- if(keyCode == 15)
- {
- tabCompleter.complete();
- }
- else
- {
- tabCompleter.resetDidComplete();
- }
- if(keyCode == 1)
- {
- NHGClient.mc.displayGuiScreen(null);
- }
- else if(keyCode != 28 && keyCode != 156)
- {
- if(keyCode == 200)
- {
- ((GuiChat)event.getGui()).getSentHistory(-1);
- }
- else if(keyCode == 208)
- {
- ((GuiChat)event.getGui()).getSentHistory(1);
- }
- else if(keyCode == 201)
- {
- NHGClient.mc.ingameGUI.getChatGUI().scroll(NHGClient.mc.ingameGUI.getChatGUI().getLineCount() - 1);
- }
- else if(keyCode == 209)
- {
- NHGClient.mc.ingameGUI.getChatGUI().scroll(-NHGClient.mc.ingameGUI.getChatGUI().getLineCount() + 1);
- }
- else
- {
- inputField.textboxKeyTyped(typedChar, keyCode);
- }
- }
- else
- {
- String s = inputField.getText().trim();
- if(!s.isEmpty())
- {
- if(ClientEventHandler.INSTANCE.isTeamEnabled() && NHGClient.mc.player.hasCapability(NHGCommon.getNHGCap(), null) && NHGClient.mc.player.getCapability(NHGCommon.getNHGCap(), null).hasTeam())
- {
- event.getGui().sendChatMessage((NHGClient.teamChatOnly() ? "{Team} " : "") + s);
- }
- else
- {
- event.getGui().sendChatMessage(s);
- }
- }
- NHGClient.mc.displayGuiScreen(null);
- }
- }
- }
- }
- }
- }
- @SideOnly(Side.CLIENT)
- @SubscribeEvent
- public static void onPreDrawGui(GuiScreenEvent.DrawScreenEvent.Pre event)
- {
- if(event.getGui().getClass().equals(GuiMainMenu.class))
- {
- GlStateManager.color(1.0F, 1.0F, 1.0F);
- NHGClient.mc.renderEngine.bindTexture(white);
- Tessellator tessellator = Tessellator.getInstance();
- BufferBuilder worldrenderer = tessellator.getBuffer();
- worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
- worldrenderer.pos(0.0D, event.getGui().height, 1000.0D).tex(0.0D, 1.0D).endVertex();
- worldrenderer.pos(event.getGui().width, event.getGui().height, 1000.0D).tex(1.0D, 1.0D).endVertex();
- worldrenderer.pos(event.getGui().width, 0.0D, 1000.0D).tex(1.0D, 0.0D).endVertex();
- worldrenderer.pos(0.0D, 0.0D, 1000.0D).tex(0.0D, 0.0D).endVertex();
- tessellator.draw();
- }
- else if(event.getGui().getClass().equals(GuiConnecting.class))
- {
- event.setCanceled(true);
- float zlevel = ObfuscationReflectionHelper.getPrivateValue(Gui.class, event.getGui(), "zLevel", "field_77023_b", "field_73735_i");
- NHGPanorama.instance.draw(event.getRenderPartialTicks(), event.getGui().width, event.getGui().height, zlevel);
- NetworkManager networkManager = ObfuscationReflectionHelper.getPrivateValue(GuiConnecting.class, (GuiConnecting)event.getGui(), "networkManager", "field_146371_g", "field_147313_b", "field_147333_a", "field_147384_b", "field_147386_b", "field_147393_d", "field_151272_f");
- if(networkManager == null)
- {
- event.getGui().drawCenteredString(event.getGui().mc.fontRenderer, I18n.format("connect.connecting"), event.getGui().width / 2, event.getGui().height / 2 - 50, 16777215);
- }
- else
- {
- event.getGui().drawCenteredString(event.getGui().mc.fontRenderer, I18n.format("connect.authorizing"), event.getGui().width / 2, event.getGui().height / 2 - 50, 16777215);
- }
- List<GuiButton> buttonList = ObfuscationReflectionHelper.getPrivateValue(GuiScreen.class, event.getGui(), "buttonList", "field_146292_n");
- buttonList.forEach(button -> button.drawButton(NHGClient.mc, event.getMouseX(), event.getMouseY(), 0.0F)); // TODO Change 0.0F
- List<GuiLabel> labelList = ObfuscationReflectionHelper.getPrivateValue(GuiScreen.class, event.getGui(), "labelList", "field_146293_o");
- labelList.forEach(label -> label.drawLabel(NHGClient.mc, event.getMouseX(), event.getMouseY()));
- }
- else if(event.getGui().getClass().equals(GuiDisconnected.class))
- {
- event.setCanceled(true);
- float zlevel = ObfuscationReflectionHelper.getPrivateValue(Gui.class, event.getGui(), "zLevel", "field_77023_b", "field_73735_i");
- NHGPanorama.instance.draw(event.getRenderPartialTicks(), event.getGui().width, event.getGui().height, zlevel);
- String reason = ObfuscationReflectionHelper.getPrivateValue(GuiDisconnected.class, (GuiDisconnected)event.getGui(), "reason", "field_73693_g", "field_146306_a", "field_149167_a", "field_149605_a");
- int field_175353_i = ObfuscationReflectionHelper.getPrivateValue(GuiDisconnected.class, (GuiDisconnected)event.getGui(), "field_175353_i");
- List<String> multilineMessage = ObfuscationReflectionHelper.getPrivateValue(GuiDisconnected.class, (GuiDisconnected)event.getGui(), "multilineMessage", "field_146305_g");
- event.getGui().drawCenteredString(event.getGui().mc.fontRenderer, reason, event.getGui().width / 2, event.getGui().height / 2 - field_175353_i / 2 - event.getGui().mc.fontRenderer.FONT_HEIGHT * 2, 11184810);
- int k2 = event.getGui().height / 2 - field_175353_i / 2;
- if(multilineMessage != null)
- {
- for(Iterator<String> iterator = multilineMessage.iterator(); iterator.hasNext(); k2 += event.getGui().mc.fontRenderer.FONT_HEIGHT)
- {
- String s = iterator.next();
- event.getGui().drawCenteredString(event.getGui().mc.fontRenderer, s, event.getGui().width / 2, k2, 16777215);
- }
- }
- List<GuiButton> buttonList = ObfuscationReflectionHelper.getPrivateValue(GuiScreen.class, event.getGui(), "buttonList", "field_146292_n");
- buttonList.forEach(button -> button.drawButton(NHGClient.mc, event.getMouseX(), event.getMouseY(), 0.0F)); // TODO Change 0.0F
- List<GuiLabel> labelList = ObfuscationReflectionHelper.getPrivateValue(GuiScreen.class, event.getGui(), "labelList", "field_146293_o");
- labelList.forEach(label -> label.drawLabel(NHGClient.mc, event.getMouseX(), event.getMouseY()));
- }
- }
- @SideOnly(Side.CLIENT)
- @SubscribeEvent
- public static void onPostDrawGui(GuiScreenEvent.DrawScreenEvent.Post event)
- {
- if(ClientEventHandler.INSTANCE.cheatWarn)
- {
- event.getGui().drawString(NHGClient.mc.fontRenderer, I18n.format("gui.cheat", ClientEventHandler.INSTANCE.cheatTimer / 20), 20, 20, 0xFF5555);
- }
- }
- @SideOnly(Side.CLIENT)
- @SubscribeEvent
- public static void onDrawBackGround(GuiScreenEvent.BackgroundDrawnEvent event)
- {
- if(timer == null)
- {
- timer = ObfuscationReflectionHelper.getPrivateValue(Minecraft.class, NHGClient.mc, "timer", "field_71428_T");
- }
- if(NHGClient.mc.world == null)
- {
- NHGPanorama.instance.draw(timer.renderPartialTicks, event.getGui().width, event.getGui().height, 0.00001F);
- }
- }
- /**
- * Clone of GuiScreenOptionsSounds.Button
- */
- @SideOnly(Side.CLIENT)
- public static class SndButton extends GuiButton
- {
- private static final ResourceLocation btnTexture = new ResourceLocation("nhg:textures/gui/buttons.png");
- private final SoundCategory category;
- private final String categoryName;
- public float volume = 1.0F;
- public boolean pressed;
- public SndButton(int id, int x, int y, SoundCategory categoryIn, boolean master)
- {
- super(id, x, y, master ? 310 : 150, 20, "");
- this.category = categoryIn;
- this.categoryName = I18n.format("soundCategory." + categoryIn.getName());
- this.displayString = this.categoryName + ": " + getDisplayString(categoryIn);
- this.volume = NHGClient.mc.gameSettings.getSoundLevel(categoryIn);
- }
- /**
- * Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over this button and 2 if it IS hovering over this button.
- */
- @Override
- protected int getHoverState(boolean mouseOver)
- {
- return 0;
- }
- /**
- * Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e).
- */
- @Override
- protected void mouseDragged(Minecraft mc, int mouseX, int mouseY)
- {
- if(this.visible)
- {
- if(this.pressed)
- {
- this.volume = (float)(mouseX - (this.x + 4)) / (float)(this.width - 8);
- this.volume = MathHelper.clamp(this.volume, 0.0F, 1.0F);
- mc.gameSettings.setSoundLevel(this.category, this.volume);
- mc.gameSettings.saveOptions();
- this.displayString = this.categoryName + ": " + getDisplayString(this.category);
- }
- // NHGPatch-----old
- // GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- // this.drawTexturedModalRect(this.xPosition + (int)(this.volume * (this.width - 8)), this.yPosition, 0, 66, 4, 20);
- // this.drawTexturedModalRect(this.xPosition + (int)(this.volume * (this.width - 8)) + 4, this.yPosition, 196, 66, 4, 20);
- // NHGPatch-----new
- mc.getTextureManager().bindTexture(btnTexture);
- this.drawTexturedModalRect(this.x + (int)(this.volume * (this.width - 8)), this.y, 200, 0, 8, 20);
- // NHGPatch-----end
- }
- }
- /**
- * Returns true if the mouse has been pressed on this control. Equivalent of MouseListener.mousePressed(MouseEvent e).
- */
- @Override
- public boolean mousePressed(Minecraft mc, int mouseX, int mouseY)
- {
- if(super.mousePressed(mc, mouseX, mouseY))
- {
- this.volume = (float)(mouseX - (this.x + 4)) / (float)(this.width - 8);
- this.volume = MathHelper.clamp(this.volume, 0.0F, 1.0F);
- mc.gameSettings.setSoundLevel(this.category, this.volume);
- mc.gameSettings.saveOptions();
- this.displayString = this.categoryName + ": " + getDisplayString(this.category);
- this.pressed = true;
- return true;
- }
- else
- {
- return false;
- }
- }
- @Override
- public void playPressSound(SoundHandler soundHandlerIn)
- {}
- /**
- * Fired when the mouse button is released. Equivalent of MouseListener.mouseReleased(MouseEvent e).
- */
- @Override
- public void mouseReleased(int mouseX, int mouseY)
- {
- if(this.pressed)
- {
- NHGClient.mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
- }
- this.pressed = false;
- }
- public String getDisplayString(SoundCategory categoryIn)
- {
- float f = NHGClient.mc.gameSettings.getSoundLevel(categoryIn);
- return f == 0.0F ? I18n.format("options.off") : (int)(f * 100.0F) + "%";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement