diff options
author | Lorenz <ESs95s3P5z8Pheb> | 2022-07-08 16:12:55 +0200 |
---|---|---|
committer | Lorenz <ESs95s3P5z8Pheb> | 2022-07-08 16:12:55 +0200 |
commit | 4463c7fa78f886a8abc09e867dd17cde2a685ad4 (patch) | |
tree | 9245b4eed7f410f1c168688a77eeda6bfd55c994 /src/main/java/com/thatgravyboat/skyblockhud/tracker | |
parent | 9e08dbf2baa9819abd281ad285df7462c99491e2 (diff) | |
download | skyhanni-4463c7fa78f886a8abc09e867dd17cde2a685ad4.tar.gz skyhanni-4463c7fa78f886a8abc09e867dd17cde2a685ad4.tar.bz2 skyhanni-4463c7fa78f886a8abc09e867dd17cde2a685ad4.zip |
code cleanup
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/tracker')
3 files changed, 0 insertions, 341 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java deleted file mode 100644 index ef51769ee..000000000 --- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerFileLoader.java +++ /dev/null @@ -1,136 +0,0 @@ -//package com.thatgravyboat.skyblockhud.tracker; -// -//import com.google.gson.*; -//import at.lorenz.mod.LorenzMod; -//import com.thatgravyboat.skyblockhud.location.Locations; -//import java.io.*; -//import java.nio.charset.StandardCharsets; -//import java.util.EnumSet; -//import java.util.HashMap; -//import java.util.Locale; -//import net.minecraft.client.Minecraft; -//import net.minecraft.util.ResourceLocation; -// -//public class TrackerFileLoader { -// -// private static final Gson gson = new GsonBuilder().create(); -// -// private static void loadTrackers(JsonObject object) { -// for (JsonElement element : object.get("trackers").getAsJsonArray()) { -// JsonObject tracker = element.getAsJsonObject(); -// EnumSet<Locations> locations = EnumSet.noneOf(Locations.class); -// tracker -// .get("location") -// .getAsJsonArray() -// .forEach(l -> { -// Locations location = Locations.get(l.getAsString().toUpperCase(Locale.ENGLISH)); -// if (location != Locations.DEFAULT) { -// locations.add(location); -// } -// }); -// if (tracker.has("drops")) { -// for (JsonElement drop : tracker.get("drops").getAsJsonArray()) { -// TrackerHandler.trackerObjects.add(new TrackerObject(drop.getAsJsonObject(), locations)); -// } -// } -// if (tracker.has("mobs")) { -// for (JsonElement mob : tracker.get("mobs").getAsJsonArray()) { -// TrackerHandler.trackerObjects.add(new TrackerObject(mob.getAsJsonObject(), locations)); -// } -// } -// } -// -// for (TrackerObject trackerObject : TrackerHandler.trackerObjects) { -// for (Locations location : trackerObject.getLocations()) { -// if (TrackerHandler.trackers.containsKey(location)) { -// TrackerHandler.trackers.get(location).put(trackerObject.getInternalId(), trackerObject); -// } else { -// HashMap<String, TrackerObject> value = new HashMap<>(); -// value.put(trackerObject.getInternalId(), trackerObject); -// TrackerHandler.trackers.put(location, value); -// } -// } -// } -// } -// -// public static void loadTrackersFile() { -// TrackerHandler.trackers.clear(); -// TrackerHandler.trackerObjects.clear(); -// try { -// ResourceLocation trackers = new ResourceLocation("skyblockhud:data/trackers.json"); -// InputStream is = Minecraft.getMinecraft().getResourceManager().getResource(trackers).getInputStream(); -// -// try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) { -// loadTrackers(gson.fromJson(reader, JsonObject.class)); -// } -// } catch (Exception ignored) {} -// } -// -// private static JsonElement getTrackerFile() { -// JsonArray stats = new JsonArray(); -// TrackerHandler.trackerObjects.forEach(trackerObject -> { -// if (trackerObject.getCount() > 0) { -// JsonObject jsonObject = new JsonObject(); -// JsonArray locations = new JsonArray(); -// trackerObject.getLocations().forEach(l -> locations.add(new JsonPrimitive(l.toString().toUpperCase(Locale.ENGLISH)))); -// jsonObject.add("id", new JsonPrimitive(trackerObject.getInternalId())); -// jsonObject.add("locations", locations); -// jsonObject.add("count", new JsonPrimitive(trackerObject.getCount())); -// stats.add(jsonObject); -// } -// }); -// return stats; -// } -// -// public static boolean loadTrackerStatsFile() { -// File configFile = new File(LorenzMod.configDirectory, "sbh-trackers-stats.json"); -// -// try { -// if (configFile.createNewFile()) { -// return true; -// } -// -// 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 -// .getAsJsonArray("trackerStats") -// .forEach(element -> { -// if (element.isJsonObject()) { -// JsonObject object = element.getAsJsonObject(); -// JsonArray locations = object.get("locations").getAsJsonArray(); -// Locations firstLocation = null; -// for (JsonElement location : locations) { -// firstLocation = Locations.get(location.getAsString()); -// if (!firstLocation.equals(Locations.DEFAULT)) break; -// } -// -// if (firstLocation != null && !firstLocation.equals(Locations.DEFAULT)) { -// TrackerHandler.trackers.get(firstLocation).get(object.get("id").getAsString()).setCount(object.get("count").getAsInt()); -// } -// } -// }); -// -// TrackerHandler.trackers.forEach((location, map) -> { -// TrackerHandler.trackers.put(location, TrackerHandler.sortTrackers(map, (entry1, entry2) -> Integer.compare(entry2.getValue().getCount(), entry1.getValue().getCount()))); -// }); -// } -// } -// } catch (Exception ignored) {} -// return false; -// } -// -// public static void saveTrackerStatsFile() { -// File configFile = new File(LorenzMod.configDirectory, "sbh-trackers-stats.json"); -// -// try { -// configFile.createNewFile(); -// -// 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)); -// } -// } catch (IOException ignored) {} -// } -//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java deleted file mode 100644 index 7cb059ba5..000000000 --- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerHandler.java +++ /dev/null @@ -1,108 +0,0 @@ -//package com.thatgravyboat.skyblockhud.tracker; -// -//import at.lorenz.mod.LorenzMod; -//import com.thatgravyboat.skyblockhud.api.events.SkyBlockEntityKilled; -//import com.thatgravyboat.skyblockhud.location.LocationHandler; -//import com.thatgravyboat.skyblockhud.location.Locations; -//import java.util.*; -//import net.minecraft.client.Minecraft; -//import net.minecraft.client.gui.Gui; -//import net.minecraft.client.renderer.RenderHelper; -//import net.minecraft.client.renderer.entity.RenderItem; -//import net.minecraft.item.ItemStack; -//import net.minecraftforge.client.event.RenderGameOverlayEvent; -//import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -// -//public class TrackerHandler extends Gui { -// -// public static Set<TrackerObject> trackerObjects = new HashSet<>(); -// public static LinkedHashMap<Locations, Map<String, TrackerObject>> trackers = new LinkedHashMap<>(); -// -// public static <K, V> Map<K, V> sortTrackers(Map<K, V> map, Comparator<? super Map.Entry<K, V>> comparator) { -// List<Map.Entry<K, V>> list = new ArrayList<>(map.entrySet()); -// list.sort(comparator); -// -// Map<K, V> result = new LinkedHashMap<>(); -// for (Map.Entry<K, V> entry : list) { -// result.put(entry.getKey(), entry.getValue()); -// } -// -// return result; -// } -// -// public static void onItemAdded(String id, int amount, String specialId, int number) { -// if (LorenzMod.hasSkyblockScoreboard() && trackers.containsKey(LocationHandler.getCurrentLocation())) { -// Map<String, TrackerObject> trackerMap = trackers.get(LocationHandler.getCurrentLocation()); -// String dropId = id; -// if (specialId != null) { -// dropId = specialId.toUpperCase() + ";" + number; -// } -// -// if (trackerMap != null && trackerMap.containsKey(dropId)) { -// TrackerObject object = trackerMap.get(dropId); -// object.increaseCount(amount); -// trackers.put(LocationHandler.getCurrentLocation(), sortTrackers(trackerMap, (entry1, entry2) -> Integer.compare(entry2.getValue().getCount(), entry1.getValue().getCount()))); -// } -// } -// } -// -// public static void drawItemStack(ItemStack stack, int x, int y) { -// if (stack == null) return; -// RenderItem itemRender = Minecraft.getMinecraft().getRenderItem(); -// RenderHelper.enableGUIStandardItemLighting(); -// itemRender.zLevel = -145; -// itemRender.renderItemAndEffectIntoGUI(stack, x, y); -// itemRender.zLevel = 0; -// RenderHelper.disableStandardItemLighting(); -// } -// -// @SubscribeEvent -// public void onSbEntityDeath(SkyBlockEntityKilled event) { -// if (LorenzMod.hasSkyblockScoreboard() && trackers.containsKey(LocationHandler.getCurrentLocation())) { -// Map<String, TrackerObject> trackerMap = trackers.get(LocationHandler.getCurrentLocation()); -// if (trackerMap.containsKey("ENTITY:" + event.id)) { -// TrackerObject object = trackerMap.get("ENTITY:" + event.id); -// object.increaseCount(); -// trackers.put(LocationHandler.getCurrentLocation(), sortTrackers(trackerMap, (entry1, entry2) -> Integer.compare(entry2.getValue().getCount(), entry1.getValue().getCount()))); -// } -// } -// } -// -// @SubscribeEvent -// public void renderOverlay(RenderGameOverlayEvent.Post event) { -// // if (Utils.overlayShouldRender(event.type, SkyblockHud.hasSkyblockScoreboard(), trackers.containsKey(LocationHandler.getCurrentLocation()), !SkyblockHud.config.trackers.hideTracker)) { -// // Map<String, TrackerObject> tracker = trackers.get(LocationHandler.getCurrentLocation()); -// // Minecraft mc = Minecraft.getMinecraft(); -// // -// // if (tracker != null) { -// // Position pos = SkyblockHud.config.trackers.trackerPosition; -// // int startPos = pos.getAbsX(event.resolution, (tracker.size() >= 6 ? 130 : tracker.size() * 20)); -// // int y = pos.getAbsY(event.resolution, (int) (10 + Math.ceil(tracker.size() / 5d) * 20)); -// // -// // Gui.drawRect(startPos, y, startPos + 130, y + 10, -1072689136); -// // mc.fontRendererObj.drawString("Tracker", startPos + 4, y + 1, 0xffffff, false); -// // y += 10; -// // Gui.drawRect(startPos, y, startPos + (tracker.size() >= 6 ? 130 : (tracker.size() * 20) + 10), (int) (y + (Math.ceil(tracker.size() / 5d) * 20)), 1610612736); -// // int x = startPos + 5; -// // for (TrackerObject object : tracker.values()) { -// // String s = Utils.formattedNumber(object.getCount(), 1000); -// // GlStateManager.disableLighting(); -// // GlStateManager.enableDepth(); -// // drawItemStack(object.getDisplayStack(), x, y); -// // GlStateManager.disableDepth(); -// // GlStateManager.disableBlend(); -// // mc.fontRendererObj.drawStringWithShadow(s, (float) (x + 19 - 2 - mc.fontRendererObj.getStringWidth(s)), (float) (y + 9), object.getCount() < 1 ? 16733525 : 16777215); -// // GlStateManager.enableBlend(); -// // GlStateManager.enableDepth(); -// // -// // if ((x - startPos + 5) / 20 == 5) { -// // x = startPos + 5; -// // y += 20; -// // } else { -// // x += 20; -// // } -// // } -// // } -// // } -// } -//} diff --git a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerObject.java b/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerObject.java deleted file mode 100644 index 0f827c6c3..000000000 --- a/src/main/java/com/thatgravyboat/skyblockhud/tracker/TrackerObject.java +++ /dev/null @@ -1,97 +0,0 @@ -//package com.thatgravyboat.skyblockhud.tracker; -// -//import com.google.gson.JsonObject; -//import com.thatgravyboat.skyblockhud.location.Locations; -//import java.util.EnumSet; -//import java.util.Locale; -//import net.minecraft.item.Item; -//import net.minecraft.item.ItemStack; -//import net.minecraft.nbt.NBTBase; -//import net.minecraft.nbt.NBTTagCompound; -//import net.minecraft.nbt.NBTTagList; -//import net.minecraft.util.ResourceLocation; -// -//public class TrackerObject { -// -// private final ItemStack stack; -// private final String internalId; -// private final EnumSet<Locations> locations; -// private final boolean isEntity; -// private int count; -// -// public TrackerObject(JsonObject jsonObject, EnumSet<Locations> locations) { -// this.stack = decodeToItemStack(jsonObject); -// this.internalId = jsonObject.get("id").getAsString(); -// this.isEntity = jsonObject.get("id").getAsString().contains("entity:"); -// this.locations = locations; -// } -// -// public static ItemStack decodeToItemStack(JsonObject jsonObject) { -// jsonObject = jsonObject.getAsJsonObject("displayItem"); -// int meta = jsonObject.get("meta").getAsInt(); -// ResourceLocation itemid = new ResourceLocation(jsonObject.get("item").getAsString()); -// ItemStack stack = new ItemStack(Item.itemRegistry.getObject(itemid), 0, meta); -// if (jsonObject.has("displayName")) stack.setStackDisplayName(jsonObject.get("displayName").getAsString()); -// if (jsonObject.has("skullData") && itemid.getResourcePath().equals("skull") && meta == 3) { -// stack.setTagInfo("SkullOwner", getSkullTag(jsonObject.getAsJsonObject("skullData"))); -// } -// if (jsonObject.has("enchanted") && jsonObject.get("enchanted").getAsBoolean()) { -// stack.setTagInfo("ench", new NBTTagList()); -// } -// if (!jsonObject.get("id").getAsString().contains("entity:")) { -// NBTTagCompound extraAttributes = new NBTTagCompound(); -// extraAttributes.setString("id", jsonObject.get("id").getAsString()); -// stack.setTagInfo("ExtraAttributes", extraAttributes); -// } -// return stack; -// } -// -// public static NBTBase getSkullTag(JsonObject skullObject) { -// NBTTagCompound skullOwner = new NBTTagCompound(); -// NBTTagCompound properties = new NBTTagCompound(); -// NBTTagList textures = new NBTTagList(); -// NBTTagCompound value = new NBTTagCompound(); -// -// skullOwner.setString("Id", skullObject.get("id").getAsString()); -// -// value.setString("Value", skullObject.get("texture").getAsString()); -// textures.appendTag(value); -// -// properties.setTag("textures", textures); -// -// skullOwner.setTag("Properties", properties); -// return skullOwner; -// } -// -// public void increaseCount(int amount) { -// count += amount; -// } -// -// public void increaseCount() { -// count++; -// } -// -// public void setCount(int count) { -// this.count = count; -// } -// -// public int getCount() { -// return count; -// } -// -// public ItemStack getDisplayStack() { -// return stack; -// } -// -// public EnumSet<Locations> getLocations() { -// return locations; -// } -// -// public String getInternalId() { -// return internalId.toUpperCase(Locale.ENGLISH); -// } -// -// public boolean isEntity() { -// return isEntity; -// } -//} |