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
87
|
package rosegoldaddons.features;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.entity.passive.EntityBat;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import rosegoldaddons.Main;
import rosegoldaddons.events.RenderLivingEntityEvent;
import rosegoldaddons.utils.ChatUtils;
import rosegoldaddons.utils.RenderUtils;
import rosegoldaddons.utils.ScoreboardUtils;
import java.awt.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
public class DungeonESP {
private static HashMap<Entity, Color> highlightedEntities = new HashMap<>();
private static HashSet<Entity> checkedStarNameTags = new HashSet<>();
private static void highlightEntity(Entity entity, Color color) {
highlightedEntities.put(entity, color);
}
@SubscribeEvent
public void onEntityJoinWorld(EntityJoinWorldEvent event) {
if (!ScoreboardUtils.inDungeon || !Main.configFile.dungeonESP) return;
if (event.entity instanceof EntityPlayer) {
String name = event.entity.getName();
switch (name) {
case "Shadow Assassin":
event.entity.setInvisible(false);
highlightEntity(event.entity, Color.MAGENTA);
break;
case "Lost Adventurer":
highlightEntity(event.entity, Color.BLUE);
break;
case "Diamond Guy":
highlightEntity(event.entity, Color.CYAN);
break;
}
}
if (event.entity instanceof EntityBat) {
highlightEntity(event.entity, Color.RED);
}
}
@SubscribeEvent
public void onRenderEntityLiving(RenderLivingEntityEvent event) {
if (!ScoreboardUtils.inDungeon || !Main.configFile.dungeonESP || checkedStarNameTags.contains(event.entity))
return;
if (event.entity instanceof EntityArmorStand) {
if (event.entity.hasCustomName() && event.entity.getCustomNameTag().contains("✯")) {
List<Entity> possibleEntities = event.entity.getEntityWorld().getEntitiesInAABBexcluding(event.entity, event.entity.getEntityBoundingBox().expand(0, 3, 0), entity -> !(entity instanceof EntityArmorStand));
if (!possibleEntities.isEmpty()) {
highlightEntity(possibleEntities.get(0), Color.ORANGE);
}
checkedStarNameTags.add(event.entity);
}
}
}
@SubscribeEvent
public void onRenderWorld(RenderWorldLastEvent event) {
if(ScoreboardUtils.inDungeon && Main.configFile.dungeonESP) {
Main.mc.theWorld.loadedEntityList.forEach(entity -> {
if(highlightedEntities.containsKey(entity)) {
RenderUtils.drawEntityBox(entity, highlightedEntities.get(entity), Main.configFile.lineWidth, event.partialTicks);
}
});
}
}
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event) {
highlightedEntities.clear();
checkedStarNameTags.clear();
}
}
|