diff options
author | bowser0000 <bowser0000@gmail.com> | 2021-02-15 00:41:56 -0500 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2021-02-15 00:41:56 -0500 |
commit | 50687d5b7d6a2bea7e55a314f925cbea81284567 (patch) | |
tree | 11318307fe35cc8e1a6ea1bcd6ef44827abfd94c /src | |
parent | 35b77eb3357a54a30a930b91fdb9752ee35add20 (diff) | |
download | SkyblockMod-50687d5b7d6a2bea7e55a314f925cbea81284567.tar.gz SkyblockMod-50687d5b7d6a2bea7e55a314f925cbea81284567.tar.bz2 SkyblockMod-50687d5b7d6a2bea7e55a314f925cbea81284567.zip |
Highlight correct 3 weirdos chest
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/me/Danker/DankersSkyblockMod.java | 30 | ||||
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 66 |
2 files changed, 91 insertions, 5 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index e979842..1aafab8 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -113,6 +113,7 @@ public class DankersSkyblockMod { static String[] riddleSolutions = {"The reward is not in my chest!", "At least one of them is lying, and the reward is not in", "My chest doesn't have the reward. We are all telling the truth", "My chest has the reward and I'm telling the truth", "The reward isn't in any of our chests", "Both of them are telling the truth."}; + static BlockPos riddleChest = null; static Map<String, String[]> triviaSolutions = new HashMap<>(); static String[] triviaAnswers = null; static Entity highestBlaze = null; @@ -414,6 +415,7 @@ public class DankersSkyblockMod { @SubscribeEvent public void onWorldChange(WorldEvent.Load event) { + riddleChest = null; foundLivid = false; livid = null; nextBonzoUse = 0; @@ -683,8 +685,30 @@ public class DankersSkyblockMod { if (ToggleCommand.threeManToggled && Utils.inDungeons && message.contains("[NPC]")) { for (String solution : riddleSolutions) { if (message.contains(solution)) { + Minecraft mc = Minecraft.getMinecraft(); String npcName = message.substring(message.indexOf("]") + 2, message.indexOf(":")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(ANSWER_COLOUR + EnumChatFormatting.BOLD + StringUtils.stripControlCodes(npcName) + MAIN_COLOUR + " has the blessing.")); + mc.thePlayer.addChatMessage(new ChatComponentText(ANSWER_COLOUR + EnumChatFormatting.BOLD + StringUtils.stripControlCodes(npcName) + MAIN_COLOUR + " has the blessing.")); + if (riddleChest == null) { + List<Entity> entities = mc.theWorld.getLoadedEntityList(); + for (Entity entity : entities) { + if (entity == null || !entity.hasCustomName()) continue; + if (entity.getCustomNameTag().contains(npcName)) { + BlockPos npcLocation = new BlockPos(entity.posX, 69, entity.posZ); + if (mc.theWorld.getBlockState(npcLocation.north()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.north(); + } else if (mc.theWorld.getBlockState(npcLocation.east()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.east(); + } else if (mc.theWorld.getBlockState(npcLocation.south()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.south(); + } else if (mc.theWorld.getBlockState(npcLocation.west()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.west(); + } else { + System.out.print("Could not find correct riddle chest."); + } + break; + } + } + } break; } } @@ -3143,6 +3167,10 @@ public class DankersSkyblockMod { @SubscribeEvent public void onWorldRender(RenderWorldLastEvent event) { + if (ToggleCommand.threeManToggled && riddleChest != null) { + Utils.drawFilled3DBox(new AxisAlignedBB(riddleChest.getX() - 0.05, riddleChest.getY(), riddleChest.getZ() - 0.05, riddleChest.getX() + 1.05, riddleChest.getY() + 1, riddleChest.getZ() + 1.05), 0x197F19, true, event.partialTicks); + } + if (ToggleCommand.blazeToggled) { if (lowestBlaze != null) { BlockPos stringPos = new BlockPos(lowestBlaze.posX, lowestBlaze.posY + 1, lowestBlaze.posZ); diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index abda6a3..b7c2ddf 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -8,10 +8,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.Entity; @@ -413,6 +410,67 @@ public class Utils { GlStateManager.popMatrix(); } + public static void drawFilled3DBox(AxisAlignedBB aabb, int colourInt, boolean translucent, 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; + double realZ = render.lastTickPosZ + (render.posZ - render.lastTickPosZ) * partialTicks; + + GlStateManager.pushMatrix(); + GlStateManager.pushAttrib(); + GlStateManager.translate(-realX, -realY, -realZ); + GlStateManager.disableTexture2D(); + GlStateManager.enableAlpha(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, translucent ? 1 : 771, 1, 0); + GlStateManager.disableCull(); + GlStateManager.color(colour.getRed() / 255f, colour.getGreen() / 255f, colour.getBlue() / 255f, colour.getAlpha() / 255f); + worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); + // Bottom + worldRenderer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex(); + worldRenderer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex(); + worldRenderer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex(); + worldRenderer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex(); + // Top + worldRenderer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex(); + worldRenderer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex(); + worldRenderer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex(); + worldRenderer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex(); + // West + worldRenderer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex(); + worldRenderer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex(); + worldRenderer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex(); + worldRenderer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex(); + // East + worldRenderer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex(); + worldRenderer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex(); + worldRenderer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex(); + worldRenderer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex(); + // North + worldRenderer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex(); + worldRenderer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex(); + worldRenderer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex(); + worldRenderer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex(); + // South + worldRenderer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex(); + worldRenderer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex(); + worldRenderer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex(); + worldRenderer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex(); + Tessellator.getInstance().draw(); + + GlStateManager.translate(realX, realY, realZ); + GlStateManager.enableCull(); + GlStateManager.disableAlpha(); + GlStateManager.disableBlend(); + GlStateManager.enableTexture2D(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.popAttrib(); + GlStateManager.popMatrix(); + } + public static void renderItem(ItemStack item, float x, float y, float z) { GlStateManager.enableRescaleNormal(); |