Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- import java.awt.image.BufferedImage;
- import org.lwjgl.opengl.GL11;
- public class GuiWhatever extends GuiScreen
- {
- private BufferedImage img;
- private int imgID = 1000;
- private int page = 0;
- private GuiButton disabled;
- public void initGui()
- {
- try {
- img = ModLoader.loadImage(mc.renderEngine, "/mods/test1.png");
- mc.renderEngine.setupTexture(img, imgID);
- } catch (Exception e) {
- e.printStackTrace();
- }
- controlList.clear();
- tabs();
- switch(page){
- case 0:
- controlList.add(new GuiButton(1, width / 2 - 6, height / 2 + 20, 78, 20, "Make it Rain!"));
- controlList.add(new GuiButton(2, width / 2 - 90, height / 2 + 20, 78, 20, "Stop the Rain!"));
- break;
- case 1:
- controlList.add(disabled = new GuiButton(1, width / 2 - 90, height / 2 + 20, 160, 20, "Disabled"));
- disabled.drawButton = true;
- disabled.enabled = false;
- break;
- }
- }
- private void tabs() {
- controlList.add(new GuiButton(3, width / 2 - 91, height / 2 - 56, 40, 20, "Page 1"));
- controlList.add(new GuiButton(4, width / 2 - 51, height / 2 - 56, 40, 20, "Page 2"));
- controlList.add(new GuiButton(5, width / 2 - 11, height / 2 - 56, 40, 20, "Page 3"));
- controlList.add(new GuiButton(6, width / 2 + 29, height / 2 - 56, 40, 20, "Page 4"));
- }
- protected void actionPerformed(GuiButton guibutton)
- {
- if(guibutton.id == 1)
- {
- ModLoader.getMinecraftInstance().theWorld.setRainStrength(5F);
- ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Rain Started!");
- }
- if(guibutton.id == 2)
- {
- ModLoader.getMinecraftInstance().theWorld.setRainStrength(0F);
- ModLoader.getMinecraftInstance().thePlayer.addChatMessage("Rain Stopped!");
- }
- if(guibutton.id == 3)
- {
- page = 0;
- initGui();
- }
- if(guibutton.id == 4)
- {
- page = 1;
- initGui();
- }
- if(guibutton.id == 5)
- {
- page = 2;
- initGui();
- }
- if(guibutton.id == 6)
- {
- page = 3;
- initGui();
- }
- }
- public boolean doesGuiPauseGame()
- {
- return false;
- }
- public void drawScreen(int i, int j, float f)
- {
- drawDefaultBackground();
- int x = width / 2 - 95;
- int y = height / 2 - 60;
- try{
- int wtf = mc.renderEngine.getTexture("/mods/test1.png");
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- mc.renderEngine.bindTexture(wtf);
- drawTexturedModalRect(x, y, 0, 0, 176, 166);
- }
- finally {
- }
- GL11.glPushMatrix();
- GL11.glScalef(2.0F, 2.0F, 2.0F);
- drawCenteredString(fontRenderer, "Weather Controller", width / 4, height / 4 - 50, 0x44ff11);
- GL11.glPopMatrix();
- switch(page){
- case 0:
- drawString(fontRenderer, "Page 1", width / 2 - 90, height / 2 - 20, 0xCCCCCC);
- break;
- case 1:
- drawString(fontRenderer, "Page 2", width / 2 - 90, height / 2 - 20, 0xCCCCCC);
- break;
- case 2:
- drawString(fontRenderer, "Page 3", width / 2 - 90, height / 2 - 20, 0xCCCCCC);
- break;
- case 3:
- drawString(fontRenderer, "Page 4", width / 2 - 90, height / 2 - 20, 0xCCCCCC);
- break;
- }
- super.drawScreen(i, j, f);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement