blob: 456ba0afa03b7de4fa5f47600b1404ee58b8fe65 (
plain)
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
|
package me.Danker.features;
import me.Danker.DankersSkyblockMod;
import me.Danker.commands.MoveCommand;
import me.Danker.commands.ScaleCommand;
import me.Danker.commands.ToggleCommand;
import me.Danker.events.RenderOverlay;
import me.Danker.handlers.ScoreboardHandler;
import me.Danker.handlers.TextRenderer;
import me.Danker.utils.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.util.StringUtils;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
public class GiantHPDisplay {
static Pattern f6GiantPattern = Pattern.compile("(Jolly Pink Giant|L\\.A\\.S\\.R\\.|The Diamond Giant|Bigfoot).*");
static List<Entity> giants = new ArrayList<>();
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
if (event.phase != TickEvent.Phase.START) return;
World world = Minecraft.getMinecraft().theWorld;
if (DankersSkyblockMod.tickAmount % 20 == 0) {
if (ToggleCommand.giantHP && Utils.inDungeons && world != null) {
giants.clear();
List<String> scoreboard = ScoreboardHandler.getSidebarLines();
String firstLine = ScoreboardHandler.cleanSB(scoreboard.get(scoreboard.size() - 1));
if (firstLine.contains("sadan")) {
List<Entity> entities = world.getLoadedEntityList();
for (Entity entity : entities) {
String name = StringUtils.stripControlCodes(entity.getName());
if (f6GiantPattern.matcher(name).find()) {
giants.add(entity);
}
}
} else if (firstLine.contains("138,30") || firstLine.contains("354,66") || firstLine.contains("138,66")) {
List<Entity> entities = world.getLoadedEntityList();
for (Entity entity : entities) {
if (entity.getName().contains("Giant ")) {
giants.add(entity);
}
}
}
}
}
}
@SubscribeEvent
public void renderPlayerInfo(RenderOverlay event) {
if (ToggleCommand.giantHP && Utils.inDungeons && giants.size() > 0) {
StringBuilder sb = new StringBuilder();
for (Entity giant : giants) {
if (!giant.isDead) sb.append(Utils.removeBold(giant.getDisplayName().getFormattedText())).append("\n");
}
new TextRenderer(Minecraft.getMinecraft(), sb.toString(), MoveCommand.giantHPXY[0], MoveCommand.giantHPXY[1], ScaleCommand.giantHPScale);
}
}
}
|