1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
package me.Danker.features.puzzlesolvers;
import me.Danker.DankersSkyblockMod;
import me.Danker.commands.ToggleCommand;
import me.Danker.utils.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StringUtils;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.List;
public class BlazeSolver {
static Entity highestBlaze = null;
static Entity lowestBlaze = null;
public static int LOWEST_BLAZE_COLOUR;
public static int HIGHEST_BLAZE_COLOUR;
@SubscribeEvent
public void onWorldChange(WorldEvent.Load event) {
lowestBlaze = null;
highestBlaze = null;
}
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
if (event.phase != TickEvent.Phase.START) return;
World world = Minecraft.getMinecraft().theWorld;
if (DankersSkyblockMod.tickAmount % 4 == 0) {
if (ToggleCommand.blazeToggled && Utils.inDungeons && world != null) {
List<Entity> entities = world.getLoadedEntityList();
int highestHealth = 0;
highestBlaze = null;
int lowestHealth = 99999999;
lowestBlaze = null;
for (Entity entity : entities) {
if (entity.getName().contains("Blaze") && entity.getName().contains("/")) {
String blazeName = StringUtils.stripControlCodes(entity.getName());
try {
int health = Integer.parseInt(blazeName.substring(blazeName.indexOf("/") + 1, blazeName.length() - 1));
if (health > highestHealth) {
highestHealth = health;
highestBlaze = entity;
}
if (health < lowestHealth) {
lowestHealth = health;
lowestBlaze = entity;
}
} catch (NumberFormatException ex) {
ex.printStackTrace();
}
}
}
}
}
}
@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);
}
}
}
}
|