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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
/*
* Copyright (C) 2022 NotEnoughUpdates contributors
*
* This file is part of NotEnoughUpdates.
*
* NotEnoughUpdates is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* NotEnoughUpdates is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
*/
package io.github.moulberry.notenoughupdates.miscfeatures;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe;
import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.overlays.MiningOverlay;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.lwjgl.util.vector.Vector3f;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@NEUAutoSubscribe
public class DwarvenMinesWaypoints {
private final HashMap<String, Vector3f> waypointsMap = new HashMap<String, Vector3f>() {{
put("Dwarven Village", new Vector3f(-37, 199, -122));
put("Miner's Guild", new Vector3f(-74, 220, -122));
put("Fetchur", new Vector3f(85, 223, -120));
put("Palace Bridge", new Vector3f(129, 186, 8));
put("Royal Palace", new Vector3f(129, 194, 194));
put("Puzzler", new Vector3f(181, 195, 135));
put("Grand Library", new Vector3f(183, 195, 181));
put("Barracks of Heroes", new Vector3f(93, 195, 181));
put("Royal Mines", new Vector3f(178, 149, 71));
put("Cliffside Veins", new Vector3f(40, 136, 17));
put("Forge Basin", new Vector3f(0, 169, -2));
put("The Forge", new Vector3f(0, 148, -69));
put("Rampart's Quarry", new Vector3f(-106, 147, 2));
put("Far Reserve", new Vector3f(-160, 148, 17));
put("Upper Mines", new Vector3f(-123, 170, -71));
put("Goblin Burrows", new Vector3f(-138, 143, 141));
put("Great Ice Wall", new Vector3f(0, 127, 160));
put("Aristocrat Passage", new Vector3f(129, 150, 137));
put("Hanging Court", new Vector3f(91, 186, 129));
put("Divan's Gateway", new Vector3f(0, 127, 87));
put("Lava Springs", new Vector3f(57, 196, -15));
put("The Mist", new Vector3f(0, 75, 82));
}};
private static final HashSet<String> emissaryNames = new HashSet<String>() {{
add(EnumChatFormatting.GOLD + "Emissary Ceanna" + EnumChatFormatting.RESET);
add(EnumChatFormatting.GOLD + "Emissary Carlton" + EnumChatFormatting.RESET);
add(EnumChatFormatting.GOLD + "Emissary Wilson" + EnumChatFormatting.RESET);
add(EnumChatFormatting.GOLD + "Emissary Lilith" + EnumChatFormatting.RESET);
add(EnumChatFormatting.GOLD + "Emissary Frasier" + EnumChatFormatting.RESET);
add(EnumChatFormatting.GOLD + "Emissary Eliza" + EnumChatFormatting.RESET);
add(EnumChatFormatting.GOLD.toString() + EnumChatFormatting.BOLD + "King" + EnumChatFormatting.RESET);
}};
private enum Emissary {
KING("King", 0, new Vector3f(129, 196, 196)),
CEANNA("Emissary Ceanna", 1, new Vector3f(42, 134, 22)),
CARLTON("Emissary Carlton", 1, new Vector3f(-73, 153, -11)),
WILSON("Emissary Wilson", 2, new Vector3f(171, 150, 31)),
LILITH("Emissary Lilith", 2, new Vector3f(58, 198, -8)),
FRAISER("Emissary Frasier", 3, new Vector3f(-132, 174, -50)),
ELIZA("Emissary Eliza", 3, new Vector3f(-37, 200, -131));
String name;
int minMilestone;
Vector3f loc;
Emissary(String name, int minMilestone, Vector3f loc) {
this.name = name;
this.minMilestone = minMilestone;
this.loc = loc;
}
}
private long dynamicMillis = 0;
private String dynamicLocation = null;
private String dynamicName = null;
private final Pattern ghastRegex = Pattern.compile(
"\u00A7r\u00A7eFind the \u00A7r\u00A76Powder Ghast\u00A7r\u00A7e near the \u00A7r\u00A7b(.+)!");
private final Pattern fallenStarRegex = Pattern.compile(
"\u00A7r\u00A75Fallen Star \u00A7r\u00A7ehas crashed at \u00A7r\u00A7b(.+)\u00A7r\u00A7e!");
@SubscribeEvent
public void onChat(ClientChatReceivedEvent event) {
Matcher matcherGhast = ghastRegex.matcher(event.message.getFormattedText());
if (matcherGhast.find() && NotEnoughUpdates.INSTANCE.config.mining.powderGhastWaypoint) {
dynamicLocation = Utils.cleanColour(matcherGhast.group(1).trim());
dynamicName = EnumChatFormatting.GOLD + "Powder Ghast";
dynamicMillis = System.currentTimeMillis();
} else {
Matcher matcherStar = fallenStarRegex.matcher(event.message.getFormattedText());
if (matcherStar.find() && NotEnoughUpdates.INSTANCE.config.mining.fallenStarWaypoint) {
dynamicLocation = Utils.cleanColour(matcherStar.group(1).trim());
dynamicName = EnumChatFormatting.DARK_PURPLE + "Fallen Star";
dynamicMillis = System.currentTimeMillis();
}
}
}
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
emissaryRemovedDistSq = -1;
if (SBInfo.getInstance().getLocation() == null) return;
if (!SBInfo.getInstance().getLocation().equals("mining_3")) return;
NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific();
if (hidden == null) return;
if (Minecraft.getMinecraft().currentScreen instanceof GuiChest) {
GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
ContainerChest container = (ContainerChest) chest.inventorySlots;
IInventory lower = container.getLowerChestInventory();
if (lower.getDisplayName().getFormattedText().contains("Commissions")) {
for (int i = 0; i < lower.getSizeInventory(); i++) {
ItemStack stack = lower.getStackInSlot(i);
if (stack == null) continue;
if (stack.getDisplayName().equals(EnumChatFormatting.YELLOW + "Commission Milestones")) {
hidden.commissionMilestone = 5;
String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound());
for (String line : lore) {
String clean = Utils.cleanColour(line);
switch (clean) {
case "Tier I Rewards:":
hidden.commissionMilestone = 0;
break;
case "Tier II Rewards:":
hidden.commissionMilestone = 1;
break;
case "Tier III Rewards:":
hidden.commissionMilestone = 2;
break;
case "Tier IV Rewards:":
hidden.commissionMilestone = 3;
break;
case "Tier V Rewards:":
hidden.commissionMilestone = 4;
break;
}
}
return;
}
}
}
}
}
private boolean commissionFinished = false;
private double emissaryRemovedDistSq = 0;
@SubscribeEvent
public void onRenderSpecial(RenderLivingEvent
|