Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mod.brandy.client.gui;
- import java.io.IOException;
- import org.lwjgl.opengl.GL11;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.gui.GuiButton;
- import net.minecraft.client.gui.GuiScreen;
- import net.minecraft.client.renderer.GlStateManager;
- public class GuiDCompass extends GuiScreen
- {
- GuiButton turn_on;
- GuiButton turn_off;
- GuiButton close;
- int buttonWidth = 80;
- int buttonHeight = 20;
- public static String facingF;
- public static boolean display;
- public static String getFacing(Minecraft mc)
- {
- //swne
- int facing = mc.thePlayer.getHorizontalFacing().getHorizontalIndex();
- String direction = null;
- if(facing == 0)
- {
- direction = "South";
- }
- else if(facing == 1)
- {
- direction = "West";
- }
- else if(facing == 2)
- {
- direction = "North";
- }
- else if(facing == 3)
- {
- direction = "East";
- }
- return direction;
- }
- private static int widthF;
- private static int heightF;
- @Override
- public void drawScreen(int x, int y, float t)
- {
- this.drawDefaultBackground();
- widthF = this.width;
- heightF = this.height;
- int stringWidth = widthF / 2 - 25;
- int stringHeight = heightF / 4 + 50;
- GL11.glPushMatrix();
- {
- GlStateManager.translate(stringWidth, stringHeight, 0);
- GL11.glScalef(2F, 2F, 2F);
- mc.fontRendererObj.drawString(getFacing(mc), 0, 0 - 8, 0xFFFFFF);
- }
- GL11.glPopMatrix();
- super.drawScreen(x, y, t);
- }
- @Override
- public boolean doesGuiPauseGame()
- {
- return false;
- }
- @Override
- public void initGui()
- {
- this.buttonList.add(this.turn_on = new GuiButton(24, this.width / 2 - 40, this.height / 4 + 60, buttonWidth, buttonHeight, "Turn On"));
- this.buttonList.add(this.turn_off = new GuiButton(25, this.width / 2 - 40, this.height / 4 + 80, buttonWidth, buttonHeight, "Turn Off"));
- this.buttonList.add(this.close = new GuiButton(26, this.width / 2 - 40, this.height / 4 + 100, buttonWidth, buttonHeight, "Close"));
- }
- @Override
- public void actionPerformed(GuiButton button) throws IOException
- {
- if(button.id == 26)
- {
- this.mc.setIngameFocus();
- }
- else
- if(button.id == 24)
- {
- display = true;
- }
- else
- if(button.id == 25)
- {
- display = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement