aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2021-07-31 21:27:44 -0400
committerGitHub <noreply@github.com>2021-07-31 21:27:44 -0400
commiteb7efec1a37c06a55eb3add4b67888d3b1b7a043 (patch)
tree070e982cfe24e54921fd5db28cb9437ee807c6cc /src/main/java
parent5f2206d383afd3b6424ccda1a2d36522cfbe9b1f (diff)
parentf121a983c474c2defc36c3dd5266e4d2808bc45f (diff)
downloadSkyblockMod-eb7efec1a37c06a55eb3add4b67888d3b1b7a043.tar.gz
SkyblockMod-eb7efec1a37c06a55eb3add4b67888d3b1b7a043.tar.bz2
SkyblockMod-eb7efec1a37c06a55eb3add4b67888d3b1b7a043.zip
Merge pull request #99 from TotalledZebra/patch-1
Blaze solver change
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/me/Danker/features/puzzlesolvers/BlazeSolver.java76
1 files changed, 62 insertions, 14 deletions
diff --git a/src/main/java/me/Danker/features/puzzlesolvers/BlazeSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/BlazeSolver.java
index 0910fc7..e9d6f3f 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<Entity> entities = world.getLoadedEntityList();
int highestHealth = 0;
highestBlaze = null;
@@ -61,6 +72,29 @@ public class BlazeSolver {
}
}
}
+
+ if (!foundChest) {
+ new Thread(() -> {
+ Iterable<BlockPos> 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;
+ 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;
+ }
+ }
+ }
+ }).start();
+ }
}
}
}
@@ -68,19 +102,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);
+ }
}
}
}
-
}