-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename Config class and try-catch everything
- Loading branch information
1 parent
92da651
commit 7c73ef7
Showing
7 changed files
with
128 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 38 additions & 33 deletions
71
src/main/java/com/mathgeniuszach/moderninfo/BowChargeGui.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,53 @@ | ||
package com.mathgeniuszach.moderninfo; | ||
|
||
import com.mathgeniuszach.moderninfo.config.ModernInfoConfig; | ||
import com.mathgeniuszach.moderninfo.config.ConfigData; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.Gui; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
|
||
public class BowChargeGui extends Gui { | ||
public void render(int screenWidth, int screenHeight) { | ||
Minecraft mc = Minecraft.getMinecraft(); | ||
EntityPlayer player = mc.thePlayer; | ||
try { | ||
Minecraft mc = Minecraft.getMinecraft(); | ||
EntityPlayer player = mc.thePlayer; | ||
|
||
int i = player.getItemInUseDuration(); | ||
int i = player.getItemInUseDuration(); | ||
|
||
float f = (float)i / 20.0F; | ||
f = (f * f + f * 2.0F) / 3.0F; | ||
if (f < 0.0F) f = 0.0F; | ||
if (f > 1.0F) f = 1.0F; | ||
float f = (float)i / 20.0F; | ||
f = (f * f + f * 2.0F) / 3.0F; | ||
if (f < 0.0F) f = 0.0F; | ||
if (f > 1.0F) f = 1.0F; | ||
|
||
int color = ModernInfoConfig.defaultColor; | ||
if ((double)f < 0.1D) { | ||
// Bow will not shoot an arrow | ||
color = ModernInfoConfig.disabledColor; | ||
if (ModernInfoConfig.pullingOnly) return; | ||
} else if (f >= 1.0) { | ||
// Critical zone | ||
color = ModernInfoConfig.criticalColor; | ||
} | ||
int color = ConfigData.defaultColor; | ||
if ((double)f < 0.1D) { | ||
// Bow will not shoot an arrow | ||
color = ConfigData.disabledColor; | ||
if (ConfigData.pullingOnly) return; | ||
} else if (f >= 1.0) { | ||
// Critical zone | ||
color = ConfigData.criticalColor; | ||
} | ||
|
||
// Outer Rect | ||
drawRect( | ||
screenWidth/2-ModernInfoConfig.width/2-1+ModernInfoConfig.xOffset, | ||
screenHeight/2-1+ModernInfoConfig.yOffset, | ||
screenWidth/2+ModernInfoConfig.width/2+1+ModernInfoConfig.xOffset, | ||
screenHeight/2+ModernInfoConfig.height+1+ModernInfoConfig.yOffset, | ||
ModernInfoConfig.backgroundColor | ||
); | ||
// Inner Rect | ||
drawRect( | ||
screenWidth/2-ModernInfoConfig.width/2+ModernInfoConfig.xOffset, | ||
screenHeight/2+ModernInfoConfig.yOffset, | ||
screenWidth/2-ModernInfoConfig.width/2+ModernInfoConfig.xOffset+(int)(ModernInfoConfig.width*f), | ||
screenHeight/2+ModernInfoConfig.height+ModernInfoConfig.yOffset, | ||
color | ||
); | ||
// Outer Rect | ||
drawRect( | ||
screenWidth/2-ConfigData.width/2-1+ConfigData.xOffset, | ||
screenHeight/2-1+ConfigData.yOffset, | ||
screenWidth/2+ConfigData.width/2+1+ConfigData.xOffset, | ||
screenHeight/2+ConfigData.height+1+ConfigData.yOffset, | ||
ConfigData.backgroundColor | ||
); | ||
// Inner Rect | ||
drawRect( | ||
screenWidth/2-ConfigData.width/2+ConfigData.xOffset, | ||
screenHeight/2+ConfigData.yOffset, | ||
screenWidth/2-ConfigData.width/2+ConfigData.xOffset+(int)(ConfigData.width*f), | ||
screenHeight/2+ConfigData.height+ConfigData.yOffset, | ||
color | ||
); | ||
} catch (Exception e) { | ||
System.err.println("Error in BowChargeGui!!!"); | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters