Advertisement
ViiRuS

Basic Gui Template #2

Dec 21st, 2011
1,351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.32 KB | None | 0 0
  1. package net.minecraft.src;
  2.  
  3. public class GuiWhatever extends GuiScreen {
  4.     public GuiWhatever()
  5.     {
  6.     }
  7.    
  8.     public void initGui() {
  9.         controlList.clear();
  10.         controlList.add(new GuiButton(1, width / 2 + 2, height / 2 + 20, 98, 20, "Make it Rain"));
  11.         controlList.add(new GuiButton(2, width / 2 - 100, height / 2 + 20, 98, 20, "Stop the Rain"));
  12.  
  13.             }
  14.  
  15.     protected void actionPerformed(GuiButton guibutton)
  16.     {
  17.         if(guibutton.id == 1)
  18.         {
  19.             ModLoader.getMinecraftInstance().theWorld.setRainStrength(5F); 
  20.            
  21.         }
  22.         if(guibutton.id == 2)
  23.         {
  24.             ModLoader.getMinecraftInstance().theWorld.setRainStrength(0F); 
  25.    
  26.         }
  27.  
  28.     }    
  29.  
  30.     public boolean doesGuiPauseGame()
  31.     {
  32.         return false;
  33.     }
  34.    
  35.     public void onGuiClosed()
  36.     {
  37.    
  38.     }
  39.    
  40.     public void drawScreen(int i, int j, float f)
  41.     {
  42.         drawDefaultBackground();
  43.         drawGradientRect(20, 20, width - 20, height - 20, 0x60500000, 0xa0803030);
  44.         drawRect(60, 60, width - 60, height - 60, 0xFF0000FF);
  45.         drawString(fontRenderer, "Rain Controller",width / 2 - 100, height / 2 - 40 , 0xCCCCCC);
  46.         drawCenteredString(fontRenderer, "Weather Controller", width / 2, 45, 0xffffff);
  47.         super.drawScreen(i, j, f);
  48.     }
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement