first commit
This commit is contained in:
52
src/main/java/lel/flummi/skilloverlay/api/PlayerProfile.java
Normal file
52
src/main/java/lel/flummi/skilloverlay/api/PlayerProfile.java
Normal file
@ -0,0 +1,52 @@
|
||||
package lel.flummi.skilloverlay.api;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
||||
import lel.flummi.skilloverlay.api.records.PlayerProfiles;
|
||||
|
||||
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;
|
||||
|
||||
public class PlayerProfile {
|
||||
public static PlayerProfiles.PlayerProfile PROFILE;
|
||||
|
||||
public static void init() {
|
||||
Timer timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
PlayerProfiles profiles = PlayerProfile.updateProfile();
|
||||
|
||||
PlayerProfiles.PlayerProfile currentProfile = profiles.profiles().get("");
|
||||
|
||||
for (PlayerProfiles.PlayerProfile profile: profiles.profiles().values()) {
|
||||
if(profile.current() == true) {
|
||||
currentProfile = profile;
|
||||
}
|
||||
}
|
||||
|
||||
PROFILE = currentProfile;
|
||||
}
|
||||
}, 0, 60 * 1000);
|
||||
}
|
||||
|
||||
public static PlayerProfiles updateProfile() {
|
||||
try {
|
||||
URL url = new URL("https://sky.shiiyu.moe/api/v2/profile/" + MinecraftClient.getInstance().getSession().getUsername());
|
||||
InputStreamReader reader = new InputStreamReader(url.openStream());
|
||||
Gson gson = new GsonBuilder()
|
||||
.serializeNulls()
|
||||
.create();
|
||||
return gson.fromJson(reader, PlayerProfiles.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package lel.flummi.skilloverlay.api.records;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public record Enchanting(boolean experimented, HashMap<String, Experiment> 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
|
||||
){}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
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<String, Crop> 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){}
|
||||
}
|
||||
}
|
52
src/main/java/lel/flummi/skilloverlay/api/records/Items.java
Normal file
52
src/main/java/lel/flummi/skilloverlay/api/records/Items.java
Normal file
@ -0,0 +1,52 @@
|
||||
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<String, Integer> 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<String, String>[] textures){}
|
||||
}
|
||||
public record Enchant(int lvl, int id){}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
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<String, PlayerProfile> 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<String, Level> skills,
|
||||
@SerializedName("average_level") double averageLevel,
|
||||
@SerializedName("average_level_no_progress") double trueAverageLevel,
|
||||
@SerializedName("total_skill_xp") double totalSkillXp,
|
||||
@SerializedName("skill_bonus") HashMap<String, Stats> skillBonus,
|
||||
@SerializedName("average_level_rank") double averageLevelRank,
|
||||
@SerializedName("slayer_coins_spent") HashMap<String, Integer> slayerCoinsSpent,
|
||||
@SerializedName("slayer_bonus") HashMap<String, Stats> slayerBonus,
|
||||
HashMap<String, Slayer> 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<String, Collection> 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) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
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<String, Integer> 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
|
||||
){}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
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<String, Class> classes,
|
||||
@SerializedName("used_classes") boolean usedClasses,
|
||||
@SerializedName("selected_class") String selectedClass,
|
||||
@SerializedName("secrets_found") int secretsFound,
|
||||
HashMap<String, Integer> essence,
|
||||
@SerializedName("unlocked_collections") boolean unlockedCollections,
|
||||
@SerializedName("boss_collections") HashMap<String, Collection> bossCollections
|
||||
//Journals journals
|
||||
|
||||
){
|
||||
public record Dungeon(
|
||||
String id,
|
||||
boolean visited,
|
||||
PlayerProfiles.PlayerProfile.Data.Level level,
|
||||
@SerializedName("highest_floor") String highestFloor,
|
||||
HashMap<Integer, Floor> floors
|
||||
|
||||
){}
|
||||
public record Collection(
|
||||
String name,
|
||||
String texture,
|
||||
int tier,
|
||||
boolean maxed,
|
||||
int killed,
|
||||
HashMap<String, Integer> floors,
|
||||
int unclaimed,
|
||||
String[] claimed
|
||||
){}
|
||||
public record Class(PlayerProfiles.PlayerProfile.Data.Level experience, boolean current){}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
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){}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
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
|
||||
){}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
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<String, Spent> 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<String, Crystal> 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<String, Ore> dailyOres
|
||||
){
|
||||
public record Ore(int day, int count){}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
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){}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
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
|
||||
){}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
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
|
||||
){}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package lel.flummi.skilloverlay.mixin;
|
||||
|
||||
import lel.flummi.skilloverlay.skilloverlay;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.gui.hud.InGameHud;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Mixin(InGameHud.class)
|
||||
public abstract class GameRenderMixin {
|
||||
@Shadow @Final private MinecraftClient client;
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "render")
|
||||
private void render(MatrixStack matrices, float tickDelta, CallbackInfo ci) {
|
||||
skilloverlay.OVERLAY.render(matrices, client);
|
||||
}
|
||||
}
|
@ -0,0 +1,306 @@
|
||||
package lel.flummi.skilloverlay.overlays;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
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.utils.LerpUtils;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class FarmingOverlay extends DrawableHelper {
|
||||
private MinecraftClient client;
|
||||
private MatrixStack matrixStack;
|
||||
|
||||
private long lastUpdate = -1;
|
||||
private final LinkedList<Long> counterQueue = new LinkedList<>();
|
||||
private int cultivatingTier = -1;
|
||||
private String cultivatingTierAmount = "1";
|
||||
private long counter = -1;
|
||||
private int cultivating = -1;
|
||||
private int cultivatingLast = -1;
|
||||
private float cropsPerSecondLast = 0;
|
||||
private float cropsPerSecond = 0;
|
||||
private ArrayList<Float> cropsOverLastXSeconds = new ArrayList<>();
|
||||
private String cropName;
|
||||
|
||||
public FarmingOverlay() {
|
||||
/*HudRenderCallback.EVENT.register((matrixStack, tickDelta) -> {
|
||||
if(client.player == null)
|
||||
return;
|
||||
this.render(matrixStack, client);
|
||||
});*/
|
||||
}
|
||||
|
||||
public void render(MatrixStack matrixStack, MinecraftClient client) {
|
||||
if (client.player == null)
|
||||
return;
|
||||
|
||||
this.matrixStack = matrixStack;
|
||||
this.client = MinecraftClient.getInstance();
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
this.renderOverlay();
|
||||
|
||||
this.client.getProfiler().pop();
|
||||
}
|
||||
|
||||
public void renderOverlay() {
|
||||
this.lastUpdate = System.currentTimeMillis();
|
||||
ItemStack heldItem = client.player.getMainHandStack();
|
||||
String internalName = "";
|
||||
this.counter = 0;
|
||||
boolean holdingFarmItem = false;
|
||||
this.cultivatingLast = cultivating;
|
||||
this.cultivating = 0;
|
||||
|
||||
//System.out.println(skilloverlay.PROFILE.data().skills().get("farming").level());
|
||||
|
||||
if (heldItem != null) {
|
||||
NbtCompound tag = heldItem.getNbt();
|
||||
|
||||
if (tag != null && tag.contains("ExtraAttributes", 10)) {
|
||||
NbtCompound ea = tag.getCompound("ExtraAttributes");
|
||||
internalName = ea.getString("id");
|
||||
|
||||
for (CropType crop : CropType.values()) {
|
||||
if (internalName.startsWith(crop.toolName)) {
|
||||
this.cropName = crop.item;
|
||||
holdingFarmItem = true;
|
||||
}
|
||||
}
|
||||
if(holdingFarmItem) {
|
||||
if (ea.contains("mined_crops", 99)) {
|
||||
this.counter = ea.getLong("mined_crops");
|
||||
cultivating = ea.getInt("farmed_cultivating");
|
||||
this.counterQueue.add(0, this.counter);
|
||||
} else if (ea.contains("farmed_cultivating", 99)) {
|
||||
this.counter = ea.getInt("farmed_cultivating");
|
||||
cultivating = ea.getInt("farmed_cultivating");
|
||||
this.counterQueue.add(0, this.counter);
|
||||
}
|
||||
}
|
||||
else
|
||||
holdingFarmItem = false;
|
||||
}
|
||||
|
||||
if (this.cultivating < 1000) {
|
||||
this.cultivatingTier = 1;
|
||||
this.cultivatingTierAmount = "1,000";
|
||||
} else if (this.cultivating < 5000) {
|
||||
this.cultivatingTier = 2;
|
||||
this.cultivatingTierAmount = "5,000";
|
||||
} else if (this.cultivating < 25000) {
|
||||
this.cultivatingTier = 3;
|
||||
this.cultivatingTierAmount = "25,000";
|
||||
} else if (this.cultivating < 100000) {
|
||||
this.cultivatingTier = 4;
|
||||
this.cultivatingTierAmount = "100,000";
|
||||
} else if (this.cultivating < 300000) {
|
||||
this.cultivatingTier = 5;
|
||||
this.cultivatingTierAmount = "300,000";
|
||||
} else if (this.cultivating < 1500000) {
|
||||
this.cultivatingTier = 6;
|
||||
this.cultivatingTierAmount = "1,500,000";
|
||||
} else if (this.cultivating < 5000000) {
|
||||
this.cultivatingTier = 7;
|
||||
this.cultivatingTierAmount = "5,000,000";
|
||||
} else if (this.cultivating < 20000000) {
|
||||
this.cultivatingTier = 8;
|
||||
this.cultivatingTierAmount = "20,000,000";
|
||||
} else if (this.cultivating < 100000000) {
|
||||
this.cultivatingTier = 9;
|
||||
this.cultivatingTierAmount = "100,000,000";
|
||||
} else if (this.cultivating > 100000000) {
|
||||
this.cultivatingTier = 10;
|
||||
this.cultivatingTierAmount = "Maxed";
|
||||
}
|
||||
}
|
||||
|
||||
while (this.counterQueue.size() >= 4) {
|
||||
this.counterQueue.removeLast();
|
||||
}
|
||||
|
||||
if (this.counterQueue.isEmpty()) {
|
||||
this.cropsPerSecond = -1;
|
||||
this.cropsPerSecondLast = 0;
|
||||
} else {
|
||||
this.cropsPerSecondLast = this.cropsPerSecond;
|
||||
long last = this.counterQueue.getLast();
|
||||
long first = this.counterQueue.getFirst();
|
||||
while (this.cropsOverLastXSeconds.size() > 60) {
|
||||
this.cropsOverLastXSeconds.remove(0);
|
||||
}
|
||||
if ((first - last) / 2f != 0) {
|
||||
this.cropsOverLastXSeconds.add((first - last) / 2f);
|
||||
} else {
|
||||
if (this.cropsPerSecondLast == 0) {
|
||||
int i = 12;
|
||||
while (i > 0) {
|
||||
i--;
|
||||
if (this.cropsOverLastXSeconds.size() > 0) {
|
||||
this.cropsOverLastXSeconds.remove(0);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!holdingFarmItem) {
|
||||
this.cropsOverLastXSeconds.clear();
|
||||
this.cropsPerSecond = -1;
|
||||
this.cropsPerSecondLast = 0;
|
||||
}
|
||||
|
||||
ArrayList<Float> temp = new ArrayList<>(cropsOverLastXSeconds);
|
||||
if (this.cropsOverLastXSeconds.size() >= 3) {
|
||||
temp.remove(Collections.min(temp));
|
||||
}
|
||||
if (this.cropsOverLastXSeconds.size() >= 6) {
|
||||
temp.remove(Collections.min(temp));
|
||||
temp.remove(Collections.max(temp));
|
||||
}
|
||||
if (this.cropsOverLastXSeconds.size() >= 10) {
|
||||
temp.remove(Collections.max(temp));
|
||||
}
|
||||
|
||||
float cropsOverLastXSecondsTotal = 0;
|
||||
for (Float crops : temp) {
|
||||
cropsOverLastXSecondsTotal += crops;
|
||||
}
|
||||
this.cropsPerSecond = temp.size() != 0 && cropsOverLastXSecondsTotal != 0
|
||||
? cropsOverLastXSecondsTotal / temp.size()
|
||||
: 0;
|
||||
}
|
||||
|
||||
ArrayList<OverlayString> overlayStringList = new ArrayList<>();
|
||||
NumberFormat format = NumberFormat.getIntegerInstance();
|
||||
|
||||
// Add all the lines to the array
|
||||
if (this.counter >= 0 && this.cultivating != this.counter) {
|
||||
overlayStringList.add(new OverlayString("Counter", format.format(this.counter)));
|
||||
}
|
||||
|
||||
if (this.counter >= 0) {
|
||||
if (this.cropsPerSecondLast == this.cropsPerSecond && this.cropsPerSecond <= 0) {
|
||||
overlayStringList.add(new OverlayString(this.cropName + "/m", "N/A"));
|
||||
} else {
|
||||
float cpsInterp = interp(this.cropsPerSecond, this.cropsPerSecondLast);
|
||||
overlayStringList.add(new OverlayString(this.cropName + "/m", String.format("%,.2f", cpsInterp * 60 * 30)));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.cultivatingTier <= 9 && this.cultivating > 0) {
|
||||
int counterInterp = (int) interp(this.cultivating, this.cultivatingLast);
|
||||
overlayStringList.add(new OverlayString("Cultivating", format.format(counterInterp) + "/" + this.cultivatingTierAmount));
|
||||
}
|
||||
if (this.cultivatingTier == 10) {
|
||||
int counterInterp = (int) interp(this.cultivating, this.cultivatingLast);
|
||||
overlayStringList.add(new OverlayString("Cultivating", format.format(counterInterp)));
|
||||
}
|
||||
|
||||
float yaw = client.player.getYaw();
|
||||
float pitch = client.player.getPitch();
|
||||
yaw %= 360;
|
||||
if (yaw < 0)
|
||||
yaw += 360;
|
||||
if (yaw > 180)
|
||||
yaw -= 360;
|
||||
pitch %= 360;
|
||||
if (pitch < 0)
|
||||
pitch += 360;
|
||||
if (pitch > 180)
|
||||
pitch -= 360;
|
||||
|
||||
overlayStringList.add(new OverlayString("Yaw", String.format("%.2f", yaw) + Formatting.BOLD + "\u1D52"));
|
||||
overlayStringList.add(new OverlayString("Pitch", String.format("%.2f", pitch) + Formatting.BOLD + "\u1D52"));
|
||||
|
||||
if (!holdingFarmItem) {
|
||||
overlayStringList.clear();
|
||||
}
|
||||
|
||||
// Draw HUD
|
||||
int xAxis = 10;
|
||||
int yAxis = 200;
|
||||
|
||||
// Get the longest string in the array
|
||||
int longestString = 0;
|
||||
int BoxWidth = 0;
|
||||
for (OverlayString s : overlayStringList) {
|
||||
String combined = s.toString();
|
||||
if (combined.length() > longestString) {
|
||||
longestString = combined.length();
|
||||
BoxWidth = this.client.textRenderer.getWidth(combined);
|
||||
}
|
||||
}
|
||||
|
||||
int lineHeight = this.client.textRenderer.fontHeight + 2;
|
||||
|
||||
DrawableHelper.fill(matrixStack, xAxis, yAxis, xAxis + BoxWidth + 10,
|
||||
yAxis + ((lineHeight + 1) * overlayStringList.size()), 0x64000000);
|
||||
|
||||
for (OverlayString line : overlayStringList) {
|
||||
int offset = 5;
|
||||
|
||||
this.client.textRenderer.drawWithShadow(this.matrixStack, line.toString(), xAxis + offset, yAxis + offset, 0xFFFFFF);
|
||||
yAxis += lineHeight;
|
||||
}
|
||||
}
|
||||
|
||||
private float interp(float now, float last) {
|
||||
float interp = now;
|
||||
if (last >= 0 && last != now) {
|
||||
float factor = (System.currentTimeMillis() - this.lastUpdate) / 1000f;
|
||||
factor = LerpUtils.clampZeroOne(factor);
|
||||
interp = last + (now - last) * factor;
|
||||
}
|
||||
return interp;
|
||||
}
|
||||
|
||||
private enum CropType {
|
||||
WHEAT("THEORETICAL_HOE_WHEAT", "Wheat"),
|
||||
NETHER_WART("THEORETICAL_HOE_WARTS", "Warts"),
|
||||
SUGAR_CANE("THEORETICAL_HOE_CANE", "Sugar"),
|
||||
CARROT("THEORETICAL_HOE_CARROT", "Carrots"),
|
||||
POTATO("THEORETICAL_HOE_POTATO", "Potatoes"),
|
||||
COCOA_BEANS("COCO_CHOPPER", "Cocoas"),
|
||||
PUMPKIN("PUMPKIN_DICER", "Pumpkins"),
|
||||
MELON("MELON_DICER", "Melons"),
|
||||
CACTUS("CACTUS_KNIFE", "Cactus"),
|
||||
;
|
||||
|
||||
private final String toolName;
|
||||
private final String item;
|
||||
|
||||
CropType(String toolName, String item) {
|
||||
this.toolName = toolName;
|
||||
this.item = item;
|
||||
}
|
||||
}
|
||||
|
||||
private class OverlayString {
|
||||
final String type;
|
||||
final String text;
|
||||
|
||||
private OverlayString(String type, String text) {
|
||||
this.type = type;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return Formatting.AQUA + this.type + ": " + Formatting.YELLOW + this.text;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
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<String> 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;
|
||||
}
|
||||
}
|
||||
}
|
23
src/main/java/lel/flummi/skilloverlay/skilloverlay.java
Normal file
23
src/main/java/lel/flummi/skilloverlay/skilloverlay.java
Normal file
@ -0,0 +1,23 @@
|
||||
package lel.flummi.skilloverlay;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
|
||||
import lel.flummi.skilloverlay.overlays.FarmingOverlay;
|
||||
|
||||
import lel.flummi.skilloverlay.api.PlayerProfile;
|
||||
|
||||
public class skilloverlay implements ModInitializer {
|
||||
public static FarmingOverlay OVERLAY;
|
||||
public static PlayerProfile API;
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
System.out.println("Skilloverlay started.");
|
||||
|
||||
OVERLAY = new FarmingOverlay();
|
||||
|
||||
PlayerProfile.init();
|
||||
|
||||
//System.out.println(profiles.profiles().get("b2255349-d395-4169-9980-3ec0a32b2cfb").data().skills().get("farming").xp());
|
||||
}
|
||||
}
|
24
src/main/java/lel/flummi/skilloverlay/utils/LerpUtils.java
Normal file
24
src/main/java/lel/flummi/skilloverlay/utils/LerpUtils.java
Normal file
@ -0,0 +1,24 @@
|
||||
package lel.flummi.skilloverlay.utils;
|
||||
|
||||
public class LerpUtils {
|
||||
public static float clampZeroOne(float f) {
|
||||
return Math.max(0, Math.min(1, f));
|
||||
}
|
||||
|
||||
public static float sigmoid(float val) {
|
||||
return (float) (1 / (1 + Math.exp(-val)));
|
||||
}
|
||||
|
||||
private static final float sigmoidStr = 8;
|
||||
private static final float sigmoidA = -1 / (sigmoid(-0.5f * sigmoidStr) - sigmoid(0.5f * sigmoidStr));
|
||||
private static final float sigmoidB = sigmoidA * sigmoid(-0.5f * sigmoidStr);
|
||||
|
||||
public static float sigmoidZeroOne(float f) {
|
||||
f = clampZeroOne(f);
|
||||
return sigmoidA * sigmoid(sigmoidStr * (f - 0.5f)) - sigmoidB;
|
||||
}
|
||||
|
||||
public static float lerp(float a, float b, float amount) {
|
||||
return b + (a - b) * clampZeroOne(amount);
|
||||
}
|
||||
}
|
BIN
src/main/resources/assets/skilloverlay/icon.png
Normal file
BIN
src/main/resources/assets/skilloverlay/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 453 B |
34
src/main/resources/fabric.mod.json
Normal file
34
src/main/resources/fabric.mod.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "skilloverlay",
|
||||
"version": "${version}",
|
||||
"name": "skilloverlay",
|
||||
"description": "skilloverlay for Hypixel Skyblock",
|
||||
"authors": [
|
||||
"Flummi"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://fabricmc.net/",
|
||||
"sources": "https://github.com/FabricMC/fabric-example-mod"
|
||||
},
|
||||
|
||||
"license": "GNU LGPLv3",
|
||||
"icon": "assets/skilloverlay/icon.png",
|
||||
|
||||
"environment": "client",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"lel.flummi.skilloverlay.skilloverlay"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"skilloverlay.mixins.json"
|
||||
],
|
||||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.19",
|
||||
"fabric-api": ">=0.81.0+1.19.4",
|
||||
"minecraft": "~1.19.4",
|
||||
"java": ">=17"
|
||||
}
|
||||
}
|
11
src/main/resources/skilloverlay.mixins.json
Normal file
11
src/main/resources/skilloverlay.mixins.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "lel.flummi.skilloverlay.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"client": [
|
||||
"GameRenderMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user