blob: 32f251de134860d586c20609fcc9940c70d089b2 (
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
74
75
76
|
package kr.syeyoung.dungeonsguide.dungeon;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.e;
import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessor;
import kr.syeyoung.dungeonsguide.utils.TextUtils;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.IntegerCache;
import net.minecraft.world.World;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
public class DungeonContext {
@Getter
private World world;
@Getter
private MapProcessor mapProcessor;
@Getter
@Setter
private BlockPos dungeonMin;
@Getter
private Map<Point, DungeonRoom> roomMapper = new HashMap<Point, DungeonRoom>();
@Getter
private List<DungeonRoom> dungeonRoomList = new ArrayList<DungeonRoom>();
@Getter
private List<RoomProcessor> globalRoomProcessors = new ArrayList<RoomProcessor>();
@Getter
private Map<String, Integer> deaths = new HashMap<String, Integer>();
@Getter
private List<String[]> milestoneReached = new ArrayList<String[]>();
@Getter
@Setter
private int BossRoomEnterSeconds;
public DungeonContext(World world) {
this.world = world;
mapProcessor = new MapProcessor(this);
}
public void tick() {
mapProcessor.tick();
}
public void onChat(ClientChatReceivedEvent event) {
IChatComponent component = event.message;
if (component.getFormattedText().contains("$DG-Comm")) {
event.setCanceled(true);
String data = component.getFormattedText().substring(component.getFormattedText().indexOf("$DG-Comm"));
String actual = TextUtils.stripColor(data);
String coords = actual.split(" ")[1];
String secrets = actual.split(" ")[2];
int x = Integer.parseInt(coords.split("/")[0]);
int z = Integer.parseInt(coords.split("/")[1]);
int secrets2 = Integer.parseInt(secrets);
Point roomPt = mapProcessor.worldPointToRoomPoint(new BlockPos(x,70,z));
e.sendDebugChat(new ChatComponentText("Message from Other dungeons guide :: "+roomPt.x+" / " + roomPt.y + " total secrets "+secrets2));
DungeonRoom dr = roomMapper.get(roomPt);
if (dr != null) {
dr.setTotalSecrets(secrets2);
}
}
}
}
|