aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/tracker
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/tracker')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/tracker/KillTrackerHandler.java32
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java13
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java24
3 files changed, 9 insertions, 60 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/KillTrackerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/KillTrackerHandler.java
index 8f0608d..5d5615f 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/KillTrackerHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/KillTrackerHandler.java
@@ -26,47 +26,21 @@ public class KillTrackerHandler {
public void onDeath(LivingDeathEvent event) {
if (false) {
//Used for testing
- System.out.println(
- "----------------------------------------------------------------------------------------------------------------"
- );
+ System.out.println("----------------------------------------------------------------------------------------------------------------");
System.out.println("Name : " + event.entity.getName());
System.out.println("UUID : " + event.entity.getUniqueID());
NBTTagCompound tag = new NBTTagCompound();
event.entity.writeToNBT(tag);
System.out.println("Tag : " + tag);
System.out.println("Damage : " + getDamageSourceString(event.source));
- System.out.println(
- "----------------------------------------------------------------------------------------------------------------"
- );
+ System.out.println("----------------------------------------------------------------------------------------------------------------");
}
attackedEntities.remove(event.entity.getUniqueID());
}
public static String getDamageSourceString(DamageSource source) {
- return (
- "{ " +
- source.getDamageType() +
- ", " +
- source.isDamageAbsolute() +
- ", " +
- source.isDifficultyScaled() +
- ", " +
- source.isFireDamage() +
- ", " +
- source.isProjectile() +
- ", " +
- source.isUnblockable() +
- ", " +
- source.isExplosion() +
- ", " +
- source.isMagicDamage() +
- ", " +
- source.isCreativePlayer() +
- ", " +
- source.getSourceOfDamage() +
- " }"
- );
+ return ("{ " + source.getDamageType() + ", " + source.isDamageAbsolute() + ", " + source.isDifficultyScaled() + ", " + source.isFireDamage() + ", " + source.isProjectile() + ", " + source.isUnblockable() + ", " + source.isExplosion() + ", " + source.isMagicDamage() + ", " + source.isCreativePlayer() + ", " + source.getSourceOfDamage() + " }");
}
@SubscribeEvent
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java
index 858770a..624ca60 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java
@@ -78,10 +78,7 @@ public class TrackerFileLoader {
TrackerHandler.trackers.putIfAbsent(location, new TrackerHandler.TrackerData(events));
}
- tracker
- .get("location")
- .getAsJsonArray()
- .forEach(loc -> TrackerHandler.trackerIds.put(Locations.get(loc.getAsString()), location));
+ tracker.get("location").getAsJsonArray().forEach(loc -> TrackerHandler.trackerIds.put(Locations.get(loc.getAsString()), location));
}
}
@@ -127,9 +124,7 @@ public class TrackerFileLoader {
return true;
}
- try (
- BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8))
- ) {
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8))) {
JsonObject json = gson.fromJson(reader, JsonObject.class);
if (json.has("trackerStats")) {
json
@@ -169,9 +164,7 @@ public class TrackerFileLoader {
try {
configFile.createNewFile();
- try (
- BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8))
- ) {
+ try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8))) {
JsonObject json = new JsonObject();
json.add("trackerStats", getTrackerFile());
writer.write(gson.toJson(json));
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java
index f0a5b90..fa2bacf 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java
@@ -82,14 +82,7 @@ public class TrackerHandler {
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent.Post event) {
- if (
- Utils.overlayShouldRender(
- event.type,
- SkyblockHud.hasSkyblockScoreboard(),
- trackerIds.containsKey(LocationHandler.getCurrentLocation()),
- !SkyblockHud.config.trackers.hideTracker
- )
- ) {
+ if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), trackerIds.containsKey(LocationHandler.getCurrentLocation()), !SkyblockHud.config.trackers.hideTracker)) {
String trackerId = trackerIds.get(LocationHandler.getCurrentLocation());
Minecraft mc = Minecraft.getMinecraft();
TrackerData tracked = trackers.get(trackerId);
@@ -103,13 +96,7 @@ public class TrackerHandler {
Gui.drawRect(startPos, y, startPos + 120, y + 10, -1072689136);
mc.fontRendererObj.drawString("Tracker", startPos + 4, y + 1, 0xffffff, false);
y += 10;
- Gui.drawRect(
- startPos,
- y,
- startPos + (tracker.size() >= 6 ? 120 : tracker.size() * 20),
- (int) (y + (Math.ceil(tracker.size() / 5d) * 20)),
- 1610612736
- );
+ Gui.drawRect(startPos, y, startPos + (tracker.size() >= 6 ? 120 : tracker.size() * 20), (int) (y + (Math.ceil(tracker.size() / 5d) * 20)), 1610612736);
int x = startPos;
for (ItemStack stack : tracker.values()) {
String s = String.valueOf(stack.stackSize);
@@ -118,12 +105,7 @@ public class TrackerHandler {
drawItemStack(stack, x, y);
GlStateManager.disableDepth();
GlStateManager.disableBlend();
- mc.fontRendererObj.drawStringWithShadow(
- s,
- (float) (x + 19 - 2 - mc.fontRendererObj.getStringWidth(s)),
- (float) (y + 9),
- stack.stackSize < 1 ? 16733525 : 16777215
- );
+ mc.fontRendererObj.drawStringWithShadow(s, (float) (x + 19 - 2 - mc.fontRendererObj.getStringWidth(s)), (float) (y + 9), stack.stackSize < 1 ? 16733525 : 16777215);
GlStateManager.enableBlend();
GlStateManager.enableDepth();