Advertisement
Corosus

Untitled

Oct 23rd, 2012
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.74 KB | None | 0 0
  1. package weather.worldObjects;
  2.  
  3. import net.minecraft.src.GuiButton;
  4. import net.minecraft.src.GuiScreen;
  5. import net.minecraftforge.common.Configuration;
  6.  
  7. import org.lwjgl.opengl.GL11;
  8.  
  9. import weather.ExtendedRenderer;
  10. import weather.ServerTickHandler;
  11. import weather.WeatherMod;
  12. import weather.storm.StormManager;
  13.  
  14. import cpw.mods.fml.common.FMLCommonHandler;
  15.  
  16. public class GuiWeatherCP extends GuiScreen
  17. {
  18.     private int updateCounter2 = 0;
  19.     private int updateCounter = 0;
  20.     private int inventoryRows = 0;
  21.  
  22.     private int ySize;
  23.     private int xSize;
  24.     private int xOffset;
  25.  
  26.     private static int G_RAIN = 0;
  27.     private static int G_SPAWNTORNADO = 1;
  28.     private static int G_SPAWNSTORM = 2;
  29.     private static int G_PREVSTAGE = 3;
  30.     private static int G_NEXTSTAGE = 4;
  31.     private static int G_TOGGLEWAVERANGE = 5;
  32.     private static int G_TOGGLEWAVEHEIGHT = 6;
  33.     private static int G_2 = 9;
  34.     private static int G_DEBUG = 8;
  35.     private static int G_CLOSE = 9;
  36.    
  37.  
  38.     //container additions \\
  39.  
  40.     protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3)
  41.     {
  42.         //inventoryRows = 5;
  43.         if (mc == null)
  44.         {
  45.             return;
  46.         }
  47.  
  48.         int var4 = this.mc.renderEngine.getTexture("/coro/weather/weatherGui.png");
  49.         GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  50.         this.mc.renderEngine.bindTexture(var4);
  51.         int var5 = (this.width - this.xSize) / 2;
  52.         int var6 = (this.height - this.ySize) / 2;
  53.         this.drawTexturedModalRect(var5 + xOffset, var6, 0, 0, this.xSize, ySize);
  54.         //this.drawTexturedModalRect(var5, var6 + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96);
  55.         this.drawCenteredString(this.fontRenderer, "Weather Menu", ((this.width - this.xSize) / 2) + xOffset + 45, var6 - 10, 16777215);
  56.     }
  57.  
  58.     // end container additions //
  59.  
  60.     public boolean doesGuiPauseGame()
  61.     {
  62.         return false;
  63.     }
  64.  
  65.     public void initGui()
  66.     {
  67.         xSize = 176;
  68.         ySize = 200;
  69.         xOffset = (int)(this.width / 4 * 1.92);
  70.         this.updateCounter2 = 0;
  71.         this.controlList.clear();
  72.         byte var1 = -16;
  73.         int startX = ((this.width - this.xSize) / 2) + xOffset + 6;
  74.         int startY = (this.height - this.ySize) / 2 + 23;
  75.         int div = 22;
  76.         this.controlList.add(new GuiButton(G_RAIN, startX, startY + 0 + var1, 90, 20, "Particle Rain"));
  77.         this.controlList.add(new GuiButton(G_TOGGLEWAVERANGE, startX, startY + div * 1 + var1, 90, 20, "Set Wave Range"));
  78.         if (FMLCommonHandler.instance().getMinecraftServerInstance() != null) {
  79.             this.controlList.add(new GuiButton(G_TOGGLEWAVEHEIGHT, startX, startY + div * 2 + var1, 90, 20, "Set Wave Height"));
  80.         }
  81.         //this.controlList.add(new GuiButton(G_SPAWNTORNADO, startX, startY + div * 1 + var1, 90, 20, "Force Tornado"));
  82.         //this.controlList.add(new GuiButton(G_SPAWNSTORM, startX, startY + div * 2 + var1, 90, 20, "Spawn Storm"));
  83.         //this.controlList.add(new GuiButton(G_PREVSTAGE, startX, startY + div * 3 + var1, 90, 20, "Prev Stage"));
  84.         //this.controlList.add(new GuiButton(G_NEXTSTAGE, startX, startY + div * 4 + var1, 90, 20, "Next Stage"));
  85.         this.controlList.add(new GuiButton(G_DEBUG, startX, startY + div * 5 + var1, 90, 20, "Debug Info"));
  86.         this.controlList.add(new GuiButton(G_CLOSE, startX, startY + div * 6 + var1, 90, 20, "Close"));
  87.     }
  88.  
  89.     protected void actionPerformed(GuiButton var1)
  90.     {
  91.         if (var1.id == G_RAIN)
  92.         {
  93.             ExtendedRenderer.smoothRain = !ExtendedRenderer.smoothRain;
  94.         }
  95.  
  96.         if (var1.id == G_DEBUG)
  97.         {
  98.             WeatherMod.showWeatherInfo = !WeatherMod.showWeatherInfo;
  99.         }
  100.  
  101.         if (var1.id == G_PREVSTAGE)
  102.         {
  103.             WeatherMod.stormMan.prevStage();
  104.         }
  105.  
  106.         if (var1.id == G_NEXTSTAGE)
  107.         {
  108.             WeatherMod.stormMan.nextStage();
  109.         }
  110.  
  111.         if (var1.id == G_SPAWNTORNADO)
  112.         {
  113.             //mod_EntMover.t_SpawnTornado = true;
  114.             WeatherMod.t_trySpawnTornado = true;
  115.         }
  116.        
  117.         if (var1.id == G_TOGGLEWAVERANGE)
  118.         {
  119.             WeatherMod.waveRenderRange += 20;
  120.             if (WeatherMod.waveRenderRange > 150) {
  121.                 WeatherMod.waveRenderRange = 0;
  122.             }
  123.             //cant save out D:
  124.             //WeatherMod.preInitConfig.getOrCreateIntProperty("waveRenderRange", Configuration.CATEGORY_GENERAL, WeatherMod.waveRenderRange).getInt();
  125.             //WeatherMod.preInitConfig.save();
  126.         }
  127.        
  128.         if (var1.id == G_TOGGLEWAVEHEIGHT)
  129.         {
  130.             if (ServerTickHandler.sMans != null) {
  131.                 for (int i = 0; i < ServerTickHandler.sMans.size(); i++) {
  132.                     StormManager sMan = ServerTickHandler.sMans.get(i);
  133.                    
  134.                     sMan.baseWaveHeight += 1;
  135.                     if (sMan.baseWaveHeight > 15) {
  136.                         sMan.baseWaveHeight = 1;
  137.                     }
  138.                    
  139.                     //syncing
  140.                     WeatherMod.stormMan.baseWaveHeight = sMan.baseWaveHeight;
  141.                 }
  142.             }
  143.         }
  144.  
  145.         if (var1.id == G_SPAWNSTORM)
  146.         {
  147.             WeatherMod.spawnStorm();
  148.         }
  149.  
  150.         if (var1.id == G_CLOSE)
  151.         {
  152.             this.mc.displayGuiScreen((GuiScreen)null);
  153.             this.mc.setIngameFocus();
  154.         }
  155.     }
  156.  
  157.     public void updateScreen()
  158.     {
  159.         super.updateScreen();
  160.         ++this.updateCounter;
  161.     }
  162.  
  163.     public void drawScreen(int var1, int var2, float var3)
  164.     {
  165.         //this.drawDefaultBackground();
  166.         drawGuiContainerBackgroundLayer(0, 0, 0);
  167.         WeatherMod.proxy.weatherDbg();
  168.         WeatherMod.proxy.windDbg();
  169.         super.drawScreen(var1, var2, var3);
  170.     }
  171. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement