├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── src └── main │ ├── resources │ ├── version.properties │ ├── assets │ │ └── statuseffecthud │ │ │ ├── pack.mcmeta │ │ │ └── lang │ │ │ ├── cs_CZ.lang │ │ │ ├── en_US.lang │ │ │ └── pl_PL.lang │ ├── mcmod.info │ └── LICENSE │ └── java │ └── bspkrs │ └── statuseffecthud │ ├── fml │ ├── ForgeEventHandler.java │ ├── Reference.java │ ├── gui │ │ ├── GuiSEHConfig.java │ │ └── ModGuiFactoryHandler.java │ ├── CommonProxy.java │ ├── StatusEffectHUDMod.java │ ├── SEHGameTicker.java │ ├── ClientProxy.java │ └── SEHRenderTicker.java │ ├── CommandStatusEffect.java │ ├── ConfigElement.java │ └── StatusEffectHUD.java ├── gradlew.bat ├── change.log ├── gradlew └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /.settings/ 2 | /bin/ 3 | /release/ 4 | /build/ 5 | /.gradle/ 6 | /run/ 7 | .project 8 | .classpath -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bspkrs/StatusEffectHUD/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/version.properties: -------------------------------------------------------------------------------- 1 | version.mod=${mod_version} 2 | version.forge=${forge_version} 3 | version.minecraft=${minecraft_version} -------------------------------------------------------------------------------- /src/main/java/bspkrs/statuseffecthud/fml/ForgeEventHandler.java: -------------------------------------------------------------------------------- 1 | package bspkrs.statuseffecthud.fml; 2 | 3 | public class ForgeEventHandler 4 | {} 5 | -------------------------------------------------------------------------------- /src/main/resources/assets/statuseffecthud/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "pack_format": 1, 4 | "description": "StatusEffectHUD" 5 | } 6 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Jul 02 15:54:47 CDT 2014 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip 7 | -------------------------------------------------------------------------------- /src/main/java/bspkrs/statuseffecthud/fml/Reference.java: -------------------------------------------------------------------------------- 1 | package bspkrs.statuseffecthud.fml; 2 | 3 | import net.minecraftforge.common.config.Configuration; 4 | 5 | public class Reference 6 | { 7 | public static final String MODID = "StatusEffectHUD"; 8 | public static final String NAME = "StatusEffectHUD"; 9 | public static final String PROXY_COMMON = "bspkrs.statuseffecthud.fml.CommonProxy"; 10 | public static final String PROXY_CLIENT = "bspkrs.statuseffecthud.fml.ClientProxy"; 11 | public static final String GUI_FACTORY = "bspkrs.statuseffecthud.fml.gui.ModGuiFactoryHandler"; 12 | 13 | public static Configuration config = null; 14 | } -------------------------------------------------------------------------------- /src/main/java/bspkrs/statuseffecthud/fml/gui/GuiSEHConfig.java: -------------------------------------------------------------------------------- 1 | package bspkrs.statuseffecthud.fml.gui; 2 | 3 | import net.minecraft.client.gui.GuiScreen; 4 | import net.minecraftforge.common.config.ConfigElement; 5 | import net.minecraftforge.common.config.Configuration; 6 | import net.minecraftforge.fml.client.config.GuiConfig; 7 | import bspkrs.statuseffecthud.fml.Reference; 8 | 9 | public class GuiSEHConfig extends GuiConfig 10 | { 11 | public GuiSEHConfig(GuiScreen parent) 12 | { 13 | super(parent, (new ConfigElement(Reference.config.getCategory(Configuration.CATEGORY_GENERAL))).getChildElements(), 14 | Reference.MODID, false, false, GuiConfig.getAbridgedConfigPath(Reference.config.toString())); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | { 2 | "modListVersion": 2, 3 | "modList": [{ 4 | "modid": "StatusEffectHUD", 5 | "name": "StatusEffectHUD", 6 | "description": "Shows active player effects (potions, etc) without opening your inventory!", 7 | "version": "${mod_version}", 8 | "mcversion": "${minecraft_version}", 9 | "url": "http://www.minecraftforum.net/topic/1114612-/", 10 | "updateUrl": "", 11 | "authorList": [ "bspkrs" ], 12 | "credits": "", 13 | "logoFile": "", 14 | "screenshots": [ ], 15 | "parent": "", 16 | "requiredMods": [ "bspkrsCore@[${bscore_version},)" ], 17 | "dependencies": [ "bspkrsCore@[${bscore_version},)" ], 18 | "dependants": [ ], 19 | "useDependencyInformation": "true" 20 | }] 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/bspkrs/statuseffecthud/fml/gui/ModGuiFactoryHandler.java: -------------------------------------------------------------------------------- 1 | package bspkrs.statuseffecthud.fml.gui; 2 | 3 | import java.util.Set; 4 | 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraft.client.gui.GuiScreen; 7 | import net.minecraftforge.fml.client.IModGuiFactory; 8 | 9 | public class ModGuiFactoryHandler implements IModGuiFactory 10 | { 11 | @Override 12 | public void initialize(Minecraft minecraftInstance) 13 | { 14 | 15 | } 16 | 17 | @Override 18 | public Class mainConfigGuiClass() 19 | { 20 | return GuiSEHConfig.class; 21 | } 22 | 23 | @Override 24 | public Set runtimeGuiCategories() 25 | { 26 | return null; 27 | } 28 | 29 | @Override 30 | public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) 31 | { 32 | return null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/bspkrs/statuseffecthud/fml/CommonProxy.java: -------------------------------------------------------------------------------- 1 | package bspkrs.statuseffecthud.fml; 2 | 3 | import org.apache.logging.log4j.Level; 4 | 5 | import net.minecraftforge.fml.common.FMLLog; 6 | import net.minecraftforge.fml.common.event.FMLInitializationEvent; 7 | import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; 8 | 9 | public class CommonProxy 10 | { 11 | public void preInit(FMLPreInitializationEvent event) 12 | {} 13 | 14 | public void init(FMLInitializationEvent event) 15 | { 16 | FMLLog.log("StatusEffectHUD", Level.ERROR, "************************************************************************************"); 17 | FMLLog.log("StatusEffectHUD", Level.ERROR, "* StatusEffectHUD is a CLIENT-ONLY mod. Installing it on your server is pointless. *"); 18 | FMLLog.log("StatusEffectHUD", Level.ERROR, "************************************************************************************"); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/bspkrs/statuseffecthud/CommandStatusEffect.java: -------------------------------------------------------------------------------- 1 | package bspkrs.statuseffecthud; 2 | 3 | import net.minecraft.command.CommandBase; 4 | import net.minecraft.command.ICommandSender; 5 | import bspkrs.fml.util.DelayedGuiDisplayTicker; 6 | import bspkrs.statuseffecthud.fml.gui.GuiSEHConfig; 7 | 8 | public class CommandStatusEffect extends CommandBase 9 | { 10 | @Override 11 | public String getCommandName() 12 | { 13 | return "statuseffect"; 14 | } 15 | 16 | @Override 17 | public String getCommandUsage(ICommandSender var1) 18 | { 19 | return "commands.statuseffect.usage"; 20 | } 21 | 22 | @Override 23 | public boolean canCommandSenderUseCommand(ICommandSender par1ICommandSender) 24 | { 25 | return true; 26 | } 27 | 28 | @Override 29 | public int getRequiredPermissionLevel() 30 | { 31 | return 1; 32 | } 33 | 34 | @Override 35 | public void processCommand(ICommandSender var1, String[] var2) 36 | { 37 | try 38 | { 39 | new DelayedGuiDisplayTicker(10, new GuiSEHConfig(null)); 40 | } 41 | catch (Throwable e) 42 | { 43 | e.printStackTrace(); 44 | } 45 | } 46 | 47 | @Override 48 | public int compareTo(Object object) 49 | { 50 | if (object instanceof CommandBase) 51 | return this.getCommandName().compareTo(((CommandBase) object).getCommandName()); 52 | 53 | return 0; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/resources/LICENSE: -------------------------------------------------------------------------------- 1 | Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) 2 | https://creativecommons.org/licenses/by-nc-sa/3.0/ 3 | 4 | You are free: 5 | 6 | to Share - to copy, distribute and transmit the work 7 | to Remix - to adapt the work 8 | 9 | Under the following conditions: 10 | 11 | Attribution - You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). 12 | 13 | Noncommercial - You may not use this work for commercial purposes. 14 | 15 | Share Alike - If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. 16 | 17 | With the understanding that: 18 | 19 | Waiver - Any of the above conditions can be waived if you get permission from the copyright holder. 20 | Public Domain - Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license. 21 | Other Rights - In no way are any of the following rights affected by the license: 22 | Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; 23 | The author's moral rights; 24 | Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights. 25 | Notice - For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page. 26 | -------------------------------------------------------------------------------- /src/main/java/bspkrs/statuseffecthud/fml/StatusEffectHUDMod.java: -------------------------------------------------------------------------------- 1 | package bspkrs.statuseffecthud.fml; 2 | 3 | import bspkrs.util.Const; 4 | import bspkrs.util.ModVersionChecker; 5 | import net.minecraftforge.fml.common.Mod; 6 | import net.minecraftforge.fml.common.Mod.EventHandler; 7 | import net.minecraftforge.fml.common.Mod.Instance; 8 | import net.minecraftforge.fml.common.Mod.Metadata; 9 | import net.minecraftforge.fml.common.ModMetadata; 10 | import net.minecraftforge.fml.common.SidedProxy; 11 | import net.minecraftforge.fml.common.event.FMLInitializationEvent; 12 | import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; 13 | 14 | @Mod(modid = Reference.MODID, name = Reference.NAME, version = "@MOD_VERSION@", dependencies = "required-after:bspkrsCore@[@BSCORE_VERSION@,)", 15 | useMetadata = true, guiFactory = Reference.GUI_FACTORY) 16 | public class StatusEffectHUDMod 17 | { 18 | protected ModVersionChecker versionChecker; 19 | protected final String versionURL = Const.VERSION_URL + "/Minecraft/" + Const.MCVERSION + "/statusEffectHUD.version"; 20 | protected final String mcfTopic = "http://www.minecraftforum.net/topic/1114612-"; 21 | 22 | @Metadata(value = Reference.MODID) 23 | public static ModMetadata metadata; 24 | 25 | @Instance(value = Reference.MODID) 26 | public static StatusEffectHUDMod instance; 27 | 28 | @SidedProxy(clientSide = Reference.PROXY_CLIENT, serverSide = Reference.PROXY_COMMON) 29 | public static CommonProxy proxy; 30 | 31 | @EventHandler 32 | public void preInit(FMLPreInitializationEvent event) 33 | { 34 | metadata = event.getModMetadata(); 35 | proxy.preInit(event); 36 | } 37 | 38 | @EventHandler 39 | public void init(FMLInitializationEvent event) 40 | { 41 | proxy.init(event); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/bspkrs/statuseffecthud/fml/SEHGameTicker.java: -------------------------------------------------------------------------------- 1 | package bspkrs.statuseffecthud.fml; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.util.ChatComponentText; 5 | import bspkrs.bspkrscore.fml.bspkrsCoreMod; 6 | import net.minecraftforge.fml.common.FMLCommonHandler; 7 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 8 | import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; 9 | import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; 10 | import net.minecraftforge.fml.relauncher.Side; 11 | import net.minecraftforge.fml.relauncher.SideOnly; 12 | 13 | @SideOnly(Side.CLIENT) 14 | public class SEHGameTicker 15 | { 16 | private Minecraft mc; 17 | private static boolean isRegistered = false; 18 | 19 | public SEHGameTicker() 20 | { 21 | isRegistered = true; 22 | mc = Minecraft.getMinecraft(); 23 | } 24 | 25 | @SubscribeEvent 26 | public void onTick(ClientTickEvent event) 27 | { 28 | if (event.phase.equals(Phase.START)) 29 | return; 30 | 31 | boolean keepTicking = !(mc != null && mc.thePlayer != null && mc.theWorld != null); 32 | 33 | if (!keepTicking && isRegistered) 34 | { 35 | if (bspkrsCoreMod.instance.allowUpdateCheck && StatusEffectHUDMod.instance.versionChecker != null) 36 | if (!StatusEffectHUDMod.instance.versionChecker.isCurrentVersion()) 37 | for (String msg : StatusEffectHUDMod.instance.versionChecker.getInGameMessage()) 38 | mc.thePlayer.addChatMessage(new ChatComponentText(msg)); 39 | 40 | FMLCommonHandler.instance().bus().unregister(this); 41 | isRegistered = false; 42 | } 43 | } 44 | 45 | public static boolean isRegistered() 46 | { 47 | return isRegistered; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/bspkrs/statuseffecthud/fml/ClientProxy.java: -------------------------------------------------------------------------------- 1 | package bspkrs.statuseffecthud.fml; 2 | 3 | import net.minecraftforge.client.ClientCommandHandler; 4 | import bspkrs.bspkrscore.fml.bspkrsCoreMod; 5 | import bspkrs.statuseffecthud.CommandStatusEffect; 6 | import bspkrs.statuseffecthud.StatusEffectHUD; 7 | import bspkrs.util.ModVersionChecker; 8 | import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent; 9 | import net.minecraftforge.fml.common.FMLCommonHandler; 10 | import net.minecraftforge.fml.common.event.FMLInitializationEvent; 11 | import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; 12 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 13 | 14 | public class ClientProxy extends CommonProxy 15 | { 16 | @Override 17 | public void preInit(FMLPreInitializationEvent event) 18 | { 19 | StatusEffectHUD.initConfig(event.getSuggestedConfigurationFile()); 20 | } 21 | 22 | @Override 23 | public void init(FMLInitializationEvent event) 24 | { 25 | FMLCommonHandler.instance().bus().register(new SEHGameTicker()); 26 | FMLCommonHandler.instance().bus().register(new SEHRenderTicker()); 27 | 28 | ClientCommandHandler.instance.registerCommand(new CommandStatusEffect()); 29 | 30 | FMLCommonHandler.instance().bus().register(this); 31 | 32 | if (bspkrsCoreMod.instance.allowUpdateCheck) 33 | { 34 | StatusEffectHUDMod.instance.versionChecker = new ModVersionChecker(Reference.MODID, 35 | StatusEffectHUDMod.metadata.version, StatusEffectHUDMod.instance.versionURL, StatusEffectHUDMod.instance.mcfTopic); 36 | StatusEffectHUDMod.instance.versionChecker.checkVersionWithLogging(); 37 | } 38 | } 39 | 40 | @SubscribeEvent 41 | public void onConfigChanged(OnConfigChangedEvent event) 42 | { 43 | if (event.modID.equals(Reference.MODID)) 44 | { 45 | Reference.config.save(); 46 | StatusEffectHUD.syncConfig(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /change.log: -------------------------------------------------------------------------------- 1 | 1.27 - 06-Mar-2015 2 | - 1.8 update 3 | 1.27 - 11-Nov-2014 4 | - removed dropbox URLs 5 | 1.26 - 30-Jun-2014 6 | - initial 1.7.10 update 7 | 1.25 - 23-May-2014 8 | - added new option to disable the vanilla status effect view on the inventory screen 9 | - added support for ConfigChangedEvent 10 | - added proper dependency versioning 11 | - mod will no longer crash on the server, but will display a log warning 12 | 1.24 - 22-Apr-2014 13 | - fixed flickering when playerlist is shown 14 | 1.23 - 18-Apr-2014 15 | - added tooltip localizations 16 | 1.22 - 13-Apr-2014 17 | - added in-game config gui stuff (command /statuseffect config) 18 | 1.21 - 24-Jan-2014 19 | - added isEnabled control 20 | 1.20 - 19-Jan-2014 21 | - updated for 1.7.2 22 | 1.19 - 21-Oct-2013 23 | - fixed min values for offsets 24 | 1.18 - 17-Oct-2013 25 | - ported existing code to Forge 26 | 1.17 - 05-Oct-2013 27 | - fixed potential concurrent modification exception 28 | 1.16 - 29-Sep-2013 29 | - added code to prevent blinking if the max duration is less than 20 seconds 30 | 1.15 - 26-Sep-2013 31 | - added blinking effect when a potion is almost gone (2 new options) 32 | 1.14 - 17-Jul-2013 33 | - fixed background covering up the text 34 | - 1.6.4 update 20-Sep-2013 35 | 1.13 - 10-Jul-2013 36 | - hopefully fixed ModLoader issues 37 | 1.12 - 09-Jul-2013 38 | - update update 39 | - 1.6.2 update 10-Jul-2013 40 | 1.11 - 05-Jul-2013 41 | - updated to 1.6.1 42 | 1.10 - 24-Apr-2013 43 | - addressed potential issue from mods that don't clean up their texture bindings 44 | - new config handler 45 | - updated to 1.5.2 03-May-2013 46 | 1.9 - 20-Feb-2013 47 | - updated to support bspkrsCore 48 | - updated to 1.5 15-Mar-2013 49 | - updated to 1.5.1 23-Mar-2013 50 | 1.8 - 24-Jan-2013 51 | - added reset code to end of all drawn text 52 | 1.7 - 01-Nov-2012 53 | - fixed Forge/FML compatibility 54 | - updated for 1.4.5 21-Nov-2012 55 | - updated to 1.4.6 23-Dec-2012 56 | 1.6 - 26-Oct-2012 57 | - initial update to 1.4.2 58 | 1.52(1.2.5) - 06-Oct-2012 59 | - retrofitted v1.52 to 1.2.5 60 | 1.52 - 04-Oct-2012 61 | - compatibility update 62 | 1.51 - 17-Sep-2012 63 | - compatibility update 64 | 1.5 - 13-Sep-2012 65 | - added x and y offset options 66 | - switched to shared version checking 67 | - made icons appear on the right when right-aligned 68 | - background is now disabled by default 69 | - text colors are now configurable 70 | 1.4 - 27-Aug-2012 71 | - added config option to allow/disallow version checking 72 | - now includes mcmod.info file 73 | 1.3 - 19-Aug-2012 74 | - updated for 1.3.2. 75 | 1.2 - 05-Aug-2012 76 | - updated for 1.3.1. 77 | - added version checking. 78 | 1.12 - 29-Mar-2012 79 | - YO DAWG, I heard you like stupid mistake fixes, so I put a stupid mistake fix out for my stupid mistake fix so the stupid mistake fix will be fixed. 80 | 1.11 - 27-Mar-2012 81 | - fixed stupid mistake when updating from 1.2.3 to 1.2.4 that caused the text to render without the shadow 82 | 1.1 - 24-Mar-2012 83 | - option to show/hide effect names 84 | - option to show/hide background box 85 | 1.0 - 23-Mar-2012 86 | - Initial release -------------------------------------------------------------------------------- /src/main/resources/assets/statuseffecthud/lang/cs_CZ.lang: -------------------------------------------------------------------------------- 1 | bspkrs.seh.configgui.alignMode.tooltip=Nastaví pozici HUDu na obrazovce. Správné poziční řetězce jsou topleft, topcenter, topright, middleleft, middlecenter, middleright, bottomleft, bottomcenter, bottomright. 2 | bspkrs.seh.configgui.alignMode=HUD pozice 3 | bspkrs.seh.configgui.applyXOffsetToCenter.tooltip=Nastav na true pokud chceš aby xOfsetová hodnota byla nastavena s použitím zarovnání na střed (x&y). 4 | bspkrs.seh.configgui.applyXOffsetToCenter=Použít vodorovný ofset na střed 5 | bspkrs.seh.configgui.applyYOffsetToMiddle.tooltip=Nastav na true pokud chceš aby yOfsetová hodnota byla nastavena s použitím zarovnání na prostředek (x). 6 | bspkrs.seh.configgui.applyYOffsetToMiddle=Použít svislý ofset na prostředek 7 | bspkrs.seh.configgui.disableInventoryEffectList.tooltip=Nastav na true pro zakázání seznamu efektů z vanilly při otevřeném inventáři, false pro povolení zobrazení z vanilly. 8 | bspkrs.seh.configgui.disableInventoryEffectList=Zakázat vanilla seznam efektů 9 | bspkrs.seh.configgui.durationBlinkSeconds.tooltip=Když lektvar/efekt má toto množství zbývajících sekund, časovač začne blikat. Nastav -1 pro zakázání blikání. 10 | bspkrs.seh.configgui.durationBlinkSeconds=# sekund do blikání textu/ikony 11 | bspkrs.seh.configgui.durationColor.tooltip=Správné hodnoty barev jsou 0-9, a-f. 12 | bspkrs.seh.configgui.durationColor=Barva textu časovače 13 | bspkrs.seh.configgui.effectNameColor.tooltip=Správné hodnoty barev jsou 0-9, a-f. 14 | bspkrs.seh.configgui.effectNameColor=Barva jména efektu 15 | bspkrs.seh.configgui.enableBackground.tooltip=Nastav na true pro zobrazení rámečku efektu na pozadí, false pro zakánání.. 16 | bspkrs.seh.configgui.enableBackground=Zobrazit rámeček na pozadí 17 | bspkrs.seh.configgui.enableEffectName.tooltip=Nastav na true pro zobrazení jmen efektů, false pro zakázání. 18 | bspkrs.seh.configgui.enableEffectName=Zobrazit jméno efektu 19 | bspkrs.seh.configgui.enableIconBlink.tooltip=Nastav na true pro povolení blikání ikony, když lektvar/efekt už bude končit, false pro zakázání. 20 | bspkrs.seh.configgui.enableIconBlink=Blikající ikona při konci efektu 21 | bspkrs.seh.configgui.enabled.tooltip=Povoluje nebo zakazuje zobrazení HUD statusu brnění. 22 | bspkrs.seh.configgui.enabled=Povoleno 23 | bspkrs.seh.configgui.listMode.tooltip= 24 | bspkrs.seh.configgui.listMode=HUD rozhraní 25 | bspkrs.seh.configgui.showInChat.tooltip=Nastav na true pro zobrazení informace když je otevřený chat, false pro zakázání informací při otevřeném chatu. 26 | bspkrs.seh.configgui.showInChat=Zobrazit když je chat otevřený 27 | bspkrs.seh.configgui.xOffset.tooltip=Vodorovný ofset od hrany obrazovky (pokud jsou použity pravá zarovnání, pak x ofset je úměrný k pravé hraně obrazovky). 28 | bspkrs.seh.configgui.xOffset=Vodorovný HUD ofset 29 | bspkrs.seh.configgui.yOffset.tooltip=Svislý ofset od hrany obrazovky (pokud jsou použity spodní zarovnání, pak y ofset jeúměrný ke spodní hraně obrazovky). 30 | bspkrs.seh.configgui.yOffset=Svislý HUD ofset 31 | bspkrs.seh.configgui.yOffsetBottomCenter.tooltip=Svislý ofset použitý pouze pro spodně-střední zarovnání pro vyhnutí se vanilla HUDu. 32 | bspkrs.seh.configgui.yOffsetBottomCenter=Spodně-střední svislý HUD ofset 33 | -------------------------------------------------------------------------------- /src/main/resources/assets/statuseffecthud/lang/en_US.lang: -------------------------------------------------------------------------------- 1 | bspkrs.seh.configgui.alignMode.tooltip=Sets the position of the HUD on the screen. Valid alignment strings are topleft, topcenter, topright, middleleft, middlecenter, middleright, bottomleft, bottomcenter, bottomright. 2 | bspkrs.seh.configgui.alignMode=HUD Position 3 | bspkrs.seh.configgui.applyXOffsetToCenter.tooltip=Set to true if you want the xOffset value to be applied when using a center alignment. 4 | bspkrs.seh.configgui.applyXOffsetToCenter=Apply Horizontal Offset to Center 5 | bspkrs.seh.configgui.applyYOffsetToMiddle.tooltip=Set to true if you want the yOffset value to be applied when using a middle alignment. 6 | bspkrs.seh.configgui.applyYOffsetToMiddle=Apply Vertical Offset to Middle 7 | bspkrs.seh.configgui.disableInventoryEffectList.tooltip=Set to true to disable the vanilla status effect list shown when your inventory is open, false to allow vanilla inventory behavior. 8 | bspkrs.seh.configgui.disableInventoryEffectList=Disable Inv. Effect List 9 | bspkrs.seh.configgui.durationBlinkSeconds.tooltip=When a potion/effect has this many seconds remaining the timer will begin to blink. Set to -1 to disable blinking. 10 | bspkrs.seh.configgui.durationBlinkSeconds=# of Seconds to Blink Text/Icon 11 | bspkrs.seh.configgui.durationColor.tooltip=Valid color values are 0-9, a-f. 12 | bspkrs.seh.configgui.durationColor=Timer Text Color 13 | bspkrs.seh.configgui.effectNameColor.tooltip=Valid color values are 0-9, a-f. 14 | bspkrs.seh.configgui.effectNameColor=Effect Name Color 15 | bspkrs.seh.configgui.enableBackground.tooltip=Set to true to see the effect background box, false to disable. 16 | bspkrs.seh.configgui.enableBackground=Show Background Box 17 | bspkrs.seh.configgui.enableEffectName.tooltip=Set to true to show effect names, false to disable. 18 | bspkrs.seh.configgui.enableEffectName=Show Effect Name 19 | bspkrs.seh.configgui.enableIconBlink.tooltip=Set to true to enable blinking for the icon when a potion/effect is nearly gone, false to disable. 20 | bspkrs.seh.configgui.enableIconBlink=Also Blink Icon when Nearly Gone 21 | bspkrs.seh.configgui.enabled.tooltip=Enables or disables the Status Effect HUD display. 22 | bspkrs.seh.configgui.enabled=Enabled 23 | bspkrs.seh.configgui.listMode.tooltip= 24 | bspkrs.seh.configgui.listMode=HUD Layout 25 | bspkrs.seh.configgui.showInChat.tooltip=Set to true to show info when chat is open, false to disable info when chat is open. 26 | bspkrs.seh.configgui.showInChat=Show While Chat is Open 27 | bspkrs.seh.configgui.xOffset.tooltip=Horizontal offset from the edge of the screen (when using right alignments the x offset is relative to the right edge of the screen). 28 | bspkrs.seh.configgui.xOffset=Horizontal HUD Offset 29 | bspkrs.seh.configgui.yOffset.tooltip=Vertical offset from the edge of the screen (when using bottom alignments the y offset is relative to the bottom edge of the screen). 30 | bspkrs.seh.configgui.yOffset=Vertical HUD Offset 31 | bspkrs.seh.configgui.yOffsetBottomCenter.tooltip=Vertical offset used only for the bottomcenter alignment to avoid the vanilla HUD. 32 | bspkrs.seh.configgui.yOffsetBottomCenter=Bottom Center Vertical HUD Offset 33 | commands.statuseffect.usage=statuseffect config 34 | -------------------------------------------------------------------------------- /src/main/resources/assets/statuseffecthud/lang/pl_PL.lang: -------------------------------------------------------------------------------- 1 | bspkrs.seh.configgui.alignMode.tooltip=Ustawia pozycję HUDa na ekaranie. Poprawne wartości to: topleft, topcenter, topright, middleleft, middlecenter, middleright, bottomleft, bottomcenter, bottomright (lewa góra, środkowa góra, prawa góra, lewy środek, środkowy środek, środkowa prawa, łewa dolna, środkowa dolna, prawa dolna). 2 | bspkrs.seh.configgui.alignMode=Pozycja HUDa 3 | bspkrs.seh.configgui.applyXOffsetToCenter.tooltip=Ustaw na 'true' jeśli chcesz, by wartość `xOffset` była aplikowana używając wyrównania środka. 4 | bspkrs.seh.configgui.applyXOffsetToCenter=Aplikuj przesunięcie poziome do połowy 5 | bspkrs.seh.configgui.applyYOffsetToMiddle.tooltip=Ustaw na 'true' jeśli chcesz, by wartość `yOffset` była aplikowana używając wyrównania środka. 6 | bspkrs.seh.configgui.applyYOffsetToMiddle=Aplikuj przesunięcie pionowe do połowy 7 | bspkrs.seh.configgui.disableInventoryEffectList.tooltip=Ustaw na 'true' by wyłączyć Minecraftową listę efeków statusu pokazywaną gdy ekwipunek jest otwarty, 'false' by zezwolić na domyślne Minecraft'owe zachowanie. 8 | bspkrs.seh.configgui.disableInventoryEffectList=Wyłącz listę efektów w ekwipunku 9 | bspkrs.seh.configgui.durationBlinkSeconds.tooltip=Gdy miksturze/efektowi pozostaje tyle sekund, timer zacznie mrugać. Ustaw na '-1' by wyłączyć mruganie. 10 | bspkrs.seh.configgui.durationBlinkSeconds=Ilość sekund do mrugania tekstu/ikony 11 | bspkrs.seh.configgui.durationColor.tooltip=Poprawne wartości kolorów to '0'-'9', 'a'-'f'. 12 | bspkrs.seh.configgui.durationColor=Kolor nazwy timera 13 | bspkrs.seh.configgui.effectNameColor.tooltip=Poprawne wartości kolorów to '0'-'9', 'a'-'f'. 14 | bspkrs.seh.configgui.effectNameColor=Kolor nazwy efektu 15 | bspkrs.seh.configgui.enableBackground.tooltip=Ustaw na 'true' by by pokazywać pudełko efektów w tle, 'false' by wyłączyć. 16 | bspkrs.seh.configgui.enableBackground=Pokaż podełko w tle 17 | bspkrs.seh.configgui.enableEffectName.tooltip=Ustaw na 'true' by pokazywać nazwy efektów, 'false' by wyłączyć. 18 | bspkrs.seh.configgui.enableEffectName=Pokaż nazwę efektu 19 | bspkrs.seh.configgui.enableIconBlink.tooltip=Ustaw na 'true' by włączyć mruganie ikony gdy mikstura/efekt jest prawie skoŃczony, 'false' wy byłączyć. 20 | bspkrs.seh.configgui.enableIconBlink=Również mrugaj ikoną gdy przwie skończone 21 | bspkrs.seh.configgui.enabled.tooltip=Włącza lub wyłącza warstwę efektów statusu na HUD'zie. 22 | bspkrs.seh.configgui.enabled=Włączone 23 | bspkrs.seh.configgui.listMode.tooltip= 24 | bspkrs.seh.configgui.listMode=HUD Layout 25 | bspkrs.seh.configgui.showInChat.tooltip=Ustaw na 'true' by pokazywać informacje, 'false' by wyłączyć informacje gdy czat jest otwarty. 26 | bspkrs.seh.configgui.showInChat=Pokazuj gdy czat jest otwarty 27 | bspkrs.seh.configgui.xOffset.tooltip=Poziome przesunięcie od krawędzi ekranu (podczas używania prawego wyrównywania przesunięcie x jest relatywne do prawej krawędzi ekranu). 28 | bspkrs.seh.configgui.xOffset=Poziome przesunięcie HUDa 29 | bspkrs.seh.configgui.yOffset.tooltip=Pionowe przesunięcie od krawędzi ekranu (podczas używania dolnego wyrównywania przesunięcie y jest relatywne do dolnej krawędzi ekranu). 30 | bspkrs.seh.configgui.yOffset=Pionowe przesunięcie HUDa 31 | bspkrs.seh.configgui.yOffsetBottomCenter.tooltip=Pionowe przesunięcie używane dla wyrównywania dolnego środka by uniknąć Minecraftowego HUDa. 32 | bspkrs.seh.configgui.yOffsetBottomCenter=Pionowe przesunięcie dolnego środka 33 | commands.statuseffect.usage=statuseffect config 34 | -------------------------------------------------------------------------------- /src/main/java/bspkrs/statuseffecthud/fml/SEHRenderTicker.java: -------------------------------------------------------------------------------- 1 | package bspkrs.statuseffecthud.fml; 2 | 3 | import java.util.List; 4 | 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraft.client.gui.GuiButton; 7 | import net.minecraft.client.gui.GuiScreen; 8 | import net.minecraft.client.gui.inventory.GuiContainer; 9 | import net.minecraft.client.renderer.InventoryEffectRenderer; 10 | import bspkrs.statuseffecthud.StatusEffectHUD; 11 | import bspkrs.util.ReflectionHelper; 12 | import net.minecraftforge.fml.common.FMLCommonHandler; 13 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 14 | import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; 15 | import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent; 16 | import net.minecraftforge.fml.relauncher.Side; 17 | import net.minecraftforge.fml.relauncher.SideOnly; 18 | 19 | @SideOnly(Side.CLIENT) 20 | public class SEHRenderTicker 21 | { 22 | private Minecraft mc; 23 | private static boolean isRegistered = false; 24 | 25 | public SEHRenderTicker() 26 | { 27 | mc = Minecraft.getMinecraft(); 28 | isRegistered = true; 29 | } 30 | 31 | @SuppressWarnings("rawtypes") 32 | @SubscribeEvent 33 | public void onTick(RenderTickEvent event) 34 | { 35 | if (event.phase.equals(Phase.START)) 36 | { 37 | if (StatusEffectHUD.disableInventoryEffectList) 38 | if (mc.currentScreen != null && mc.currentScreen instanceof InventoryEffectRenderer) 39 | { 40 | try 41 | { 42 | InventoryEffectRenderer ier = ((InventoryEffectRenderer) mc.currentScreen); 43 | if (ReflectionHelper.getBooleanValue(InventoryEffectRenderer.class, "field_147045_u", "hasActivePotionEffects", ier, false)) 44 | { 45 | ReflectionHelper.setBooleanValue(InventoryEffectRenderer.class, "field_147045_u", "hasActivePotionEffects", ier, false); 46 | ReflectionHelper.setIntValue(GuiContainer.class, "field_147003_i", "guiLeft", ier, 47 | (ier.width - ReflectionHelper.getIntValue(GuiContainer.class, "field_146999_f", "xSize", ier, 176)) / 2); 48 | } 49 | 50 | List buttonList = ReflectionHelper.getListObject(GuiScreen.class, "field_146292_n", "buttonList", ier); 51 | for (Object o : buttonList) 52 | if (o instanceof GuiButton && ((GuiButton) o).id == 101) 53 | ((GuiButton) o).xPosition = ReflectionHelper.getIntValue(GuiContainer.class, "field_147003_i", "guiLeft", ier, 54 | (ier.width - ReflectionHelper.getIntValue(GuiContainer.class, "field_146999_f", "xSize", ier, 176)) / 2); 55 | else if (o instanceof GuiButton && ((GuiButton) o).id == 102) 56 | ((GuiButton) o).xPosition = ReflectionHelper.getIntValue(GuiContainer.class, "field_147003_i", "guiLeft", ier, 57 | (ier.width - ReflectionHelper.getIntValue(GuiContainer.class, "field_146999_f", "xSize", ier, 176)) / 2) + 58 | ReflectionHelper.getIntValue(GuiContainer.class, "field_146999_f", "xSize", ier, 176) - 20; 59 | } 60 | catch (Throwable e) 61 | {} 62 | } 63 | 64 | return; 65 | } 66 | 67 | if (!StatusEffectHUD.onTickInGame(mc)) 68 | { 69 | FMLCommonHandler.instance().bus().unregister(this); 70 | isRegistered = false; 71 | } 72 | } 73 | 74 | public static boolean isRegistered() 75 | { 76 | return isRegistered; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/bspkrs/statuseffecthud/ConfigElement.java: -------------------------------------------------------------------------------- 1 | package bspkrs.statuseffecthud; 2 | 3 | import static net.minecraftforge.common.config.Property.Type.BOOLEAN; 4 | import static net.minecraftforge.common.config.Property.Type.COLOR; 5 | import static net.minecraftforge.common.config.Property.Type.INTEGER; 6 | import static net.minecraftforge.common.config.Property.Type.STRING; 7 | import net.minecraftforge.common.config.Property.Type; 8 | 9 | public enum ConfigElement 10 | { 11 | ENABLED("enabled", "bspkrs.seh.configgui.enabled", "Enables or disables the Status Effect HUD display.", BOOLEAN), 12 | ALIGN_MODE("alignMode", "bspkrs.seh.configgui.alignMode", 13 | "Sets the position of the HUD on the screen. Valid alignment strings are topleft, topcenter, topright, middleleft, middlecenter, middleright, bottomleft, bottomcenter, bottomright.", 14 | STRING, new String[] { "topleft", "topcenter", "topright", "middleleft", "middlecenter", "middleright", "bottomleft", "bottomcenter", "bottomright" }), 15 | // LIST_MODE("listMode", "bspkrs.seh.configgui.listMode", 16 | // "Sets the direction to display status items. Valid list mode strings are horizontal and vertical.", STRING, new String[] { "vertical", "horizontal" }), 17 | DISABLE_INV_EFFECT_LIST("disableInventoryEffectList", "bspkrs.seh.configgui.disableInventoryEffectList", 18 | "Set to true to disable the vanilla status effect list shown when your inventory is open, false to allow vanilla inventory behavior.", BOOLEAN), 19 | ENABLE_BACKGROUND("enableBackground", "bspkrs.seh.configgui.enableBackground", 20 | "Set to true to see the effect background box, false to disable.", BOOLEAN), 21 | ENABLE_EFFECT_NAME("enableEffectName", "bspkrs.seh.configgui.enableEffectName", 22 | "Set to true to show effect names, false to disable.", BOOLEAN), 23 | DURATION_BLINK_SECONDS("durationBlinkSeconds", "bspkrs.seh.configgui.durationBlinkSeconds", 24 | "When a potion/effect has this many seconds remaining the timer will begin to blink. Set to -1 to disable blinking.", INTEGER), 25 | ENABLE_ICON_BLINK("enableIconBlink", "bspkrs.seh.configgui.enableIconBlink", 26 | "Set to true to enable blinking for the icon when a potion/effect is nearly gone, false to disable.", BOOLEAN), 27 | EFFECT_NAME_COLOR("effectNameColor", "bspkrs.seh.configgui.effectNameColor", 28 | "Valid color values are 0-9, a-f (color values can be found here: http://www.minecraftwiki.net/wiki/File:Colors.png).", COLOR, 29 | new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" }), 30 | DURATION_COLOR("durationColor", "bspkrs.seh.configgui.durationColor", 31 | "Valid color values are 0-9, a-f (color values can be found here: http://www.minecraftwiki.net/wiki/File:Colors.png).", COLOR, 32 | new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" }), 33 | X_OFFSET("xOffset", "bspkrs.seh.configgui.xOffset", 34 | "Horizontal offset from the edge of the screen (when using right alignments the x offset is relative to the right edge of the screen).", INTEGER), 35 | Y_OFFSET("yOffset", "bspkrs.seh.configgui.yOffset", 36 | "Vertical offset from the edge of the screen (when using bottom alignments the y offset is relative to the bottom edge of the screen).", INTEGER), 37 | Y_OFFSET_BOTTOM_CENTER("yOffsetBottomCenter", "bspkrs.seh.configgui.yOffsetBottomCenter", 38 | "Vertical offset used only for the bottomcenter alignment to avoid the vanilla HUD.", INTEGER), 39 | APPLY_X_OFFSET_TO_CENTER("applyXOffsetToCenter", "bspkrs.seh.configgui.applyXOffsetToCenter", 40 | "Set to true if you want the xOffset value to be applied when using a center alignment.", BOOLEAN), 41 | APPLY_Y_OFFSET_TO_MIDDLE("applyYOffsetToMiddle", "bspkrs.seh.configgui.applyYOffsetToMiddle", 42 | "Set to true if you want the yOffset value to be applied when using a middle alignment.", BOOLEAN), 43 | SHOW_IN_CHAT("showInChat", "bspkrs.seh.configgui.showInChat", 44 | "Set to true to show info when chat is open, false to disable info when chat is open.", BOOLEAN); 45 | 46 | private String key; 47 | private String langKey; 48 | private String desc; 49 | private Type propertyType; 50 | private String[] validStrings; 51 | 52 | private ConfigElement(String key, String langKey, String desc, Type propertyType, String[] validStrings) 53 | { 54 | this.key = key; 55 | this.langKey = langKey; 56 | this.desc = desc; 57 | this.propertyType = propertyType; 58 | this.validStrings = validStrings; 59 | } 60 | 61 | private ConfigElement(String key, String langKey, String desc, Type propertyType) 62 | { 63 | this(key, langKey, desc, propertyType, new String[0]); 64 | } 65 | 66 | public String key() 67 | { 68 | return key; 69 | } 70 | 71 | public String languageKey() 72 | { 73 | return langKey; 74 | } 75 | 76 | public String desc() 77 | { 78 | return desc; 79 | } 80 | 81 | public Type propertyType() 82 | { 83 | return propertyType; 84 | } 85 | 86 | public String[] validStrings() 87 | { 88 | return validStrings; 89 | } 90 | } -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | StatusEffectHUD 2 | ================= 3 | bspkrs' StatusEffectHUD mod for Minecraft. Displays the player's active potion/debuff effects without opening the inventory. 4 | This repo contains source files for ModLoader (dependant on bspkrsCore). 5 | 6 | ## Links of Interest 7 | - [Official Minecraft Forum Thread](http://www.minecraftforum.net/topic/1114612-) 8 | - [Player Downloads](http://bspk.rs/MC/StatusEffectHUD/index.html) - for Minecraft players to use 9 | - [Developer Downloads](http://bspk.rs/MC/StatusEffectHUD/deobf/index.html) - for developers to use in an IDE such as Eclipse 10 | - [Issue Tracking System](https://github.com/bspkrs/StatusEffectHUD/issues) 11 | - [Contributing](#contributing) - for those that want to help out 12 | - [License](https://raw.github.com/bspkrs/StatusEffectHUD/master/src/main/resources/LICENSE) 13 | 14 | ### Technical Info 15 | - [Setup Java](#setup-java) 16 | - [Setup Gradle](#setup-gradle) 17 | - [Setup Git](#setup-git) 18 | - [Setup StatusEffectHUD](#setup-statuseffecthud) 19 | - [Compile StatusEffectHUD](#compile-statuseffecthud) 20 | - [Updating Your Repository](#updating-your-repository) 21 | 22 | #### Setup Java 23 | The Java JDK is used to compile StatusEffectHUD. 24 | 25 | 1. Download and install the Java JDK. 26 | * [Windows/Mac download link](http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html). Scroll down, accept the `Oracle Binary Code License Agreement for Java SE`, and download it (if you have a 64-bit OS, please download the 64-bit version). 27 | * Linux: Installation methods for certain popular flavors of Linux are listed below. If your distribution is not listed, follow the instructions specific to your package manager or install it manually [here](http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html). 28 | * Gentoo: `emerge dev-java/oracle-jdk-bin` 29 | * Archlinux: `pacman -S jdk7-openjdk` 30 | * Ubuntu/Debian: `apt-get install openjdk-7-jdk` 31 | * Fedora: `yum install java-1.7.0-openjdk` 32 | 2. Set up the environment. 33 | * Windows: Set environment variables for the JDK. 34 | 1. Go to `Control Panel\System and Security\System`, and click on `Advanced System Settings` on the left-hand side. 35 | 2. Click on `Environment Variables`. 36 | 3. Under `System Variables`, click `New`. 37 | 4. For `Variable Name`, input `JAVA_HOME`. 38 | 5. For `Variable Value`, input something similar to `C:\Program Files\Java\jdk1.7.0_45` exactly as shown (or wherever your Java JDK installation is), and click `Ok`. 39 | 6. Scroll down to a variable named `Path`, and double-click on it. 40 | 7. Append `;%JAVA_HOME%\bin` EXACTLY AS SHOWN and click `Ok`. Make sure the location is correct; double-check just to make sure. 41 | 3. Open up your command line and run `javac`. If it spews out a bunch of possible options and the usage, then you're good to go. If not try the steps again. 42 | 43 | #### Setup Gradle 44 | Gradle is used to execute the various build tasks when compiling StatusEffectHUD. 45 | 46 | 1. Download and install Gradle. 47 | * [Windows/Mac download link](http://www.gradle.org/downloads). You only need the binaries, but choose whatever flavor you want. 48 | * Unzip the package and put it wherever you want, eg `C:\Gradle`. 49 | * Linux: Installation methods for certain popular flavors of Linux are listed below. If your distribution is not listed, follow the instructions specific to your package manager or install it manually [here](http://www.gradle.org/downloads). 50 | * Gentoo: `emerge dev-java/gradle-bin` 51 | * Archlinux: You'll have to install it from the [AUR](https://aur.archlinux.org/packages/gradle). 52 | * Ubuntu/Debian: `apt-get install gradle` 53 | * Fedora: Install Gradle manually from its website (see above), as Fedora ships a "broken" version of Gradle. Use `yum install gradle` only if you know what you're doing. 54 | 2. Set up the environment. 55 | * Windows: Set environment variables for Gradle. 56 | 1. Go back to `Environment Variables` and then create a new system variable. 57 | 2. For `Variable Name`, input `GRADLE_HOME`. 58 | 3. For `Variable Value`, input something similar to `C:\Gradle-1.10` exactly as shown (or wherever your Gradle installation is), and click `Ok`. 59 | 4. Scroll down to `Path` again, and append `;%GRADLE_HOME%\bin` EXACTLY AS SHOWN and click `Ok`. Once again, double-check the location. 60 | 3. Open up your command line and run `gradle`. If it says "Welcome to Gradle [version].", then you're good to go. If not try the steps again. 61 | 62 | #### Setup Git 63 | Git is used to clone StatusEffectHUD and update your local copy. 64 | 65 | 1. Download and install Git [here](http://git-scm.com/download/). 66 | 2. *Optional* Download and install a Git GUI client, such as Github for Windows/Mac, SmartGitHg, TortoiseGit, etc. A nice list is available [here](http://git-scm.com/downloads/guis). 67 | 68 | #### Setup StatusEffectHUD 69 | This section assumes that you're using the command-line version of Git. 70 | 71 | 1. Open up your command line. 72 | 2. Navigate to a place where you want to download StatusEffectHUD's source (eg `C:\Development\Github\Minecraft\`) by executing `cd [folder location]`. This location is known as `mcdev` from now on. 73 | 3. Execute `git clone git@github.com:bspkrs/StatusEffectHUD.git`. This will download StatusEffectHUD's source into `mcdev`. 74 | 4. Right now, you should have a directory that looks something like: 75 | 76 | *** 77 | mcdev 78 | \-StatusEffectHUD 79 | \-StatusEffectHUD's files (should have build.gradle) 80 | *** 81 | 82 | #### Compile StatusEffectHUD 83 | 1. Execute `gradle setupDecompWorkspace`. This sets up Forge and downloads the necessary libraries to build StatusEffectHUD. This might take some time, be patient. 84 | * You will generally only have to do this once until the Forge version in `build.properties` changes. 85 | 2. Execute `gradle build`. If you did everything right, `BUILD SUCCESSFUL` will be displayed after it finishes. This should be relatively quick. 86 | * If you see `BUILD FAILED`, check the error output (it should be right around `BUILD FAILED`), fix everything (if possible), and try again. 87 | 3. Go to `mcdev\StatusEffectHUD\build\libs`. 88 | * You should see a `.jar` file named `[#.#.#]StatusEffectHUD-.jar`. 89 | 4. Copy the jar into your Minecraft mods folder, and you are done! 90 | 91 | #### Updating Your Repository 92 | In order to get the most up-to-date builds, you'll have to periodically update your local repository. 93 | 94 | 1. Open up your command line. 95 | 2. Navigate to `mcdev` in the console. 96 | 3. Make sure you have not made any changes to the local repository, or else there might be issues with Git. 97 | * If you have, try reverting them to the status that they were when you last updated your repository. 98 | 4. Execute `git pull master`. This pulls all commits from the official repository that do not yet exist on your local repository and updates it. 99 | 100 | ### Contributing 101 | #### Submitting a Pull Request (PR) 102 | So you found a bug in the code? Think you can make it more efficient? Want to help in general? Great! 103 | 104 | 1. If you haven't already, create a [GitHub account](https://github.com/signup/free). 105 | 2. Click the `Fork` icon located at the top-right of this page (below your username). 106 | 3. Make the changes that you want to and commit them. 107 | * If you're making changes locally, you'll have to do `git add -A`, `git commit` and `git push` in your command line. 108 | 4. Click `Pull Request` at the right-hand side of the gray bar directly below your fork's name. 109 | 5. Click `Click to create a pull request for this comparison`, enter your pull request title, and create a detailed description explaining what you changed. 110 | 6. Click `Send pull request`, and wait for feedback! 111 | 112 | #### Creating an Issue 113 | Crashing? Have a suggestion? Found a bug? Create an issue now! 114 | 115 | 1. Make sure your issue hasn't already been answered or fixed. Also think about whether your issue is a valid one before submitting it. 116 | 2. Go to the issues page. 117 | 3. Click `New Issue` right below `Star` and `Fork`. 118 | 4. Enter your issue title (something that summarizes your issue), and then add a detailed description ("Hey, could you add/change xxx?" or "Hey, found an exploit: stuff"). 119 | * If you are reporting a bug, make sure you include the following: 120 | * Version (can be found in the mcmod.info file or in the mod list) 121 | * ForgeModLoader log (please use [gists](https://gist.github.com/) for large amounts of text!) 122 | * Detailed description of the bug 123 | 5. Click `Submit new issue`, and wait for feedback! 124 | 125 | This README is shamelessly based off of [pahimar's version](https://github.com/pahimar/Equivalent-Exchange-3). 126 | 127 | Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. 128 | -------------------------------------------------------------------------------- /src/main/java/bspkrs/statuseffecthud/StatusEffectHUD.java: -------------------------------------------------------------------------------- 1 | package bspkrs.statuseffecthud; 2 | 3 | import java.io.File; 4 | import java.util.ArrayList; 5 | import java.util.Collection; 6 | import java.util.HashMap; 7 | import java.util.Iterator; 8 | import java.util.LinkedList; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | import net.minecraft.client.Minecraft; 13 | import net.minecraft.client.gui.GuiChat; 14 | import net.minecraft.client.gui.ScaledResolution; 15 | import net.minecraft.potion.Potion; 16 | import net.minecraft.potion.PotionEffect; 17 | import net.minecraft.util.ResourceLocation; 18 | import net.minecraft.util.StatCollector; 19 | import net.minecraftforge.common.config.Configuration; 20 | 21 | import org.lwjgl.opengl.GL11; 22 | 23 | import bspkrs.client.util.HUDUtils; 24 | import bspkrs.statuseffecthud.fml.Reference; 25 | import bspkrs.util.CommonUtils; 26 | 27 | public class StatusEffectHUD 28 | { 29 | protected static float zLevel = -150.0F; 30 | private static ScaledResolution scaledResolution; 31 | 32 | // Config fields 33 | private final static boolean enabledDefault = true; 34 | public static boolean enabled = enabledDefault; 35 | private final static String alignModeDefault = "middleright"; 36 | public static String alignMode = alignModeDefault; 37 | // @BSProp(info="Valid list mode strings are horizontal and vertical") 38 | // public static String listMode = "vertical"; 39 | private final static boolean disableInventoryEffectListDefault = true; 40 | public static boolean disableInventoryEffectList = disableInventoryEffectListDefault; 41 | private final static boolean enableBackgroundDefault = false; 42 | public static boolean enableBackground = enableBackgroundDefault; 43 | private final static boolean enableEffectNameDefault = true; 44 | public static boolean enableEffectName = enableEffectNameDefault; 45 | private final static boolean enableIconBlinkDefault = true; 46 | public static boolean enableIconBlink = enableIconBlinkDefault; 47 | private final static int durationBlinkSecondsDefault = 10; 48 | public static int durationBlinkSeconds = durationBlinkSecondsDefault; 49 | private final static String effectNameColorDefault = "f"; 50 | public static String effectNameColor = effectNameColorDefault; 51 | private final static String durationColorDefault = "f"; 52 | public static String durationColor = durationColorDefault; 53 | private final static int xOffsetDefault = 2; 54 | public static int xOffset = xOffsetDefault; 55 | private final static int yOffsetDefault = 2; 56 | public static int yOffset = yOffsetDefault; 57 | private final static int yOffsetBottomCenterDefault = 41; 58 | public static int yOffsetBottomCenter = yOffsetBottomCenterDefault; 59 | private final static boolean applyXOffsetToCenterDefault = false; 60 | public static boolean applyXOffsetToCenter = applyXOffsetToCenterDefault; 61 | private final static boolean applyYOffsetToMiddleDefault = false; 62 | public static boolean applyYOffsetToMiddle = applyYOffsetToMiddleDefault; 63 | private final static boolean showInChatDefault = true; 64 | public static boolean showInChat = showInChatDefault; 65 | 66 | private static Map potionMaxDurationMap = new HashMap(); 67 | 68 | public static void initConfig(File file) 69 | { 70 | if (!CommonUtils.isObfuscatedEnv()) 71 | { // debug settings for deobfuscated execution 72 | // if (file.exists()) 73 | // file.delete(); 74 | } 75 | 76 | Reference.config = new Configuration(file); 77 | 78 | syncConfig(); 79 | } 80 | 81 | public static void syncConfig() 82 | { 83 | String ctgyGen = Configuration.CATEGORY_GENERAL; 84 | 85 | Reference.config.load(); 86 | 87 | Reference.config.setCategoryComment(ctgyGen, "ATTENTION: Editing this file manually is no longer necessary. \n" + 88 | "Type the command '/statuseffect config' without the quotes in-game to modify these settings."); 89 | 90 | List orderedKeys = new ArrayList(ConfigElement.values().length); 91 | 92 | enabled = Reference.config.getBoolean(ConfigElement.ENABLED.key(), ctgyGen, enabledDefault, 93 | ConfigElement.ENABLED.desc(), ConfigElement.ENABLED.languageKey()); 94 | orderedKeys.add(ConfigElement.ENABLED.key()); 95 | alignMode = Reference.config.getString(ConfigElement.ALIGN_MODE.key(), ctgyGen, alignModeDefault, 96 | ConfigElement.ALIGN_MODE.desc(), ConfigElement.ALIGN_MODE.validStrings(), ConfigElement.ALIGN_MODE.languageKey()); 97 | orderedKeys.add(ConfigElement.ALIGN_MODE.key()); 98 | disableInventoryEffectList = Reference.config.getBoolean(ConfigElement.DISABLE_INV_EFFECT_LIST.key(), ctgyGen, disableInventoryEffectListDefault, 99 | ConfigElement.DISABLE_INV_EFFECT_LIST.desc(), ConfigElement.DISABLE_INV_EFFECT_LIST.languageKey()); 100 | orderedKeys.add(ConfigElement.DISABLE_INV_EFFECT_LIST.key()); 101 | showInChat = Reference.config.getBoolean(ConfigElement.SHOW_IN_CHAT.key(), ctgyGen, showInChatDefault, 102 | ConfigElement.SHOW_IN_CHAT.desc(), ConfigElement.SHOW_IN_CHAT.languageKey()); 103 | orderedKeys.add(ConfigElement.SHOW_IN_CHAT.key()); 104 | enableBackground = Reference.config.getBoolean(ConfigElement.ENABLE_BACKGROUND.key(), ctgyGen, enableBackgroundDefault, 105 | ConfigElement.ENABLE_BACKGROUND.desc(), ConfigElement.ENABLE_BACKGROUND.languageKey()); 106 | orderedKeys.add(ConfigElement.ENABLE_BACKGROUND.key()); 107 | enableEffectName = Reference.config.getBoolean(ConfigElement.ENABLE_EFFECT_NAME.key(), ctgyGen, enableEffectNameDefault, 108 | ConfigElement.ENABLE_EFFECT_NAME.desc(), ConfigElement.ENABLE_EFFECT_NAME.languageKey()); 109 | orderedKeys.add(ConfigElement.ENABLE_EFFECT_NAME.key()); 110 | effectNameColor = Reference.config.getString(ConfigElement.EFFECT_NAME_COLOR.key(), ctgyGen, effectNameColorDefault, 111 | ConfigElement.EFFECT_NAME_COLOR.desc(), ConfigElement.EFFECT_NAME_COLOR.validStrings(), ConfigElement.EFFECT_NAME_COLOR.languageKey()); 112 | orderedKeys.add(ConfigElement.EFFECT_NAME_COLOR.key()); 113 | durationColor = Reference.config.getString(ConfigElement.DURATION_COLOR.key(), ctgyGen, durationColorDefault, 114 | ConfigElement.DURATION_COLOR.desc(), ConfigElement.DURATION_COLOR.validStrings(), ConfigElement.DURATION_COLOR.languageKey()); 115 | orderedKeys.add(ConfigElement.DURATION_COLOR.key()); 116 | enableIconBlink = Reference.config.getBoolean(ConfigElement.ENABLE_ICON_BLINK.key(), ctgyGen, enableIconBlinkDefault, 117 | ConfigElement.ENABLE_ICON_BLINK.desc(), ConfigElement.ENABLE_ICON_BLINK.languageKey()); 118 | orderedKeys.add(ConfigElement.ENABLE_ICON_BLINK.key()); 119 | durationBlinkSeconds = Reference.config.getInt(ConfigElement.DURATION_BLINK_SECONDS.key(), ctgyGen, durationBlinkSecondsDefault, -1, 60, 120 | ConfigElement.DURATION_BLINK_SECONDS.desc(), ConfigElement.DURATION_BLINK_SECONDS.languageKey()); 121 | orderedKeys.add(ConfigElement.DURATION_BLINK_SECONDS.key()); 122 | xOffset = Reference.config.getInt(ConfigElement.X_OFFSET.key(), ctgyGen, xOffsetDefault, Integer.MIN_VALUE, Integer.MAX_VALUE, 123 | ConfigElement.X_OFFSET.desc(), ConfigElement.X_OFFSET.languageKey()); 124 | orderedKeys.add(ConfigElement.X_OFFSET.key()); 125 | applyXOffsetToCenter = Reference.config.getBoolean(ConfigElement.APPLY_X_OFFSET_TO_CENTER.key(), ctgyGen, applyXOffsetToCenterDefault, 126 | ConfigElement.APPLY_X_OFFSET_TO_CENTER.desc(), ConfigElement.APPLY_X_OFFSET_TO_CENTER.languageKey()); 127 | orderedKeys.add(ConfigElement.APPLY_X_OFFSET_TO_CENTER.key()); 128 | yOffset = Reference.config.getInt(ConfigElement.Y_OFFSET.key(), ctgyGen, yOffsetDefault, Integer.MIN_VALUE, Integer.MAX_VALUE, 129 | ConfigElement.Y_OFFSET.desc(), ConfigElement.Y_OFFSET.languageKey()); 130 | orderedKeys.add(ConfigElement.Y_OFFSET.key()); 131 | applyYOffsetToMiddle = Reference.config.getBoolean(ConfigElement.APPLY_Y_OFFSET_TO_MIDDLE.key(), ctgyGen, applyYOffsetToMiddleDefault, 132 | ConfigElement.APPLY_Y_OFFSET_TO_MIDDLE.desc(), ConfigElement.APPLY_Y_OFFSET_TO_MIDDLE.languageKey()); 133 | orderedKeys.add(ConfigElement.APPLY_Y_OFFSET_TO_MIDDLE.key()); 134 | yOffsetBottomCenter = Reference.config.getInt(ConfigElement.Y_OFFSET_BOTTOM_CENTER.key(), ctgyGen, yOffsetBottomCenterDefault, 135 | Integer.MIN_VALUE, Integer.MAX_VALUE, ConfigElement.Y_OFFSET_BOTTOM_CENTER.desc(), ConfigElement.Y_OFFSET_BOTTOM_CENTER.languageKey()); 136 | orderedKeys.add(ConfigElement.Y_OFFSET_BOTTOM_CENTER.key()); 137 | 138 | Reference.config.setCategoryPropertyOrder(ctgyGen, orderedKeys); 139 | 140 | Reference.config.save(); 141 | 142 | } 143 | 144 | public static boolean onTickInGame(Minecraft mc) 145 | { 146 | if (enabled && (mc.inGameHasFocus || mc.currentScreen == null || (mc.currentScreen instanceof GuiChat && showInChat)) && 147 | !mc.gameSettings.showDebugInfo) 148 | { 149 | GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); 150 | scaledResolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); 151 | displayStatusEffects(mc); 152 | GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); 153 | } 154 | 155 | return true; 156 | } 157 | 158 | private static int getX(int width) 159 | { 160 | if (alignMode.equalsIgnoreCase("topcenter") || alignMode.equalsIgnoreCase("middlecenter") || alignMode.equalsIgnoreCase("bottomcenter")) 161 | return scaledResolution.getScaledWidth() / 2 - width / 2 + (applyXOffsetToCenter ? xOffset : 0); 162 | else if (alignMode.equalsIgnoreCase("topright") || alignMode.equalsIgnoreCase("middleright") || alignMode.equalsIgnoreCase("bottomright")) 163 | return scaledResolution.getScaledWidth() - width - xOffset; 164 | else 165 | return xOffset; 166 | } 167 | 168 | private static int getY(int rowCount, int height) 169 | { 170 | if (alignMode.equalsIgnoreCase("middleleft") || alignMode.equalsIgnoreCase("middlecenter") || alignMode.equalsIgnoreCase("middleright")) 171 | return (scaledResolution.getScaledHeight() / 2) - ((rowCount * height) / 2) + (applyYOffsetToMiddle ? yOffset : 0); 172 | else if (alignMode.equalsIgnoreCase("bottomleft") || alignMode.equalsIgnoreCase("bottomright")) 173 | return scaledResolution.getScaledHeight() - (rowCount * height) - yOffset; 174 | else if (alignMode.equalsIgnoreCase("bottomcenter")) 175 | return scaledResolution.getScaledHeight() - (rowCount * height) - yOffsetBottomCenter; 176 | else 177 | return yOffset; 178 | } 179 | 180 | private static boolean shouldRender(PotionEffect pe, int ticksLeft, int thresholdSeconds) 181 | { 182 | if (potionMaxDurationMap.get(pe).intValue() > 400) 183 | if (ticksLeft / 20 <= thresholdSeconds) 184 | return ticksLeft % 20 < 10; 185 | 186 | return true; 187 | } 188 | 189 | private static void displayStatusEffects(Minecraft mc) 190 | { 191 | Collection activeEffects = mc.thePlayer.getActivePotionEffects(); 192 | 193 | if (!activeEffects.isEmpty()) 194 | { 195 | int yOffset = enableBackground ? 33 : enableEffectName ? 20 : 18; 196 | if (activeEffects.size() > 5 && enableBackground) 197 | yOffset = 132 / (activeEffects.size() - 1); 198 | 199 | int yBase = getY(activeEffects.size(), yOffset); 200 | 201 | for (Iterator iteratorPotionEffect = activeEffects.iterator(); iteratorPotionEffect.hasNext(); yBase += yOffset) 202 | { 203 | PotionEffect potionEffect = (PotionEffect) iteratorPotionEffect.next(); 204 | 205 | // If we find a newly added potionEffect, add it and the current duration to the map to keep track of the max duration 206 | if (!potionMaxDurationMap.containsKey(potionEffect) || potionMaxDurationMap.get(potionEffect).intValue() < potionEffect.getDuration()) 207 | potionMaxDurationMap.put(potionEffect, new Integer(potionEffect.getDuration())); 208 | 209 | Potion potion = Potion.potionTypes[potionEffect.getPotionID()]; 210 | GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); 211 | mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/inventory.png")); 212 | int xBase = getX(enableBackground ? 120 : 18 + 4 + mc.fontRendererObj.getStringWidth("0:00")); 213 | String potionName = ""; 214 | 215 | if (enableEffectName) 216 | { 217 | potionName = StatCollector.translateToLocal(potion.getName()); 218 | 219 | if (potionEffect.getAmplifier() == 1) 220 | { 221 | potionName = potionName + " II"; 222 | } 223 | else if (potionEffect.getAmplifier() == 2) 224 | { 225 | potionName = potionName + " III"; 226 | } 227 | else if (potionEffect.getAmplifier() == 3) 228 | { 229 | potionName = potionName + " IV"; 230 | } 231 | else if (potionEffect.getAmplifier() == 4) 232 | { 233 | potionName = potionName + " V"; 234 | } 235 | else if (potionEffect.getAmplifier() == 5) 236 | { 237 | potionName = potionName + " VI"; 238 | } 239 | else if (potionEffect.getAmplifier() == 6) 240 | { 241 | potionName = potionName + " VII"; 242 | } 243 | else if (potionEffect.getAmplifier() == 7) 244 | { 245 | potionName = potionName + " VIII"; 246 | } 247 | else if (potionEffect.getAmplifier() == 8) 248 | { 249 | potionName = potionName + " IX"; 250 | } 251 | else if (potionEffect.getAmplifier() == 9) 252 | { 253 | potionName = potionName + " X"; 254 | } 255 | else if (potionEffect.getAmplifier() > 9) { 256 | potionName = potionName + " " + (potionEffect.getAmplifier() + 1); 257 | } 258 | 259 | xBase = getX(enableBackground ? 120 : 18 + 4 + mc.fontRendererObj.getStringWidth(potionName)); 260 | } 261 | 262 | String effectDuration = Potion.getDurationString(potionEffect); 263 | 264 | if (enableBackground) 265 | HUDUtils.drawTexturedModalRect(xBase, yBase, 0, 166, 140, 32, zLevel); 266 | 267 | if (alignMode.toLowerCase().contains("right")) 268 | { 269 | xBase = getX(0); 270 | if (potion.hasStatusIcon()) 271 | { 272 | int potionStatusIcon = potion.getStatusIconIndex(); 273 | 274 | if (!enableIconBlink || (enableIconBlink && shouldRender(potionEffect, potionEffect.getDuration(), durationBlinkSeconds))) 275 | HUDUtils.drawTexturedModalRect(xBase + (enableBackground ? -24 : -18), yBase + (enableBackground ? 7 : 0), 0 + potionStatusIcon % 8 * 18, 166 + 32 + potionStatusIcon / 8 * 18, 18, 18, zLevel); 276 | } 277 | int stringWidth = mc.fontRendererObj.getStringWidth(potionName); 278 | mc.fontRendererObj.drawStringWithShadow("\247" + effectNameColor + potionName + "\247r", xBase + (enableBackground ? -10 : -4) - 18 - stringWidth, yBase + (enableBackground ? 6 : 0), 0xffffff); 279 | stringWidth = mc.fontRendererObj.getStringWidth(effectDuration); 280 | 281 | if (shouldRender(potionEffect, potionEffect.getDuration(), durationBlinkSeconds)) 282 | mc.fontRendererObj.drawStringWithShadow("\247" + durationColor + effectDuration + "\247r", xBase + (enableBackground ? -10 : -4) - 18 - stringWidth, yBase + (enableBackground ? 6 : 0) + (enableEffectName ? 10 : 5), 0xffffff); 283 | } 284 | else 285 | { 286 | if (potion.hasStatusIcon()) 287 | { 288 | int potionStatusIcon = potion.getStatusIconIndex(); 289 | HUDUtils.drawTexturedModalRect(xBase + (enableBackground ? 6 : 0), yBase + (enableBackground ? 7 : 0), 0 + potionStatusIcon % 8 * 18, 166 + 32 + potionStatusIcon / 8 * 18, 18, 18, zLevel); 290 | } 291 | mc.fontRendererObj.drawStringWithShadow("\247" + effectNameColor + potionName + "\247r", xBase + (enableBackground ? 10 : 4) + 18, yBase + (enableBackground ? 6 : 0), 0xffffff); 292 | 293 | if (shouldRender(potionEffect, potionEffect.getDuration(), durationBlinkSeconds)) 294 | mc.fontRendererObj.drawStringWithShadow("\247" + durationColor + effectDuration + "\247r", xBase + (enableBackground ? 10 : 4) + 18, yBase + (enableBackground ? 6 : 0) + (enableEffectName ? 10 : 5), 0xffffff); 295 | } 296 | } 297 | 298 | // See if any potions have expired... if they have, remove them from the map 299 | List toRemove = new LinkedList(); 300 | 301 | for (PotionEffect pe : potionMaxDurationMap.keySet()) 302 | if (!activeEffects.contains(pe)) 303 | toRemove.add(pe); 304 | 305 | for (PotionEffect pe : toRemove) 306 | potionMaxDurationMap.remove(pe); 307 | } 308 | } 309 | } 310 | --------------------------------------------------------------------------------