diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-11-26 13:46:15 -0500 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-11-26 13:46:15 -0500 |
commit | 7d642a6baf59b98a63eaf15e4ba59f6a5210db8c (patch) | |
tree | 15f38149151dcb45369d6d7944773da8bed02ea2 | |
parent | 8b78e680240a20d1b44c03f6bbcbb42b36a02827 (diff) | |
download | SkyblockMod-7d642a6baf59b98a63eaf15e4ba59f6a5210db8c.tar.gz SkyblockMod-7d642a6baf59b98a63eaf15e4ba59f6a5210db8c.tar.bz2 SkyblockMod-7d642a6baf59b98a63eaf15e4ba59f6a5210db8c.zip |
Possibly fix blaze hitbox issues, add more colours to config
Add lowest/highest blaze colours to config
Remove chat message for trivia
-rw-r--r-- | src/main/java/me/Danker/TheMod.java | 28 | ||||
-rw-r--r-- | src/main/java/me/Danker/handlers/ConfigHandler.java | 30 | ||||
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 5 |
3 files changed, 38 insertions, 25 deletions
diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 55ec20e..fed98f0 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -193,6 +193,9 @@ public class TheMod public static String COORDS_COLOUR; public static String CAKE_COLOUR; public static String SKILL_TRACKER_COLOUR; + public static String TRIVIA_WRONG_ANSWER_COLOUR; + public static int LOWEST_BLAZE_COLOUR; + public static int HIGHEST_BLAZE_COLOUR; @EventHandler public void init(FMLInitializationEvent event) { @@ -512,8 +515,6 @@ public class TheMod for (String question : triviaSolutions.keySet()) { if (message.contains(question)) { triviaAnswers = triviaSolutions.get(question); - String answer = String.join(" OR ", triviaSolutions.get(question)); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(MAIN_COLOUR + "Answer: " + ANSWER_COLOUR + EnumChatFormatting.BOLD + answer)); break; } } @@ -527,7 +528,7 @@ public class TheMod if (!isSolution) { char letter = message.charAt(5); String option = message.substring(6, message.length()); - event.message = new ChatComponentText(" " + EnumChatFormatting.GOLD + letter + EnumChatFormatting.RED + option); + event.message = new ChatComponentText(" " + EnumChatFormatting.GOLD + letter + TRIVIA_WRONG_ANSWER_COLOUR + option); return; } } @@ -2519,13 +2520,12 @@ public class TheMod // Checks 5 times per second if (tickAmount % 4 == 0) { - if (ToggleCommand.blazeToggled && Utils.inDungeons && world != null) { + if (ToggleCommand.blazeToggled && Utils.inDungeons && world != null) { List<Entity> entities = world.getLoadedEntityList(); int highestHealth = 0; highestBlaze = null; int lowestHealth = 99999999; lowestBlaze = null; - lowToHigh = false; for (Entity entity : entities) { if (entity.getName().contains("Blaze") && entity.getName().contains("/")) { @@ -2548,15 +2548,21 @@ public class TheMod if (highestBlaze != null || lowestBlaze != null) { new Thread(() -> { + boolean wallFound = false; for (int x = (int) player.posX - 25; x <= player.posX + 25; x++) { for (int z = (int) player.posZ - 25; z <= player.posX + 25; z++) { BlockPos blockPos = new BlockPos(x, 119, z); if (world.getBlockState(blockPos).getBlock() == Blocks.cobblestone_wall) { - lowToHigh = true; + wallFound = true; break; } } - if (lowToHigh) break; + if (wallFound) break; + } + if (wallFound) { + lowToHigh = true; + } else { + lowToHigh = false; } }).start(); } @@ -2626,15 +2632,15 @@ public class TheMod if (ToggleCommand.blazeToggled) { if (lowestBlaze != null && lowToHigh) { BlockPos stringPos = new BlockPos(lowestBlaze.posX, lowestBlaze.posY + 1, lowestBlaze.posZ); - Utils.draw3DString(stringPos, EnumChatFormatting.BOLD + "Smallest", 0xFF0000, event.partialTicks); + Utils.draw3DString(stringPos, EnumChatFormatting.BOLD + "Smallest", LOWEST_BLAZE_COLOUR, event.partialTicks); AxisAlignedBB aabb = new AxisAlignedBB(lowestBlaze.posX - 0.5, lowestBlaze.posY - 2, lowestBlaze.posZ - 0.5, lowestBlaze.posX + 0.5, lowestBlaze.posY, lowestBlaze.posZ + 0.5); - Utils.draw3DBox(aabb, 0xFF, 0x00, 0x00, 0xFF, event.partialTicks); + Utils.draw3DBox(aabb, LOWEST_BLAZE_COLOUR, event.partialTicks); } if (highestBlaze != null && !lowToHigh) { BlockPos stringPos = new BlockPos(highestBlaze.posX, highestBlaze.posY + 1, highestBlaze.posZ); - Utils.draw3DString(stringPos, EnumChatFormatting.BOLD + "Biggest", 0x40FF40, event.partialTicks); + Utils.draw3DString(stringPos, EnumChatFormatting.BOLD + "Biggest", HIGHEST_BLAZE_COLOUR, event.partialTicks); AxisAlignedBB aabb = new AxisAlignedBB(highestBlaze.posX - 0.5, highestBlaze.posY - 2, highestBlaze.posZ - 0.5, highestBlaze.posX + 0.5, highestBlaze.posY, highestBlaze.posZ + 0.5); - Utils.draw3DBox(aabb, 0x00, 0xFF, 0x00, 0xFF, event.partialTicks); + Utils.draw3DBox(aabb, HIGHEST_BLAZE_COLOUR, event.partialTicks); } } if (ToggleCommand.creeperToggled && drawCreeperLines && !creeperLines.isEmpty()) { diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index c5ede0c..c680716 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -393,18 +393,21 @@ public class ConfigHandler { if (!hasKey("scales", "cakeTimerScale")) writeDoubleConfig("scales", "cakeTimerScale", 1); if (!hasKey("scales", "skillTrackerScale")) writeDoubleConfig("scales", "skillTrackerScale", 1); - if (!hasKey("colors", "main")) writeStringConfig("colors", "main", "" + EnumChatFormatting.GREEN); - if (!hasKey("colors", "secondary")) writeStringConfig("colors", "secondary", "" + EnumChatFormatting.DARK_GREEN); - if (!hasKey("colors", "delimiter")) writeStringConfig("colors", "delimiter", "" + EnumChatFormatting.AQUA); - if (!hasKey("colors", "error")) writeStringConfig("colors", "error", "" + EnumChatFormatting.RED); - if (!hasKey("colors", "type")) writeStringConfig("colors", "type", "" + EnumChatFormatting.GREEN); - if (!hasKey("colors", "value")) writeStringConfig("colors", "value", "" + EnumChatFormatting.DARK_GREEN); - if (!hasKey("colors", "skillAverage")) writeStringConfig("colors", "skillAverage", "" + EnumChatFormatting.GOLD); - if (!hasKey("colors", "answer")) writeStringConfig("colors", "answer", "" + EnumChatFormatting.DARK_GREEN); - if (!hasKey("colors", "skill50Display")) writeStringConfig("colors", "skill50Display", "" + EnumChatFormatting.AQUA); - if (!hasKey("colors", "coordsDisplay")) writeStringConfig("colors", "coordsDisplay", "" + EnumChatFormatting.WHITE); - if (!hasKey("colors", "cakeDisplay")) writeStringConfig("colors", "cakeDisplay", "" + EnumChatFormatting.GOLD); - if (!hasKey("colors", "skillTracker")) writeStringConfig("colors", "skillTracker", "" + EnumChatFormatting.AQUA); + if (!hasKey("colors", "main")) writeStringConfig("colors", "main", EnumChatFormatting.GREEN.toString()); + if (!hasKey("colors", "secondary")) writeStringConfig("colors", "secondary", EnumChatFormatting.DARK_GREEN.toString()); + if (!hasKey("colors", "delimiter")) writeStringConfig("colors", "delimiter", EnumChatFormatting.AQUA.toString()); + if (!hasKey("colors", "error")) writeStringConfig("colors", "error", EnumChatFormatting.RED.toString()); + if (!hasKey("colors", "type")) writeStringConfig("colors", "type", EnumChatFormatting.GREEN.toString()); + if (!hasKey("colors", "value")) writeStringConfig("colors", "value", EnumChatFormatting.DARK_GREEN.toString()); + if (!hasKey("colors", "skillAverage")) writeStringConfig("colors", "skillAverage", EnumChatFormatting.GOLD.toString()); + if (!hasKey("colors", "answer")) writeStringConfig("colors", "answer", EnumChatFormatting.DARK_GREEN.toString()); + if (!hasKey("colors", "skill50Display")) writeStringConfig("colors", "skill50Display", EnumChatFormatting.AQUA.toString()); + if (!hasKey("colors", "coordsDisplay")) writeStringConfig("colors", "coordsDisplay", EnumChatFormatting.WHITE.toString()); + if (!hasKey("colors", "cakeDisplay")) writeStringConfig("colors", "cakeDisplay", EnumChatFormatting.GOLD.toString()); + if (!hasKey("colors", "skillTracker")) writeStringConfig("colors", "skillTracker", EnumChatFormatting.AQUA.toString()); + if (!hasKey("colors", "triviaWrongAnswer")) writeStringConfig("colors", "triviaWrongAnswer", EnumChatFormatting.RED.toString()); + if (!hasKey("colors", "blazeLowest")) writeIntConfig("colors", "blazeLowest", 0xFF0000); + if (!hasKey("colors", "blazeHighest")) writeIntConfig("colors", "blazeHighest", 0x40FF40); ToggleCommand.gpartyToggled = getBoolean("toggles", "GParty"); ToggleCommand.coordsToggled = getBoolean("toggles", "Coords"); @@ -642,6 +645,9 @@ public class ConfigHandler { TheMod.COORDS_COLOUR = getString("colors", "coordsDisplay"); TheMod.CAKE_COLOUR = getString("colors", "cakeDisplay"); TheMod.SKILL_TRACKER_COLOUR = getString("colors", "skillTracker"); + TheMod.TRIVIA_WRONG_ANSWER_COLOUR = getString("colors", "triviaWrongAnswer"); + TheMod.LOWEST_BLAZE_COLOUR = getInt("colors", "blazeLowest"); + TheMod.HIGHEST_BLAZE_COLOUR = getInt("colors", "blazeHighest"); } } diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 4361f8f..29e61ed 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -312,9 +312,10 @@ public class Utils { } // Yoinked from ForgeHax - public static void draw3DBox(AxisAlignedBB aabb, int r, int g, int b, int a, float partialTicks) { + public static void draw3DBox(AxisAlignedBB aabb, int colourInt, float partialTicks) { Entity render = Minecraft.getMinecraft().getRenderViewEntity(); WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + Color colour = new Color(colourInt); double realX = render.lastTickPosX + (render.posX - render.lastTickPosX) * partialTicks; double realY = render.lastTickPosY + (render.posY - render.lastTickPosY) * partialTicks; @@ -327,7 +328,7 @@ public class Utils { GlStateManager.disableAlpha(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GL11.glLineWidth(2); - GlStateManager.color(r / 255f, g / 255f, b / 255f, a / 255f); + GlStateManager.color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue() / 255f, colour.getAlpha() / 255f); worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION); worldRenderer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex(); |