From e4ad455ed428eaaf79a005943cc1305b5de692d3 Mon Sep 17 00:00:00 2001 From: TotalledZebra <50877472+TotalledZebra@users.noreply.github.com> Date: Tue, 18 May 2021 01:33:11 +0300 Subject: Blaze solver change Suggested on Discord, the quality might be poor but it has worked on well over a hundred Dungeon runs so far... --- .../Danker/features/puzzlesolvers/BlazeSolver.java | 74 ++++++++++++++++++---- 1 file changed, 60 insertions(+), 14 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/features/puzzlesolvers/BlazeSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/BlazeSolver.java index 0910fc7..a2e3395 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/BlazeSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/BlazeSolver.java @@ -3,8 +3,11 @@ package me.Danker.features.puzzlesolvers; import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; import me.Danker.utils.Utils; +import net.minecraft.block.Block; import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumChatFormatting; @@ -21,11 +24,15 @@ public class BlazeSolver { static Entity highestBlaze = null; static Entity lowestBlaze = null; + static boolean higherToLower = false; + static boolean foundChest = false; public static int LOWEST_BLAZE_COLOUR; public static int HIGHEST_BLAZE_COLOUR; @SubscribeEvent public void onWorldChange(WorldEvent.Load event) { + higherToLower = false; + foundChest = false; lowestBlaze = null; highestBlaze = null; } @@ -34,9 +41,13 @@ public class BlazeSolver { public void onTick(TickEvent.ClientTickEvent event) { if (event.phase != TickEvent.Phase.START) return; - World world = Minecraft.getMinecraft().theWorld; + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayerSP player = mc.thePlayer; + World world = mc.theWorld; + if (DankersSkyblockMod.tickAmount % 4 == 0) { - if (ToggleCommand.blazeToggled && Utils.inDungeons && world != null) { + if (ToggleCommand.blazeToggled && Utils.inDungeons && world != null && player != null) { + List entities = world.getLoadedEntityList(); int highestHealth = 0; highestBlaze = null; @@ -61,6 +72,27 @@ public class BlazeSolver { } } } + + if (!foundChest) { + new Thread(() -> { + Iterable blocks = BlockPos.getAllInBox(new BlockPos(player.posX - 27, 69, player.posZ - 27), new BlockPos(player.posX + 27, 70, player.posZ + 27)); + for (BlockPos blockPos : blocks) { + Block block = world.getBlockState(blockPos).getBlock(); + if (block == Blocks.chest && world.getBlockState(blockPos.add(0, 1, 0)).getBlock() == Blocks.iron_bars) { + Block blockbelow = world.getBlockState(blockPos.add(0, -1, 0)).getBlock(); + if (blockbelow == Blocks.stone) { + higherToLower = false; + foundChest = true; + } else if (blockbelow == Blocks.air) { + higherToLower = true; + foundChest = true; + } else { + return; + } + } + } + }).start(); + } } } } @@ -68,19 +100,33 @@ public class BlazeSolver { @SubscribeEvent public void onWorldRender(RenderWorldLastEvent event) { if (ToggleCommand.blazeToggled && Utils.inDungeons) { - if (lowestBlaze != null) { - BlockPos stringPos = new BlockPos(lowestBlaze.posX, lowestBlaze.posY + 1, lowestBlaze.posZ); - 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, LOWEST_BLAZE_COLOUR, event.partialTicks); - } - if (highestBlaze != null) { - BlockPos stringPos = new BlockPos(highestBlaze.posX, highestBlaze.posY + 1, highestBlaze.posZ); - 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, HIGHEST_BLAZE_COLOUR, event.partialTicks); + if (foundChest) { + if (lowestBlaze != null && !higherToLower) { + BlockPos stringPos = new BlockPos(lowestBlaze.posX, lowestBlaze.posY + 1, lowestBlaze.posZ); + Utils.draw3DString(stringPos, EnumChatFormatting.BOLD + "Shoot me!", 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, LOWEST_BLAZE_COLOUR, event.partialTicks); + } + if (highestBlaze != null && higherToLower) { + BlockPos stringPos = new BlockPos(highestBlaze.posX, highestBlaze.posY + 1, highestBlaze.posZ); + Utils.draw3DString(stringPos, EnumChatFormatting.BOLD + "Shoot me!", LOWEST_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, LOWEST_BLAZE_COLOUR, event.partialTicks); + } + } else { + if (lowestBlaze != null) { + BlockPos stringPos = new BlockPos(lowestBlaze.posX, lowestBlaze.posY + 1, lowestBlaze.posZ); + 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, LOWEST_BLAZE_COLOUR, event.partialTicks); + } + if (highestBlaze != null) { + BlockPos stringPos = new BlockPos(highestBlaze.posX, highestBlaze.posY + 1, highestBlaze.posZ); + 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, HIGHEST_BLAZE_COLOUR, event.partialTicks); + } } } } - } -- cgit From f121a983c474c2defc36c3dd5266e4d2808bc45f Mon Sep 17 00:00:00 2001 From: TotalledZebra <50877472+TotalledZebra@users.noreply.github.com> Date: Wed, 19 May 2021 00:03:26 +0300 Subject: Update BlazeSolver.java Added a couple messages for when the chest is detected. --- src/main/java/me/Danker/features/puzzlesolvers/BlazeSolver.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/me/Danker/features/puzzlesolvers/BlazeSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/BlazeSolver.java index a2e3395..e9d6f3f 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/BlazeSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/BlazeSolver.java @@ -83,9 +83,11 @@ public class BlazeSolver { if (blockbelow == Blocks.stone) { higherToLower = false; foundChest = true; + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Chest located. Sorting from lowest to highest.")); } else if (blockbelow == Blocks.air) { higherToLower = true; foundChest = true; + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Chest located. Sorting from highest to lowest.")); } else { return; } -- cgit