diff --git a/build.gradle b/build.gradle index eaef946..49e0995 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,5 @@ plugins { id 'fabric-loom' version '1.2-SNAPSHOT' - id 'maven-publish' } version = "${project.mod_version}+${project.minecraft_version}" @@ -12,6 +11,8 @@ repositories { // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. // See https://docs.gradle.org/current/userguide/declaring_repositories.html // for more information about repositories. + maven { url "https://maven.terraformersmc.com/releases" } + maven { url "https://maven.shedaniel.me/" } } dependencies { @@ -19,6 +20,12 @@ dependencies { mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation("me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}") { + exclude group: "net.fabricmc.fabric-api" + exclude module: "modmenu" + } + include "me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}" + // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" } @@ -36,12 +43,6 @@ processResources { } tasks.withType(JavaCompile).configureEach { - // ensure that the encoding is set to UTF-8, no matter what the system default is - // this fixes some edge cases with special characters not displaying correctly - // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html - // If Javadoc is generated, this must be specified in that task too. - - // Minecraft 1.18 upwards uses Java 17. it.options.release = 17 } @@ -61,20 +62,3 @@ jar { rename { "${it}_${base.archivesName.get()}"} } } - -// configure the maven publication -publishing { - publications { - mavenJava(MavenPublication) { - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - // Add repositories to publish to here. - // Notice: This block does NOT have the same function as the block in the top level. - // The repositories here will be used for publishing your artifact, not for - // retrieving dependencies. - } -} diff --git a/gradle.properties b/gradle.properties index 7825b5e..6a2e189 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,12 +1,12 @@ # Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx1G +org.gradle.jvmargs=-Xmx4G org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop minecraft_version=1.19.4 yarn_mappings=1.19.4+build.2 -loader_version=0.14.20 +loader_version=0.14.21 # Mod Properties mod_version = 1.0.0 @@ -14,4 +14,5 @@ maven_group = lel.flummi archives_base_name = skilloverlay # Dependencies -fabric_version=0.79.0+1.19.4 +fabric_version=0.83.0+1.19.4 +clothconfig_version=10.0.96 diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..6689b85 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/src/main/java/lel/flummi/skilloverlay/api/PlayerProfile.java b/src/main/java/lel/flummi/skilloverlay/api/PlayerProfile.java index 1dabb91..687c192 100644 --- a/src/main/java/lel/flummi/skilloverlay/api/PlayerProfile.java +++ b/src/main/java/lel/flummi/skilloverlay/api/PlayerProfile.java @@ -2,51 +2,50 @@ package lel.flummi.skilloverlay.api; import net.minecraft.client.MinecraftClient; -import lel.flummi.skilloverlay.api.records.PlayerProfiles; +import java.io.InputStreamReader; +import java.net.URL; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import java.io.InputStreamReader; -import java.net.URL; -import java.util.Timer; -import java.util.TimerTask; +import lel.flummi.skilloverlay.api.records.Profile; +import lel.flummi.skilloverlay.api.records.Profile.Profiles.Member; +import lel.flummi.skilloverlay.config.skilloverlayconfig; public class PlayerProfile { - public static PlayerProfiles.PlayerProfile PROFILE; + public static Member PROFILE; public static void init() { - Timer timer = new Timer(); - timer.schedule(new TimerTask() { - @Override - public void run() { - PlayerProfiles profiles = PlayerProfile.updateProfile(); + String apikey = skilloverlayconfig.get().general.apiKey; + String uuid = MinecraftClient.getInstance().getSession().getUuidOrNull().toString().replace("-", ""); + String apiurl = "https://api.hypixel.net/skyblock/profiles?key=" + apikey + "&uuid=" + uuid; - PlayerProfiles.PlayerProfile currentProfile = profiles.profiles().get(""); - - for (PlayerProfiles.PlayerProfile profile: profiles.profiles().values()) { - if(profile.current() == true) { - currentProfile = profile; - } - } - - PROFILE = currentProfile; + if(apikey.length() > 0) { + Profile profile = PlayerProfile.updateProfile(apiurl); + if(profile != null) { + profile.profiles().removeIf(p -> !p.selected()); + PROFILE = profile.profiles().get(0).members().get(uuid); } - }, 0, 60 * 1000); + else { + System.out.println("leer uff"); + } + } } - public static PlayerProfiles updateProfile() { + public static Profile updateProfile(String apiurl) { + if(apiurl.length() == 0) + return null; + try { - URL url = new URL("https://sky.shiiyu.moe/api/v2/profile/" + MinecraftClient.getInstance().getSession().getUsername()); + URL url = new URL(apiurl); InputStreamReader reader = new InputStreamReader(url.openStream()); Gson gson = new GsonBuilder() .serializeNulls() .create(); - return gson.fromJson(reader, PlayerProfiles.class); + return gson.fromJson(reader, Profile.class); } catch (Exception e) { e.printStackTrace(); } return null; } - } diff --git a/src/main/java/lel/flummi/skilloverlay/api/records/Enchanting.java b/src/main/java/lel/flummi/skilloverlay/api/records/Enchanting.java deleted file mode 100644 index fe1a41d..0000000 --- a/src/main/java/lel/flummi/skilloverlay/api/records/Enchanting.java +++ /dev/null @@ -1,26 +0,0 @@ -package lel.flummi.skilloverlay.api.records; - -import com.google.gson.annotations.SerializedName; - -import java.util.HashMap; - -public record Enchanting(boolean experimented, HashMap experiments){ - public record Experiment( - String name, - Stats stats, - Tier[] tiers - - ){ - public record Stats( - @SerializedName("last_attempt") PlayerProfiles.PlayerProfile.Data.LastUpdated lastAttempt, - @SerializedName("bonus_clicks") int bonusClicks, - @SerializedName("last_claimed") PlayerProfiles.PlayerProfile.Data.LastUpdated lastClaimed - ){} - public record Tier( - String name, - int attempts, - int claims, - @SerializedName("best_score") int bestScore - ){} - } -} diff --git a/src/main/java/lel/flummi/skilloverlay/api/records/Farming.java b/src/main/java/lel/flummi/skilloverlay/api/records/Farming.java deleted file mode 100644 index 0496d17..0000000 --- a/src/main/java/lel/flummi/skilloverlay/api/records/Farming.java +++ /dev/null @@ -1,30 +0,0 @@ -package lel.flummi.skilloverlay.api.records; - -import com.google.gson.annotations.SerializedName; - -import java.util.HashMap; - -public record Farming( - boolean talked, - @SerializedName("current_badges") Badges currentBadges, - @SerializedName("total_badges") Badges totalBadges, - Perks perks, - @SerializedName("unique_golds") int unique_golds, - HashMap crops, - Contests contests -){ - public record Badges(int bronze, int silver, int gold){} - public record Perks(@SerializedName("double_drops") int doubleDrops, @SerializedName("farming_level_cap") int farmingLevelCap){} - public record Crop( - String name, - boolean attended, - @SerializedName("unique_gold") boolean uniqueGold, - int contests, - @SerializedName("personal_best") int personalBest, - Badges badges - ){} - public record Contests(@SerializedName("attended_contests") int attendedContests, @SerializedName("all_contests") Contest[] allContests){} - public record Contest(String date, String crop, int collected, boolean claimed, String medal, Placing placing){ - public record Placing(int position, double percentage){} - } -} diff --git a/src/main/java/lel/flummi/skilloverlay/api/records/Items.java b/src/main/java/lel/flummi/skilloverlay/api/records/Items.java deleted file mode 100644 index f8ea01d..0000000 --- a/src/main/java/lel/flummi/skilloverlay/api/records/Items.java +++ /dev/null @@ -1,52 +0,0 @@ -package lel.flummi.skilloverlay.api.records; - -import com.google.gson.annotations.SerializedName; - -import java.util.HashMap; - -public record Items( - Item[] armor, - Item[][] wardrobe, - Item[] inventory, - Item[] enderchest, - @SerializedName("talisman_bag") Item[] talismanBag, - @SerializedName("fishing_bag") Item[] fishingBag, - Item[] quiver, - @SerializedName("potion_bag") Item[] potionBag, - @SerializedName("personal_vault") Item[] personalVault, - Item[] storage, - Item[] weapons, - Item[] hoes, - Item[] pickaxes, - Item[] rods, - @SerializedName("highest_rarity_sword") Item highestRaritySword, - @SerializedName("highest_rarity_bow") Item highestRarityBow, - @SerializedName("highest_rarity_rod") Item highestRarityRod, - @SerializedName("armor_set_rarity") String armorSetRarity -){ - public record Item( - @SerializedName("Count") byte count, - int damage, - Tag tag, - boolean isInactive, - boolean inBackpack, - Item[] containsItems - ){ - public record Tag( - @SerializedName("ExtraAttributes") ExtraAttributes extraAttributes, - Display display, - @SerializedName("SkullOwner") SkullOwner skullOwner, - Enchant[] ench - ){ - public record ExtraAttributes(String id, HashMap enchantments){} - public record Display(@SerializedName("Name") String name, @SerializedName("Lore") String[] lore, Integer color){} - public record SkullOwner( - @SerializedName("Id") String id, - @SerializedName("Properties") Properties properties - ){ - public record Properties(HashMap[] textures){} - } - public record Enchant(int lvl, int id){} - } - } -} \ No newline at end of file diff --git a/src/main/java/lel/flummi/skilloverlay/api/records/PlayerProfiles.java b/src/main/java/lel/flummi/skilloverlay/api/records/PlayerProfiles.java deleted file mode 100644 index 8f26659..0000000 --- a/src/main/java/lel/flummi/skilloverlay/api/records/PlayerProfiles.java +++ /dev/null @@ -1,164 +0,0 @@ -package lel.flummi.skilloverlay.api.records; - -import lel.flummi.skilloverlay.api.records.dungeons.Dungeons; -import lel.flummi.skilloverlay.api.records.mining.Mining; -import lel.flummi.skilloverlay.api.records.misc.Misc; - -import com.google.gson.annotations.SerializedName; -import java.util.HashMap; - -public record PlayerProfiles(HashMap profiles) { - public record PlayerProfile( - @SerializedName("profile_id") String profileId, - @SerializedName("cute_name") String cuteName, - boolean current, - @SerializedName("last_save") long lastSave, - Items items, - Data data) { - public record Data( - Stats stats, - @SerializedName("fairy_bonus") Stats fairyBonus, - @SerializedName("fairy_souls") FairySouls fairySouls, - @SerializedName("levels") HashMap skills, - @SerializedName("average_level") double averageLevel, - @SerializedName("average_level_no_progress") double trueAverageLevel, - @SerializedName("total_skill_xp") double totalSkillXp, - @SerializedName("skill_bonus") HashMap skillBonus, - @SerializedName("average_level_rank") double averageLevelRank, - @SerializedName("slayer_coins_spent") HashMap slayerCoinsSpent, - @SerializedName("slayer_bonus") HashMap slayerBonus, - HashMap slayers, - @SerializedName("slayer_xp") int slayerXp, - @SerializedName("display_name") String username, - String uuid, - double bank, - double purse, - @SerializedName("current_area") String currentArea, - Entity[] kills, - Entity[] deaths, - @SerializedName("wardrobe_equipped_slot") int wardrobeEquippedSlot, - @SerializedName("skin_data") SkinData skinData, - Profile profile, - Member[] members, - Minion[] minions, - @SerializedName("minion_slots") MinionSlots minionSlots, - HashMap collections, - Social social, - Dungeons dungeons, - Fishing fishing, - Farming farming, - Enchanting Enchanting, - Mining mining, - Misc misc, - @SerializedName("auctions_bought") Auctions auctionsBought, - @SerializedName("auctions_sold") Auctions auctionsSold, - @SerializedName("last_updated") LastUpdated lastUpdated, - @SerializedName("first_join") LastUpdated firstJoin - ) { - public record Stats( - int health, - int defense, - @SerializedName("effective_health") int effectiveHealth, - int strength, - int speed, - @SerializedName("crit_chance") double critChance, - @SerializedName("crit_damage") int critDamage, - @SerializedName("bonus_attack_speed") int bonusAttackSpeed, - int intelligence, - @SerializedName("sea_creature_chance") int seaCreatureChance, - @SerializedName("magic_find") int magicFind, - @SerializedName("pet_luck") int petLuck, - int ferocity, - @SerializedName("ability_damage") double abilityDamage, - @SerializedName("mining_speed") int miningSpeed, - @SerializedName("mining_fortune") int miningFortune, - @SerializedName("farming_fortune") int farmingFortune, - @SerializedName("foraging_fortune") int foragingFortune, - int pristine, - int damage, - @SerializedName("damage_increase") double damageIncrease) { - } - - public record FairySouls(int collected, int total, double progress) { - } - - public record Level( - Double xp, - Integer level, - Integer maxLevel, - Long xpCurrent, - Integer xpForNext, - Double progress, - Integer levelCap, - Integer uncappedLevel, - Integer rank, - Double levelWithProgress, - Double unlockableLevelWithProgress) { - } - - public record Entity(String type, String entityId, int amount, String entityName) { - } - - public record SkinData(@SerializedName("skinurl") String skinUrl, String model) { - } - - public record Profile(String gamemode) { - } - - public record Member( - String uuid, - @SerializedName("display_name") String displayName, - @SerializedName("last_updated") LastUpdated lastUpdated, - @SerializedName("skin_data") SkinData skinData) { - } - - public record LastUpdated(long unix, String text) { - } - - public record Minion( - String id, - String type, - int tiers, - String name, - Integer[] levels - - ) { - } - - public record MinionSlots(int currentSlots, int toNext, int toNextSlot) { - } - - public record Collection(int tier, long amount, long totalAmount, UserAmount[] amounts) { - public record UserAmount(String username, long amount) { - } - } - - public record Social( - @SerializedName("DISCORD") String discord, - @SerializedName("HYPIXEL") String hypixel, - @SerializedName("TWITTER") String twitter, - @SerializedName("YOUTUBE") String youtube, - @SerializedName("INSTAGRAM") String instagram, - @SerializedName("TWITCH") String twitch) { - } - - public record Fishing( - int total, - int treasure, - @SerializedName("treasure_large") int treasureLarge, - @SerializedName("shredder_fished") int shredderFished, - @SerializedName("shredder_bait") int shredderBait) { - } - - public record Auctions( - int uncommon, - int rare, - int epic, - int common, - int legendary, - int special) { - } - } - - } -} \ No newline at end of file diff --git a/src/main/java/lel/flummi/skilloverlay/api/records/Profile.java b/src/main/java/lel/flummi/skilloverlay/api/records/Profile.java new file mode 100644 index 0000000..f638ba1 --- /dev/null +++ b/src/main/java/lel/flummi/skilloverlay/api/records/Profile.java @@ -0,0 +1,22 @@ +package lel.flummi.skilloverlay.api.records; + +import java.util.List; +import java.util.HashMap; + +import com.google.gson.annotations.SerializedName; + +public record Profile( + boolean success, + List profiles +) { + public record Profiles( + @SerializedName("profile_id") String profileId, + @SerializedName("last_save") long lastSave, + HashMap members, + boolean selected + ) { + public record Member( + double experience_skill_farming + ){} + } +} diff --git a/src/main/java/lel/flummi/skilloverlay/api/records/Slayer.java b/src/main/java/lel/flummi/skilloverlay/api/records/Slayer.java deleted file mode 100644 index 3b2b9bb..0000000 --- a/src/main/java/lel/flummi/skilloverlay/api/records/Slayer.java +++ /dev/null @@ -1,29 +0,0 @@ -package lel.flummi.skilloverlay.api.records; - -import com.google.gson.annotations.SerializedName; -import org.jetbrains.annotations.Nullable; - -import java.util.HashMap; - -public record Slayer( - PlayerProfiles.PlayerProfile.Data.Level level, - Kills kills, - @SerializedName("claimed_levels") ClaimedLevels claimedLevels, - int xp, - @SerializedName("boss_kills_tier_0") int bossKillsTier0, - @SerializedName("boss_kills_tier_1") int bossKillsTier1, - @SerializedName("boss_kills_tier_2") int bossKillsTier2, - @SerializedName("boss_kills_tier_3") int bossKillsTier3 -){ - public record Kills(@Nullable HashMap kills){} - public record ClaimedLevels( - @SerializedName("level_1") boolean level1, - @SerializedName("level_2") boolean level2, - @SerializedName("level_3") boolean level3, - @SerializedName("level_4") boolean level4, - @SerializedName("level_5") boolean level5, - @SerializedName("level_6") boolean level6, - @SerializedName("level_7_special") boolean level7 - ){} - -} diff --git a/src/main/java/lel/flummi/skilloverlay/api/records/dungeons/Dungeons.java b/src/main/java/lel/flummi/skilloverlay/api/records/dungeons/Dungeons.java deleted file mode 100644 index c189e90..0000000 --- a/src/main/java/lel/flummi/skilloverlay/api/records/dungeons/Dungeons.java +++ /dev/null @@ -1,40 +0,0 @@ -package lel.flummi.skilloverlay.api.records.dungeons; - -import com.google.gson.annotations.SerializedName; -import lel.flummi.skilloverlay.api.records.PlayerProfiles; - -import java.util.HashMap; - -public record Dungeons( - Dungeon catacombs, - @SerializedName("master_catacombs") Dungeon masterCatacombs, - HashMap classes, - @SerializedName("used_classes") boolean usedClasses, - @SerializedName("selected_class") String selectedClass, - @SerializedName("secrets_found") int secretsFound, - HashMap essence, - @SerializedName("unlocked_collections") boolean unlockedCollections, - @SerializedName("boss_collections") HashMap bossCollections - //Journals journals - -){ - public record Dungeon( - String id, - boolean visited, - PlayerProfiles.PlayerProfile.Data.Level level, - @SerializedName("highest_floor") String highestFloor, - HashMap floors - - ){} - public record Collection( - String name, - String texture, - int tier, - boolean maxed, - int killed, - HashMap floors, - int unclaimed, - String[] claimed - ){} - public record Class(PlayerProfiles.PlayerProfile.Data.Level experience, boolean current){} -} diff --git a/src/main/java/lel/flummi/skilloverlay/api/records/dungeons/Floor.java b/src/main/java/lel/flummi/skilloverlay/api/records/dungeons/Floor.java deleted file mode 100644 index a28304c..0000000 --- a/src/main/java/lel/flummi/skilloverlay/api/records/dungeons/Floor.java +++ /dev/null @@ -1,44 +0,0 @@ -package lel.flummi.skilloverlay.api.records.dungeons; - -import com.google.gson.annotations.SerializedName; - -public record Floor( - String name, - Stats stats, - @SerializedName("most_damage") MostDamage mostDamage, - Bonuses bonuses - -){ - public record Stats( - @SerializedName("times_played") int timesPlayed, - @SerializedName("best_score") int bestScore, - @SerializedName("mobs_killed") int mobsKilled, - @SerializedName("most_mobs_killed") int mostMobsKilled, - @SerializedName("most_healing") double mostHealing, - @SerializedName("tier_completions") int tierCompletions, - @SerializedName("fastest_time") long fastestTime, - @SerializedName("watcher_kills") int watcherKills, - @SerializedName("best_runs") Run[] bestRuns - ){} - public record MostDamage( - @SerializedName("class") String classUsed, - @SerializedName("value") double damage - ){} - public record Run( - long timestamp, - @SerializedName("score_exploration") int scoreExploration, - @SerializedName("score_speed") int scoreSpeed, - @SerializedName("score_skill") int scoreSkill, - @SerializedName("score_bonus") int scoreBonus, - @SerializedName("dungeon_class") int dungeonClass, - String[] teammates, - @SerializedName("elapsed_time") long elapsedTime, - @SerializedName("damaged_dealt") int damageDealt, - int deaths, - @SerializedName("mobs_killed") int mobsKilled, - @SerializedName("secrets_found") int secretsFound, - @SerializedName("damage_mitigated") double damageMitigated, - @SerializedName("ally_healing") int allyHealing - ){} - public record Bonuses(@SerializedName("item_boost") int itemBoost){} -} diff --git a/src/main/java/lel/flummi/skilloverlay/api/records/dungeons/Journals.java b/src/main/java/lel/flummi/skilloverlay/api/records/dungeons/Journals.java deleted file mode 100644 index 22ed2ad..0000000 --- a/src/main/java/lel/flummi/skilloverlay/api/records/dungeons/Journals.java +++ /dev/null @@ -1,18 +0,0 @@ -package lel.flummi.skilloverlay.api.records.dungeons; - -import com.google.gson.annotations.SerializedName; - -public record Journals( - @SerializedName("pages_completed") int pagesCompleted, - @SerializedName("journals_completed") int journalsCompleted, - @SerializedName("total_pages") Integer totalPages, - boolean maxed, - @SerializedName("journal_entries") Entry[] journalEntries - -){ - public record Entry( - String name, - @SerializedName("pages_collected") int pagesCollected, - @SerializedName("total_pages") Integer totalPages - ){} -} diff --git a/src/main/java/lel/flummi/skilloverlay/api/records/mining/Core.java b/src/main/java/lel/flummi/skilloverlay/api/records/mining/Core.java deleted file mode 100644 index 924e6c1..0000000 --- a/src/main/java/lel/flummi/skilloverlay/api/records/mining/Core.java +++ /dev/null @@ -1,41 +0,0 @@ -package lel.flummi.skilloverlay.api.records.mining; - -import com.google.gson.annotations.SerializedName; -import lel.flummi.skilloverlay.api.records.PlayerProfiles; - -import java.util.HashMap; - -public record Core( - PlayerProfiles.PlayerProfile.Data.Level tier, - Spent tokens, - @SerializedName("selected_pickaxe_ability") String selectedMiningAbility, - HashMap powder, - @SerializedName("crystal_nucleus") Nucleus crystalNucleus, - @SerializedName("daily_ores") DailyOres dailyOres, - @SerializedName("hotm_last_reset") long hotmLastReset, - @SerializedName("crystal_hollows_last_access") long crystalHollowsLastAccess -){ - public record Spent(int total, int spent, int available){} - public record Nucleus( - @SerializedName("times_completed") int timesCompleted, - HashMap crystals, - Goblin goblin - ){ - public record Crystal( - String state, - @SerializedName("total_placed") int totalPlaced, - @SerializedName("total_found") int totalFound - ){} - public record Goblin( - @SerializedName("king_quest_active") boolean kingQuestActive, - @SerializedName("king_quest_completed") boolean kingQuestCompleted - ){} - } - public record DailyOres( - int mined, - int day, - @SerializedName("daily_ores") HashMap dailyOres - ){ - public record Ore(int day, int count){} - } -} diff --git a/src/main/java/lel/flummi/skilloverlay/api/records/mining/Mining.java b/src/main/java/lel/flummi/skilloverlay/api/records/mining/Mining.java deleted file mode 100644 index c82b2e9..0000000 --- a/src/main/java/lel/flummi/skilloverlay/api/records/mining/Mining.java +++ /dev/null @@ -1,18 +0,0 @@ -package lel.flummi.skilloverlay.api.records.mining; - -public record Mining( - Commissions commissions, - Forge forge, - Core core -){ - public record Forge(Process[] processes){ - public record Process( - String id, - int slot, - long timeFinished, - String timeFinishedText, - String name - ){} - } - public record Commissions(int milestone){} -} diff --git a/src/main/java/lel/flummi/skilloverlay/api/records/misc/Burrows.java b/src/main/java/lel/flummi/skilloverlay/api/records/misc/Burrows.java deleted file mode 100644 index 60ae510..0000000 --- a/src/main/java/lel/flummi/skilloverlay/api/records/misc/Burrows.java +++ /dev/null @@ -1,19 +0,0 @@ -package lel.flummi.skilloverlay.api.records.misc; - -import com.google.gson.annotations.SerializedName; - -public record Burrows( - @SerializedName("dug_next") Rarities dugNext, - @SerializedName("dug_combat") Rarities dugCombat, - @SerializedName("dug_treasure") Rarities dugTreasure, - @SerializedName("chains_complete") Rarities chainsComplete -){ - public record Rarities( - int total, - @SerializedName("null") int common, - int uncommon, - int rare, - int epic, - int legendary - ){} -} diff --git a/src/main/java/lel/flummi/skilloverlay/api/records/misc/Misc.java b/src/main/java/lel/flummi/skilloverlay/api/records/misc/Misc.java deleted file mode 100644 index 26861ae..0000000 --- a/src/main/java/lel/flummi/skilloverlay/api/records/misc/Misc.java +++ /dev/null @@ -1,42 +0,0 @@ -package lel.flummi.skilloverlay.api.records.misc; - -import com.google.gson.annotations.SerializedName; - -public record Misc( - Milestones milestones, - Gifts gifts, - Winter winter, - Dragons dragons, - Protector protector, - Damage damage, - Burrows burrows, - ProfileUpgrades profileUpgrades -){ - public record Milestones( - @SerializedName("ores_mined") int oresMined, - @SerializedName("sea_creatures_killed") int seaCreaturesKilled - ){} - public record Gifts(@SerializedName("gifts_given") int giftsGiven){} - public record Winter( - @SerializedName("most_winter_snowballs_hit") int mostWinterSnowballsHit, - @SerializedName("most_winter_damage_dealt") int mostWinterDamageDealt, - @SerializedName("most_winter_magma_damage_dealt") int mostWinterMagmaDamageDealt - ){} - public record Dragons( - @SerializedName("ender_crystals_destroyed") int enderCrystalsDestroyed, - @SerializedName("last_hits") int lastHits, - @SerializedName("deaths") int deaths - ){} - public record Protector( - @SerializedName("last_hits") int lastHits, - int deaths - ){} - public record Damage(@SerializedName("highest_critical_damage") double highestCriticalDamage){} - public record ProfileUpgrades( - @SerializedName("island_size") int islandSize, - @SerializedName("minion_slots") int minionSlots, - @SerializedName("guest_count") int guestCount, - @SerializedName("coop_slots") int coopSlots, - @SerializedName("coins_allowance") int coinsAllowance - ){} -} diff --git a/src/main/java/lel/flummi/skilloverlay/config/skilloverlayconfig.java b/src/main/java/lel/flummi/skilloverlay/config/skilloverlayconfig.java new file mode 100644 index 0000000..f9bb554 --- /dev/null +++ b/src/main/java/lel/flummi/skilloverlay/config/skilloverlayconfig.java @@ -0,0 +1,26 @@ +package lel.flummi.skilloverlay.config; + +import me.shedaniel.autoconfig.AutoConfig; +import me.shedaniel.autoconfig.ConfigData; +import me.shedaniel.autoconfig.annotation.Config; +import me.shedaniel.autoconfig.annotation.ConfigEntry; +import me.shedaniel.autoconfig.serializer.GsonConfigSerializer; + +@Config(name = "skilloverlay") +public class skilloverlayconfig implements ConfigData { + @ConfigEntry.Category("general") + @ConfigEntry.Gui.TransitiveObject + public General general = new General(); + + public static class General { + public String apiKey = ""; + } + + public static void init() { + AutoConfig.register(skilloverlayconfig.class, GsonConfigSerializer::new); + } + + public static skilloverlayconfig get() { + return AutoConfig.getConfigHolder(skilloverlayconfig.class).getConfig(); + } +} diff --git a/src/main/java/lel/flummi/skilloverlay/overlays/FarmingOverlay.java b/src/main/java/lel/flummi/skilloverlay/overlays/FarmingOverlay.java index d117407..6d3e929 100644 --- a/src/main/java/lel/flummi/skilloverlay/overlays/FarmingOverlay.java +++ b/src/main/java/lel/flummi/skilloverlay/overlays/FarmingOverlay.java @@ -8,7 +8,7 @@ import net.minecraft.util.Formatting; import net.minecraft.client.gui.DrawableHelper; import com.mojang.blaze3d.systems.RenderSystem; -import lel.flummi.skilloverlay.skilloverlay; +//import lel.flummi.skilloverlay.skilloverlay; import lel.flummi.skilloverlay.utils.LerpUtils; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; diff --git a/src/main/java/lel/flummi/skilloverlay/overlays/FarmingOverlay.java.unused b/src/main/java/lel/flummi/skilloverlay/overlays/FarmingOverlay.java.unused deleted file mode 100644 index 4b8c87b..0000000 --- a/src/main/java/lel/flummi/skilloverlay/overlays/FarmingOverlay.java.unused +++ /dev/null @@ -1,73 +0,0 @@ -package lel.flummi.skilloverlay.overlays; - -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.client.gui.DrawableHelper; -import com.mojang.blaze3d.systems.RenderSystem; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; - -import java.util.ArrayList; - -@Environment(EnvType.CLIENT) -public class FarmingOverlay extends DrawableHelper { - private MinecraftClient client; - private MatrixStack matrixStack; - - public FarmingOverlay() {} - - public void render(MatrixStack matrixStack, MinecraftClient client) { - this.matrixStack = matrixStack; - this.client = MinecraftClient.getInstance(); - - RenderSystem.enableBlend(); - this.renderOverlay(); - - this.client.getProfiler().pop(); - } - - public void renderOverlay() { - ArrayList overlayStringList = new ArrayList<>(); - - // Add all the lines to the array - overlayStringList.add("Test"); - - //Remove empty lines from the array - overlayStringList.removeIf(String::isEmpty); - - // Draw HUD - int Xcords = 10; - int Ycords = 200; - - // Get the longest string in the array - int longestString = 0; - int BoxWidth = 0; - for (String s : overlayStringList) { - if (s.length() > longestString) { - longestString = s.length(); - BoxWidth = this.client.textRenderer.getWidth(s); - } - } - - int lineHeight = this.client.textRenderer.fontHeight + 2; - int yAxis = (((this.client.getWindow().getScaledHeight()) - ((lineHeight + 4) * overlayStringList.size())) + (lineHeight + 4)) * (Ycords) / 100; - int xAxis = ((this.client.getWindow().getScaledWidth() - 4) - (BoxWidth)) * Xcords / 100; - - // Add Padding to left of the screen - if (xAxis <= 4) { - xAxis = 4; - } - - for (String line : overlayStringList) { - int offset = 0; - if (Xcords >= 50) { - int lineLength = this.client.textRenderer.getWidth(line); - offset = (BoxWidth - lineLength); - } - - this.client.textRenderer.drawWithShadow(this.matrixStack, line, xAxis + offset, yAxis + 4, 0xFFFFFF); - yAxis += lineHeight; - } - } -} diff --git a/src/main/java/lel/flummi/skilloverlay/skilloverlay.java b/src/main/java/lel/flummi/skilloverlay/skilloverlay.java index a73af8e..50c2d38 100644 --- a/src/main/java/lel/flummi/skilloverlay/skilloverlay.java +++ b/src/main/java/lel/flummi/skilloverlay/skilloverlay.java @@ -3,8 +3,8 @@ package lel.flummi.skilloverlay; import net.fabricmc.api.ModInitializer; import lel.flummi.skilloverlay.overlays.FarmingOverlay; - import lel.flummi.skilloverlay.api.PlayerProfile; +import lel.flummi.skilloverlay.config.skilloverlayconfig; public class skilloverlay implements ModInitializer { public static FarmingOverlay OVERLAY; @@ -14,10 +14,9 @@ public class skilloverlay implements ModInitializer { public void onInitialize() { System.out.println("Skilloverlay started."); + skilloverlayconfig.init(); OVERLAY = new FarmingOverlay(); PlayerProfile.init(); - - //System.out.println(profiles.profiles().get("b2255349-d395-4169-9980-3ec0a32b2cfb").data().skills().get("farming").xp()); } }