-
Posts
70 -
Joined
-
Last visited
Everything posted by JoelGodOfWar
-
[1.8] [Eclipse] Working with multiple mods
JoelGodOfWar replied to JoelGodOfWar's topic in Modder Support
Delpi, I almost quit modding, when i first tried to setup Github, the program recommended by some tutorial, deleted all my mod files. If not for quick thinking, and a file recovery program, i would of lost everything. So now i backup all my mod files and use the program from Github. I'm gonna try setting up like Lex shows, even though assetDir is no longer in the build.gradle file. If that doesn't work out, i'll just swap out the source files and do redundant backups. -
[1.8] [Eclipse] Working with multiple mods
JoelGodOfWar replied to JoelGodOfWar's topic in Modder Support
Thank you, That seems like just what i needed. Do you know how different runDir is from assetDir? If i use the code lex mentions in the video will it cause trouble because of not being assetDir? -
This is a fairly newb question, but how do those of you that work with multiple mods, keep them from building together? Do you use Working Sets? I do backup my source files, and could if needed remove my source files from the current workspace. But there has to be an easier way to work with multiple mods.
-
[1.8] How to get config directory? [SOLVED]
JoelGodOfWar replied to JoelGodOfWar's topic in Modder Support
hmm, i hadn't thought of that file. I could just use a deliminator to separate the lines, and import them into an array. Thank you so much, for pointing that out to me. -
[1.8] How to get config directory? [SOLVED]
JoelGodOfWar replied to JoelGodOfWar's topic in Modder Support
It's just supposed to be lines of text, like a bunch of insults or random quotes. Nothing to do with configurations. More than likely this text file would be the thing getting updated most often, and could have hundreds of lines of text. -
[1.8] How to get config directory? [SOLVED]
JoelGodOfWar replied to JoelGodOfWar's topic in Modder Support
Yes i've used version checker before. I'm wanting to load a file from the src/main/resources directory of eclipse, instead of a file outside of the jar. That way when i update, and versionchecker downloads the new jar, the text file is updated, without the user having to move it to another folder. I know this is not related to the original question. This is what i want to be able to load into an array. A simple text document that will get compiled into the jar. item 1 item 2 etc -
[1.8] How to get config directory? [SOLVED]
JoelGodOfWar replied to JoelGodOfWar's topic in Modder Support
My original idea was to have 2 files, the mod jar, and a list of things in a txt file. But after thinking about adding versionchecker, it seems easier to just have the jar. I have used the configs files in my other mod. I just don't want to hard code the list. Would rather it be in a text file, and then load it into an array, for access by a function. So how would i load a text file from the jar? -
[1.8] How to get config directory? [SOLVED]
JoelGodOfWar replied to JoelGodOfWar's topic in Modder Support
Thinking i should use a text file from the resource files area, so it is in the jar. How would i change this to load from say src/main/resources/myfile.txt Planning on adding versionchecker, so this method would be preferred. This is the code i was gonna use for the file in the cinfig directory. public String[] readLines(String filename) throws IOException { FileReader fileReader = new FileReader(filename); BufferedReader bufferedReader = new BufferedReader(fileReader); List<String> lines = new ArrayList<String>(); String line = null; while ((line = bufferedReader.readLine()) != null) { lines.add(line); } bufferedReader.close(); return lines.toArray(new String[lines.size()]); } Also thank you for the quick replies. It is very much appreciated. -
I am working on a mod, that requires a text file to be loaded into an array. To get the file loaded, i need to be able to get the directory of the file, i plan on putting it into the config folder. So how do i get the config directory? I figure it is either in minecraft, forge, fml, or a java import.
-
A user of my mod was having an issue with the icons of potions, their resource pack did not have all the icons. So i wanted to use the default icons. So i've changed the code to be. private static ResourceLocation inventoryResourceLocation = new ResourceLocation("minecraft:textures/gui/container/inventory.png");
-
If i add an inventory.png into the resources area of my mod, can i use it instead of this? If so how? private static ResourceLocation inventoryResourceLocation = new ResourceLocation("textures/gui/container/inventory.png"); This way i could give the player an option of using the ones from their texture pack, or the default ones.
-
Ok so here's the working source, in case someone else wants to know how to do this. Put this in your main mod file. @EventHandler public void init(FMLInitializationEvent event){ ach = new Achievement("achievement.LazyCheater", "LazyCheater", 0, 0, Blocks.command_block, (Achievement)null).func_180788_c(); AchievementPage.registerAchievementPage(new AchievementPage("Troll", new Achievement[]{ach})); } public static Achievement ach; Then place this code where you want the Achievement to display. Minecraft.getMinecraft().guiAchievement.displayAchievement(yourmainmod.ach);
-
Ok so with this code in a keybind i can get the achievement to display, a second press crashes the game. Achievement ach; ach = new Achievement("achievement.LazyCheater", "LazyCheater", 0, 0, Blocks.command_block, (Achievement)null).func_180788_c(); AchievementPage.registerAchievementPage(new AchievementPage("Troll", new Achievement[]{ach})); Minecraft.getMinecraft().guiAchievement.displayAchievement(ach); If i place this part in the Init portion Achievement ach; ach = new Achievement("achievement.LazyCheater", "LazyCheater", 0, 0, Blocks.command_block, (Achievement)null).func_180788_c(); AchievementPage.registerAchievementPage(new AchievementPage("Troll", new Achievement[]{ach})); And this part in the keybind Minecraft.getMinecraft().guiAchievement.displayAchievement(ach); I get an error in code, where ach can't be resolved. Basically what i'm wanting to happen is that every time a player goes into gamemode 1, they get this achievement. So if they did gm 1, gm 0, gm 1, they would get the achievement display twice.
-
I know this is a strange question, but it is related to a requested mod from one of the Moderators of a server i play on. Is it possible to display an Achievement to the client side only? Not actually adding an achievement, but display one anyways? Something along the lines of thePlayer.Triggerachievement("Wow, you installed a mod.") From my searching i've found server side mods that do this, but this needs to be entirely client side.
-
[1.8] Chat window is hidden while class enabled? [SOLVED]
JoelGodOfWar replied to JoelGodOfWar's topic in Modder Support
Thank you, thank you, thank you. -
[1.8] Chat window is hidden while class enabled? [SOLVED]
JoelGodOfWar replied to JoelGodOfWar's topic in Modder Support
I've highlighted the issue in red. Potion timers disabled. And chat/command window missing. Potion timers enabled. all i did was press T with timers disabled, F2, then esc to close the chat, then enabled the Timers, and pressed T again, F2 again. -
[1.8] Chat window is hidden while class enabled? [SOLVED]
JoelGodOfWar replied to JoelGodOfWar's topic in Modder Support
This is the current @SubscribeEvent @SubscribeEvent public void RenderGameOverlayEvent(RenderGameOverlayEvent.Post event) { //render everything onto the screen if(event.type == RenderGameOverlayEvent.ElementType.ALL) { PotionTimers.RenderOntoHUD(); } While this now allows the chat window to show, it still hides the area that you type chat into. Then disable the potion timers and you get the chat input back. During both of these screen shots the T keybind is pressed to open the chat, then F2 is pressed for the screen shot, the potion timer keybind is L. While this new development is a great stride towards the goal, not being able to see what you're typing can be an issue. -
[1.8] Chat window is hidden while class enabled? [SOLVED]
JoelGodOfWar replied to JoelGodOfWar's topic in Modder Support
So far using the .Post doesn't fix anything, i've also tried .All, .Text, etc. -
[1.8] Chat window is hidden while class enabled? [SOLVED]
JoelGodOfWar replied to JoelGodOfWar's topic in Modder Support
Like this? public void RenderGameOverlayEvent(RenderGameOverlayEvent.Post event) Cause that doesn't seem to change the chat window being hidden while the class is enabled. -
[1.8] Chat window is hidden while class enabled? [SOLVED]
JoelGodOfWar replied to JoelGodOfWar's topic in Modder Support
So far i have still been unable to find an actual solution to this error. I did a quick fix that disables potion timers when the chat window is opened. But this is only a band aid on the issue. -
[1.8] XP Bar disappearing why? [SOLVED]
JoelGodOfWar replied to JoelGodOfWar's topic in Modder Support
I fixed it another way just a few minutes ago, but i will try this also. The fix i found was changing this if(e.type == ElementType.JUMPBAR || e.type == ElementType.EXPERIENCE){ to this if(e.type == RenderGameOverlayEvent.ElementType.TEXT){ and now the experience bar displays. thank you Ernio -
[1.8] XP Bar disappearing why? [SOLVED]
JoelGodOfWar replied to JoelGodOfWar's topic in Modder Support
Is this what i'm looking for? public class GuiIngameForge extends GuiIngame, it has a WIDGITS in it. -
[1.8] XP Bar disappearing why? [SOLVED]
JoelGodOfWar replied to JoelGodOfWar's topic in Modder Support
So far i have not been able to find anything about widgets. Or rebinding. -
These classes display potion timers, but when enabled the chat window is hidden. once disabled it is visible again? package com.datacraftcoords.event; //Imports import org.lwjgl.opengl.GL11; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.InventoryEffectRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.resources.model.IBakedModel; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import com.datacraftcoords.event.PotionTimers; public class HUDRenderer { public static HUDRenderer instance = new HUDRenderer(); private static Minecraft mc = Minecraft.getMinecraft(); /** * Event fired at various points during the GUI rendering process. * We render anything that need to be rendered onto the HUD in this method. * @param event */ @SubscribeEvent public void RenderGameOverlayEvent(RenderGameOverlayEvent event) { //render everything onto the screen if(event.type == RenderGameOverlayEvent.ElementType.TEXT) { PotionTimers.RenderOntoHUD(); } else if(event.type == RenderGameOverlayEvent.ElementType.DEBUG) { // } //change how the inventories are rendered (this has to be done on every game tick) if (mc.currentScreen instanceof InventoryEffectRenderer) { PotionTimers.DisableInventoryPotionEffects((InventoryEffectRenderer)mc.currentScreen); } } package com.datacraftcoords.event; import java.util.Collection; import java.util.Iterator; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiChat; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.InventoryEffectRenderer; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; import com.datacraftcoords.Configs; import com.datacraftcoords.LogHandler; import com.datacraftcoords.event.HUDRenderer;; public class PotionTimers { protected static Minecraft mc = Minecraft.getMinecraft(); /** Enables/Disables this Mod */ public static boolean Enabled; /** * Toggles this Mod on or off * @return The state the Mod was changed to */ public static void ToggleEnabled() { Enabled = !Enabled; Configs.SaveConfigSettings(); } private static ResourceLocation inventoryResourceLocation = new ResourceLocation("textures/gui/container/inventory.png"); public static boolean ShowPotionIcons; public static boolean UsePotionColors; public static float PotionScale; public static boolean HidePotionEffectsInInventory; protected static final int[] blinkingThresholds = {3 * 20, 5 * 20, 16 * 20}; //the time at which blinking starts protected static final int[] blinkingSpeed = {5, 10, 20}; //how often the blinking occurs protected static final int[] blinkingDuration = {2, 3, 3}; //how long the blink lasts protected static int potionLocX = 1; protected static int potionLocY = 48; /** * Renders the duration any potion effects that the player currently has on the left side of the screen. */ public static void RenderOntoHUD() { //if the player is in the world //and not in a menu (except for chat and the custom Options menu) //and F3 not shown if (PotionTimers.Enabled && (mc.inGameHasFocus || mc.currentScreen == null || (mc.currentScreen instanceof GuiChat)) && !mc.gameSettings.showDebugInfo) { Collection potionEffects = mc.thePlayer.getActivePotionEffects(); //key:potionId, value:potionEffect Iterator it = potionEffects.iterator(); int x = potionLocX; int y = potionLocY; //x /= PotionScale; //y /= PotionScale; //GL11.glScalef(PotionScale, PotionScale, PotionScale); int i = 0; while (it.hasNext()) { PotionEffect potionEffect = (PotionEffect)it.next(); Potion potion = Potion.potionTypes[potionEffect.getPotionID()]; Boolean isFromBeacon = potionEffect.getIsAmbient(); //Minecraft bug: this is always false if (!isFromBeacon) //ignore effects from Beacons (Minecraft bug: isFromBeacon is always false) { ShowPotionIcons = true; if(ShowPotionIcons) { DrawPotionIcon(x, y, potion); DrawPotionDuration(x+10, y, potion, potionEffect); } else{ UsePotionColors = true; DrawPotionDuration(x, y, potion, potionEffect); } y += 10; i++; } } GL11.glScalef(1f/PotionScale, 1f/PotionScale, 1f/PotionScale); } } /** * Draws a potion's remaining duration with a color coded blinking timer * @param x * @param y * @param potion * @param potionEffect */ protected static void DrawPotionDuration(int x, int y, Potion potion, PotionEffect potionEffect) { String durationString = Potion.getDurationString(potionEffect); int potionDuration = potionEffect.getDuration(); //goes down by 20 ticks per second int colorInt = 0xFFFFFF; if(UsePotionColors) colorInt = potion.getLiquidColor(); //render the potion duration text onto the screen if (potionDuration >= blinkingThresholds[blinkingThresholds.length - 1]) //if the text is not blinking then render it normally { mc.fontRendererObj.drawString("" + durationString, x, y, colorInt); } else //else if the text is blinking, have a chance to not render it based on the blinking variables { //logic to determine if the text should be displayed, checks the blinking text settings for (int j = 0; j < blinkingThresholds.length; j++) { if (potionDuration < blinkingThresholds[j]) { if (potionDuration % blinkingSpeed[j] > blinkingDuration[j]) { mc.fontRendererObj.drawString("" + durationString, x, y, colorInt); } break; } } } } /** * Draws a potion's icon texture * @param x * @param y * @param potion */ protected static void DrawPotionIcon(int x, int y, Potion potion) { mc.getTextureManager().bindTexture(inventoryResourceLocation); if(potion.hasStatusIcon()) //some modded potions use a custom Resource Location for potion drawing, typically done in the .hasStatusIcon() method { int iconIndex = potion.getStatusIconIndex(); int u = iconIndex % 8 * 18; int v = 198 + iconIndex / 8 * 18; int width = 18; int height = 18; float scaler = 0.5f; GL11.glColor4f(1f, 1f, 1f, 1f); HUDRenderer.RenderCustomTexture(x, y, u, v, width, height, null, scaler); } } /** * Disables the potion effects from rendering by telling the Gui that the player has no potion effects applied. * Uses reflection to grab the class's private variable. * @param guiScreen the screen the player is looking at which extends InventoryEffectRenderer */ public static void DisableInventoryPotionEffects(InventoryEffectRenderer guiScreen) { if(PotionTimers.Enabled && HidePotionEffectsInInventory) { //Note for future Forge versions: field "field_147045_u" will probably be renamed to something like "playerHasPotionEffects" boolean playerHasPotionEffects = ObfuscationReflectionHelper.getPrivateValue(InventoryEffectRenderer.class, (InventoryEffectRenderer)guiScreen, "field_147045_u"); if(playerHasPotionEffects) { int guiLeftPx = (guiScreen.width - 176) / 2; ObfuscationReflectionHelper.setPrivateValue(GuiContainer.class, (GuiContainer)guiScreen, guiLeftPx, "field_147003_i","guiLeft"); ObfuscationReflectionHelper.setPrivateValue(InventoryEffectRenderer.class, (InventoryEffectRenderer)guiScreen, false, "field_147045_u"); } } } /** * @return */ // private static boolean TabIsSelectedInOptionsGui() { return true; } /** * Toggles showing potion icons * @return */ public static boolean ToggleShowPotionIcons() { return true; } /** * Toggles using potion colors * @return */ public static boolean ToggleUsePotionColors() { return true; } /** * Toggles hiding potion effects in the players inventory * @return */ public static boolean ToggleHidePotionEffectsInInventory() { return HidePotionEffectsInInventory = !HidePotionEffectsInInventory; } /** * Gets the horizontal location where the potion timers are rendered. * @return */ public static int GetHorizontalLocation() { return potionLocX; } /** * Sets the horizontal location where the potion timers are rendered. * @param x * @return the new x location */ public static int SetHorizontalLocation(int x) { potionLocX = MathHelper.clamp_int(x, 0, mc.displayWidth); return potionLocX; } /** * Gets the vertical location where the potion timers are rendered. * @return */ public static int GetVerticalLocation() { return potionLocY; } /** * Sets the vertical location where the potion timers are rendered. * @param y * @return the new y location */ public static int SetVerticalLocation(int y) { potionLocY = MathHelper.clamp_int(y, 0, mc.displayHeight); return potionLocY; } }
-
Been wondering why this code when enabled, causes the XP bar to be removed and replaced with random text? Is there a call i should make to render the XP Bar when text is rendered on the screen? package com.datacraftcoords.event; import org.lwjgl.opengl.GL11; import com.datacraftcoords.Configs; import com.datacraftcoords.GuiRepairOverride; import net.minecraft.client.Minecraft; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraft.client.gui.GuiRepair; import net.minecraft.client.gui.inventory.GuiEditSign; import net.minecraftforge.client.event.GuiOpenEvent; public class EventManager { //public static String daConfig; /** Enables/Disables this Mod */ public static boolean Enabled; public static boolean chunkEnabled; /** * Toggles this Mod on or off * @return The state the Mod was changed to */ public static void ToggleEnabled() { Enabled = !Enabled; Configs.SaveConfigSettings(); } @SubscribeEvent public void renderOverlay(RenderGameOverlayEvent e){ /** Checks if Enabled, if it is Enabled process code. */ if(EventManager.Enabled) { /** Checks if experience bar is displayed or not. If it is start code. */ if(e.type == ElementType.JUMPBAR || e.type == ElementType.EXPERIENCE){ //String DefaultChatStringFormat = "[{x}, {y}, {z}]"; /** Gets Biome, and compares it to nether. Then alters the coords displayed based on results */ String varBiome = getBiome(); if(!varBiome.equals("Hell")){ /** We are NOT in the Nether so display Overworld, and Nether Coords. */ String coordinateString = "{x}, {y}, {z}"; coordinateString = coordinateString.replace("{x}", Integer.toString(GetXCoordinate())); coordinateString = coordinateString.replace("{y}", Integer.toString(GetYCoordinate())); coordinateString = coordinateString.replace("{z}", Integer.toString(GetZCoordinate())); /** Display Overworld coords */ mc.fontRendererObj.drawString(EnumChatFormatting.YELLOW + "O: " + coordinateString + " " + EnumChatFormatting.RED + yawCalc() + EnumChatFormatting.WHITE + " T:" + CalculateMessageForInfoLine(null), 2, 2, 0xffffff); String coordinateString2 = "{x}, {y}, {z}"; coordinateString2 = coordinateString2.replace("{x}", Integer.toString(GetXCoordinate() / ); coordinateString2 = coordinateString2.replace("{y}", Integer.toString(GetYCoordinate())); coordinateString2 = coordinateString2.replace("{z}", Integer.toString(GetZCoordinate() / ); /** Display Nether Coords, Overworld Dived by 8*/ mc.fontRendererObj.drawString(EnumChatFormatting.LIGHT_PURPLE + "N: " + coordinateString2 + EnumChatFormatting.GREEN + " XP: " + getXP(), 2, 12, 0xffffff); //System.out.println("Biome " + varBiome + " - coord1 " + coordinateString + " - coord2 " + coordinateString2); } else if(varBiome.equals("Hell")){ /** We ARE in the Nether so display Nether, and Overworld Coords. */ String coordinateString3 = "{x}, {y}, {z}"; coordinateString3 = coordinateString3.replace("{x}", Integer.toString(GetXCoordinate())); coordinateString3 = coordinateString3.replace("{y}", Integer.toString(GetYCoordinate())); coordinateString3 = coordinateString3.replace("{z}", Integer.toString(GetZCoordinate())); /** Display Nether Coords */ mc.fontRendererObj.drawString(EnumChatFormatting.LIGHT_PURPLE + "N: " + coordinateString3 + " " + EnumChatFormatting.RED + yawCalc() + EnumChatFormatting.WHITE + " T:" + CalculateMessageForInfoLine(null), 2, 2, 0xffffff); String coordinateString4 = "{x}, {y}, {z}"; coordinateString4 = coordinateString4.replace("{x}", Integer.toString((GetXCoordinate() * )); coordinateString4 = coordinateString4.replace("{y}", Integer.toString(GetYCoordinate())); coordinateString4 = coordinateString4.replace("{z}", Integer.toString((GetZCoordinate() * )); /** Display Overworld Coords, Nether Multiplied by 8 */ mc.fontRendererObj.drawString(EnumChatFormatting.YELLOW + "O: " + coordinateString4 + EnumChatFormatting.GREEN + " XP: " + getXP(), 2, 12, 0xffffff); //System.out.println("Biome " + varBiome + " - coord3 " + coordinateString3 + " - coord4 " + coordinateString4); } //Minecraft.getMinecraft().fontRendererObj.drawString("" + coordFormat + "", 2, 2, 0xffffff); /** Display Biome */ mc.fontRendererObj.drawString("B: " + getBiome() + "", 2, 22, 0xffffff); int chunkX = GetXCoordinate() / 16; int chunkY = GetYCoordinate() / 16; int chunkZ = GetZCoordinate() / 16; int inChunkX = GetXCoordinate() % 16; int inChunkY = GetYCoordinate() % 16; int inChunkZ = GetZCoordinate() % 16; String daChunk = ("" + Integer.toString(inChunkX) + " " + Integer.toString(inChunkY) + " " + Integer.toString(inChunkZ) + " in " + Integer.toString(chunkX) + " " + Integer.toString(chunkY) + " " + Integer.toString(chunkZ)); if(chunkEnabled){ mc.fontRendererObj.drawString("C: " + daChunk + "", 2, 32, 0xffffff); } } } } //public static String coordFormat = "" + Integer.toString(GetXCoordinate()) + ", " + Integer.toString(GetYCoordinate()) + ", " + Integer.toString(GetZCoordinate()) + ""; protected static Minecraft mc = Minecraft.getMinecraft(); //String yawCalc = "" + (MathHelper.floor_double((double) (mc.thePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3); /** Get Direction we are facing N S E W */ public static double getYaw(){ return (double) (MathHelper.floor_double((double) (mc.thePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3); } public static String yawCalc(){ double var1 = getYaw(); String var2 = ""; if(var1 == 0){ var2 = "S"; } else if(var1 == 1){ var2 = "W"; } else if(var1 == 2){ var2 = "N"; } else if(var1 == 3){ var2 = "E"; } return var2; } /** Get XP, Current to Next Level */ public static String getXP(){ return (String) "" + String.valueOf((int) Math.ceil(mc.thePlayer.experience * mc.thePlayer.xpBarCap())) + "/" + mc.thePlayer.xpBarCap(); } /** Get Biome */ public static String getBiome(){ return (String) "" + mc.thePlayer.worldObj.getBiomeGenForCoords(mc.thePlayer.getPosition()).biomeName; } /** Get Player Coordinates */ public static int GetXCoordinate() { return (int) Math.floor(mc.thePlayer.posX); } public static int GetYCoordinate() { return (int) Math.floor(mc.thePlayer.posY); } public static int GetZCoordinate() { return (int) Math.floor(mc.thePlayer.posZ); } private static long mobSpawningStartTime = 13187; //mobs stop spawning at: 22813 //mobs start to burn at: 23600 private static long mobSpawningStopTime = 23600; /** * Calculates time * @return time if the Clock is enabled, otherwise "". */ public static String CalculateMessageForInfoLine(String infoLineMessageUpToThisPoint) { if (Enabled) { //0 game time is 6am, so add 6000 long time = (mc.theWorld.getWorldTime() + 6000) % 24000; long hours = time / 1000; long seconds = (long)((time % 1000) * (60.0/1000.0)); if(IsNight()) { String nighttimeClockString = EnumChatFormatting.GRAY + String.format("%02d", hours) + ":" + String.format("%02d", seconds); return nighttimeClockString; } else { String daytimeClockString = EnumChatFormatting.YELLOW + String.format("%02d", hours) + ":" + String.format("%02d", seconds); return daytimeClockString; } } return ""; } public static boolean IsNight() { long time = (mc.theWorld.getWorldTime()) % 24000; return time >= mobSpawningStartTime && time < mobSpawningStopTime; } @SubscribeEvent public void GuiOpenEvent(GuiOpenEvent event) { //if(UseQuickPlaceSign && event.gui instanceof GuiEditSign && mc.thePlayer.isSneaking()) //{ // event.setCanceled(true); //} if(true && event.gui instanceof GuiRepair) { event.gui = new GuiRepairOverride(mc.thePlayer.inventory, mc.theWorld); } } }