diff options
Diffstat (limited to 'mod/src/main/java/kr/syeyoung/dungeonsguide/features')
164 files changed, 0 insertions, 15494 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java deleted file mode 100644 index 9eea3694..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features; - -import com.google.common.base.Supplier; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.config.types.TypeConverter; -import kr.syeyoung.dungeonsguide.config.types.TypeConverterRegistry; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import lombok.Getter; -import lombok.Setter; - -import java.util.*; - -public abstract class AbstractFeature { - @Getter - private final String category; - @Getter - private final String name; - - @Getter - private final String description; - - @Getter - private final String key; - - protected Map<String, FeatureParameter> parameters = new HashMap<String, FeatureParameter>(); - - protected AbstractFeature(String category, String name, String description, String key) { - this.category = category; - this.name = name; - this.description = description; - this.key = key; - } - - @Getter - @Setter - private boolean enabled = true; - - public List<FeatureParameter> getParameters() { return new ArrayList<FeatureParameter>(parameters.values()); } - - public <T> FeatureParameter<T> getParameter(String key) { - return parameters.get(key); - } - - public void loadConfig(JsonObject jsonObject) { // gets key, calls it - enabled = jsonObject.get("$enabled").getAsBoolean(); - - for (Map.Entry<String, FeatureParameter> parameterEntry : parameters.entrySet()) { - parameterEntry.getValue().setToDefault(); - JsonElement element = jsonObject.get(parameterEntry.getKey()); - if (element == null) continue; - TypeConverter typeConverter = TypeConverterRegistry.getTypeConverter(parameterEntry.getValue().getValue_type()); - parameterEntry.getValue().setValue(typeConverter.deserialize(element)); - } - } - - public JsonObject saveConfig() { - JsonObject object = new JsonObject(); - for (Map.Entry<String, FeatureParameter> parameterEntry : parameters.entrySet()) { - TypeConverter typeConverter = TypeConverterRegistry.getTypeConverter(parameterEntry.getValue().getValue_type()); - JsonElement obj = typeConverter.serialize(parameterEntry.getValue().getValue()); - object.add(parameterEntry.getKey(), obj); - } - object.addProperty("$enabled", isEnabled()); - return object; - } - - public String getEditRoute(RootConfigPanel rootConfigPanel) { - ConfigPanelCreator.map.put("base." + key , new Supplier<MPanel>() { - @Override - public MPanel get() { - MFeatureEdit featureEdit = new MFeatureEdit(AbstractFeature.this, rootConfigPanel); - for (FeatureParameter parameter: getParameters()) { - featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(AbstractFeature.this, parameter, rootConfigPanel)); - } - return featureEdit; - } - }); - return "base." + key ; - } - - public void onParameterReset() {} - - public boolean isDisyllable() { - return true; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureParameter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureParameter.java deleted file mode 100644 index eabfe218..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureParameter.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features; - -import kr.syeyoung.dungeonsguide.config.types.TypeConverter; -import kr.syeyoung.dungeonsguide.config.types.TypeConverterRegistry; -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class FeatureParameter<T> { - private String key; - - private String name; - private String description; - - private T value; - private T default_value; - private String value_type; - - public FeatureParameter(String key, String name, String description, T default_value, String value_type) { - this.key = key; this.name = name; this.default_value = default_value; - this.description = description; this.value_type = value_type; - } - - public void setToDefault() { - TypeConverter<T> typeConverter = TypeConverterRegistry.getTypeConverter(getValue_type()); - value = (T) typeConverter.deserialize(typeConverter.serialize(default_value)); - } - - public T getValue() { - return value == null ? default_value : value; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java deleted file mode 100644 index b7beb540..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features; - -import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureDebug; -import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureDebuggableMap; -import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureRoomCoordDisplay; -import kr.syeyoung.dungeonsguide.features.impl.advanced.FeatureRoomDebugInfo; -import kr.syeyoung.dungeonsguide.features.impl.boss.*; -import kr.syeyoung.dungeonsguide.features.impl.boss.terminal.FeatureSimonSaysSolver; -import kr.syeyoung.dungeonsguide.features.impl.boss.terminal.FeatureTerminalSolvers; -import kr.syeyoung.dungeonsguide.features.impl.cosmetics.FeatureNicknameColor; -import kr.syeyoung.dungeonsguide.features.impl.cosmetics.FeatureNicknamePrefix; -import kr.syeyoung.dungeonsguide.features.impl.discord.inviteViewer.PartyInviteViewer; -import kr.syeyoung.dungeonsguide.features.impl.discord.onlinealarm.PlayingDGAlarm; -import kr.syeyoung.dungeonsguide.features.impl.dungeon.*; -import kr.syeyoung.dungeonsguide.features.impl.etc.*; -import kr.syeyoung.dungeonsguide.features.impl.etc.ability.FeatureAbilityCooldown; -import kr.syeyoung.dungeonsguide.features.impl.party.APIKey; -import kr.syeyoung.dungeonsguide.features.impl.party.FeaturePartyList; -import kr.syeyoung.dungeonsguide.features.impl.party.FeaturePartyReady; -import kr.syeyoung.dungeonsguide.features.impl.party.customgui.FeatureCustomPartyFinder; -import kr.syeyoung.dungeonsguide.features.impl.party.playerpreview.FeatureViewPlayerOnJoin; -import kr.syeyoung.dungeonsguide.features.impl.secret.*; -import kr.syeyoung.dungeonsguide.features.impl.secret.mechanicbrowser.FeatureMechanicBrowse; -import kr.syeyoung.dungeonsguide.features.impl.solvers.*; -import kr.syeyoung.dungeonsguide.features.impl.dungeon.*; -import kr.syeyoung.dungeonsguide.features.impl.solvers.*; -import lombok.Getter; -import org.lwjgl.input.Keyboard; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class FeatureRegistry { - @Getter - private static final List<AbstractFeature> featureList = new ArrayList<AbstractFeature>(); - private static final Map<String, AbstractFeature> featureByKey = new HashMap<String, AbstractFeature>(); - @Getter - private static final Map<String, List<AbstractFeature>> featuresByCategory = new HashMap<String, List<AbstractFeature>>(); - @Getter - private static final Map<String, String> categoryDescription = new HashMap<>(); - - public static AbstractFeature getFeatureByKey(String key) { - return featureByKey.get(key); - } - - public static <T extends AbstractFeature> T register(T abstractFeature) { - if (featureByKey.containsKey(abstractFeature.getKey())) throw new IllegalArgumentException("DUPLICATE FEATURE DEFINITION"); - featureList.add(abstractFeature); - featureByKey.put(abstractFeature.getKey(), abstractFeature); - List<AbstractFeature> features = featuresByCategory.get(abstractFeature.getCategory()); - if (features == null) - features = new ArrayList<AbstractFeature>(); - features.add(abstractFeature); - featuresByCategory.put(abstractFeature.getCategory(), features); - - return abstractFeature; - } - - - - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_GLOBAL = register(new PathfindLineProperties("Dungeon Secrets", "Global Line Settings", "Global Line Settings", "secret.lineproperties.global", true, null)); - - - public static final FeatureMechanicBrowse SECRET_BROWSE = register(new FeatureMechanicBrowse()); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_SECRET_BROWSER = register(new PathfindLineProperties("Dungeon Secrets.Secret Browser", "Line Settings", "Line Settings when pathfinding using Secret Browser", "secret.lineproperties.secretbrowser", true, SECRET_LINE_PROPERTIES_GLOBAL)); - public static final FeatureActions SECRET_ACTIONS = register(new FeatureActions()); - - public static final FeaturePathfindStrategy SECRET_PATHFIND_STRATEGY = register(new FeaturePathfindStrategy()); - public static final FeatureTogglePathfind SECRET_TOGGLE_KEY = register(new FeatureTogglePathfind()); - public static final FeatureFreezePathfind SECRET_FREEZE_LINES = register(new FeatureFreezePathfind()); - public static final FeatureCreateRefreshLine SECRET_CREATE_REFRESH_LINE = register(new FeatureCreateRefreshLine()); - static { - categoryDescription.put("ROOT.Dungeon Secrets.Keybinds", "Useful keybinds / Toggle Pathfind lines, Freeze Pathfind lines, Refresh pathfind line or Trigger pathfind (you would want to use it, if you're using Pathfind to All)"); - } - - - public static final SimpleFeature SECRET_AUTO_BROWSE_NEXT = register(new SimpleFeature("Dungeon Secrets.Legacy AutoPathfind", "Auto Pathfind to next secret", "Auto browse best next secret after current one completes.\nthe first pathfinding of first secret needs to be triggered first in order for this option to work", "secret.autobrowse", false)); - public static final SimpleFeature SECRET_AUTO_START = register(new SimpleFeature("Dungeon Secrets.Legacy AutoPathfind", "Auto pathfind to new secret", "Auto browse best secret upon entering the room.", "secret.autouponenter", false)); - public static final SimpleFeature SECRET_NEXT_KEY = register(new SimpleFeature("Dungeon Secrets.Legacy AutoPathfind", "Auto Pathfind to new secret upon pressing a key", "Auto browse the best next secret when you press key.\nPress settings to edit the key", "secret.keyfornext", false) { - { - parameters.put("key", new FeatureParameter<Integer>("key", "Key","Press to navigate to next best secret", Keyboard.KEY_NONE, "keybind")); - } - }); - - public static final SimpleFeature SECRET_BLOOD_RUSH = register(new FeatureBloodRush()); - public static final PathfindLineProperties SECRET_BLOOD_RUSH_LINE_PROPERTIES = register(new PathfindLineProperties("Dungeon Secrets.Blood Rush", "Blood Rush Line Settings", "Line Settings to be used", "secret.lineproperties.bloodrush", false, SECRET_LINE_PROPERTIES_GLOBAL)); - - - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_AUTOPATHFIND = register(new PathfindLineProperties("Dungeon Secrets.Legacy AutoPathfind", "Line Settings", "Line Settings when pathfinding using above features", "secret.lineproperties.autopathfind", true, SECRET_LINE_PROPERTIES_GLOBAL)); - - public static final FeaturePathfindToAll SECRET_PATHFIND_ALL = register(new FeaturePathfindToAll()); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Parent Line Settings", "Line Settings to be used by default", "secret.lineproperties.apf.parent", false, SECRET_LINE_PROPERTIES_GLOBAL)); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_BAT = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Bat Line Settings", "Line Settings when pathfind to Bat, when using above feature", "secret.lineproperties.apf.bat", true, SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT)); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_CHEST = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Chest Line Settings", "Line Settings when pathfind to Chest, when using above feature", "secret.lineproperties.apf.chest", true, SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT)); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_ESSENCE = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Essence Line Settings", "Line Settings when pathfind to Essence, when using above feature", "secret.lineproperties.apf.essence", true, SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT)); - public static final PathfindLineProperties SECRET_LINE_PROPERTIES_PATHFINDALL_ITEM_DROP = register(new PathfindLineProperties("Dungeon Secrets.Pathfind To All", "Item Drop Line Settings", "Line Settings when pathfind to Item Drop, when using above feature", "secret.lineproperties.apf.itemdrop", true, SECRET_LINE_PROPERTIES_PATHFINDALL_PARENT)); - - public static final FeatureSolverRiddle SOLVER_RIDDLE = register(new FeatureSolverRiddle()); - public static final FeatureSolverTictactoe SOLVER_TICTACTOE = register(new FeatureSolverTictactoe()); - public static final SimpleFeature SOLVER_WATERPUZZLE = register(new SimpleFeature("Solver.Any Floor", "Waterboard (Advanced)", "Calculates solution for waterboard puzzle and displays it to user", "solver.waterboard")); - public static final SimpleFeature SOLVER_CREEPER = register(new SimpleFeature("Solver.Any Floor", "Creeper", "Draws line between prismarine lamps in creeper room", "solver.creeper")); - public static final FeatureSolverTeleport SOLVER_TELEPORT = register(new FeatureSolverTeleport()); - public static final FeatureSolverBlaze SOLVER_BLAZE = register(new FeatureSolverBlaze()); - public static final FeatureSolverIcefill SOLVER_ICEPATH = register(new FeatureSolverIcefill()); - public static final FeatureSolverSilverfish SOLVER_SILVERFISH = register(new FeatureSolverSilverfish()); - public static final FeatureSolverBox SOLVER_BOX = register(new FeatureSolverBox()); - public static final FeatureSolverKahoot SOLVER_KAHOOT = register(new FeatureSolverKahoot()); - public static final FeatureSolverBombdefuse SOLVER_BOMBDEFUSE = register(new FeatureSolverBombdefuse()); - - - public static final FeatureDungeonMap DUNGEON_MAP = register(new FeatureDungeonMap()); - public static final FeatureDungeonRoomName DUNGEON_ROOMNAME = register(new FeatureDungeonRoomName()); - public static final FeaturePressAnyKeyToCloseChest DUNGEON_CLOSECHEST = register(new FeaturePressAnyKeyToCloseChest()); - public static final FeatureBoxSkelemaster DUNGEON_BOXSKELEMASTER = register(new FeatureBoxSkelemaster()); - public static final FeatureBoxBats DUNGEON_BOXBAT = register(new FeatureBoxBats()); - public static final FeatureBoxStarMobs DUNGEON_BOXSTARMOBS = register(new FeatureBoxStarMobs()); - public static final FeatureWatcherWarning DUNGEON_WATCHERWARNING = register(new FeatureWatcherWarning()); - public static final FeatureDungeonDeaths DUNGEON_DEATHS = register(new FeatureDungeonDeaths()); - public static final FeatureDungeonMilestone DUNGEON_MILESTONE = register(new FeatureDungeonMilestone()); - public static final FeatureDungeonRealTime DUNGEON_REALTIME = register(new FeatureDungeonRealTime()); - public static final FeatureDungeonSBTime DUNGEON_SBTIME = register(new FeatureDungeonSBTime()); - public static final FeatureDungeonSecrets DUNGEON_SECRETS = register(new FeatureDungeonSecrets()); - public static final FeatureDungeonCurrentRoomSecrets DUNGEON_SECRETS_ROOM = register(new FeatureDungeonCurrentRoomSecrets()); - public static final FeatureDungeonTombs DUNGEON_TOMBS = register(new FeatureDungeonTombs()); - public static final FeatureDungeonScore DUNGEON_SCORE = register(new FeatureDungeonScore()); - public static final FeatureWarnLowHealth DUNGEON_LOWHEALTH_WARN = register(new FeatureWarnLowHealth()); - public static final SimpleFeature DUNGEON_INTERMODCOMM = register(new SimpleFeature("Dungeon.Teammates", "Communicate With Other's Dungeons Guide", "Sends total secret in the room to others\nSo that they can use the data to calculate total secret in dungeon run\n\nThis automates player chatting action, (chatting data) Thus it might be against hypixel's rules.\nBut mods like auto-gg which also automate player action and is kinda allowed mod exist so I'm leaving this feature.\nThis option is use-at-your-risk and you'll be responsible for ban if you somehow get banned because of this feature\n(Although it is not likely to happen)\nDefaults to off", "dungeon.intermodcomm", false)); - public static final FeaturePlayerESP DUNGEON_PLAYERESP = register(new FeaturePlayerESP()); - public static final FeatureHideNameTags DUNGEON_HIDENAMETAGS = register(new FeatureHideNameTags()); - public static final FeatureSoulRoomWarning DUNGEON_FAIRYSOUL = register(new FeatureSoulRoomWarning()); - - public static final FeatureWarningOnPortal BOSSFIGHT_WARNING_ON_PORTAL = register(new FeatureWarningOnPortal()); - public static final SimpleFeature BOSSFIGHT_CHESTPRICE = register(new FeatureChestPrice()); - public static final FeatureAutoReparty BOSSFIGHT_AUTOREPARTY = register(new FeatureAutoReparty()); - public static final FeatureBossHealth BOSSFIGHT_HEALTH = register(new FeatureBossHealth()); - public static final FeatureHideAnimals BOSSFIGHT_HIDE_ANIMALS = register(new FeatureHideAnimals()); - public static final FeatureThornBearPercentage BOSSFIGHT_BEAR_PERCENT = register(new FeatureThornBearPercentage()); - public static final FeatureThornSpiritBowTimer BOSSFIGHT_BOW_TIMER = register(new FeatureThornSpiritBowTimer()); - public static final FeatureBoxRealLivid BOSSFIGHT_BOX_REALLIVID = register(new FeatureBoxRealLivid()); - public static final FeatureTerracotaTimer BOSSFIGHT_TERRACOTTA_TIMER = register(new FeatureTerracotaTimer()); - public static final FeatureCurrentPhase BOSSFIGHT_CURRENT_PHASE = register(new FeatureCurrentPhase()); - public static final FeatureTerminalSolvers BOSSFIGHT_TERMINAL_SOLVERS = register(new FeatureTerminalSolvers()); - public static final FeatureSimonSaysSolver BOSSFIGHT_SIMONSAYS_SOLVER = register(new FeatureSimonSaysSolver()); - - public static final APIKey PARTYKICKER_APIKEY = register(new APIKey()); - public static final FeatureViewPlayerOnJoin PARTYKICKER_VIEWPLAYER = register(new FeatureViewPlayerOnJoin()); - public static final FeatureCustomPartyFinder PARTYKICKER_CUSTOM = register(new FeatureCustomPartyFinder()); - public static final FeaturePartyList PARTY_LIST = register(new FeaturePartyList()); - public static final FeaturePartyReady PARTY_READY = register(new FeaturePartyReady()); - - public static final FeatureTooltipDungeonStat ETC_DUNGEONSTAT = register(new FeatureTooltipDungeonStat()); - public static final FeatureTooltipPrice ETC_PRICE = register(new FeatureTooltipPrice()); - public static final FeatureAbilityCooldown ETC_ABILITY_COOLDOWN = register(new FeatureAbilityCooldown()); - public static final FeatureCooldownCounter ETC_COOLDOWN = register(new FeatureCooldownCounter()); - public static final FeatureRepartyCommand ETC_REPARTY = register(new FeatureRepartyCommand()); - public static final FeatureDecreaseExplosionSound ETC_EXPLOSION_SOUND = register(new FeatureDecreaseExplosionSound()); - public static final FeatureAutoAcceptReparty ETC_AUTO_ACCEPT_REPARTY = register(new FeatureAutoAcceptReparty()); - public static final FeatureUpdateAlarm ETC_TEST = register(new FeatureUpdateAlarm()); - - public static final SimpleFeature FIX_SPIRIT_BOOTS = register(new SimpleFeature("Misc", "Spirit Boots Fixer", "Fix Spirit boots messing up with inventory", "fixes.spirit", true)); - public static final FeatureDisableMessage FIX_MESSAGES = register(new FeatureDisableMessage()); - - public static final FeatureCopyMessages ETC_COPY_MSG = register(new FeatureCopyMessages()); - - public static final FeaturePenguins ETC_PENGUIN = register(new FeaturePenguins()); - - public static final FeatureCollectScore ETC_COLLECT_SCORE = register(new FeatureCollectScore()); - - - - - - public static final FeatureNicknamePrefix COSMETIC_PREFIX = register(new FeatureNicknamePrefix()); - public static final FeatureNicknameColor COSMETIC_NICKNAMECOLOR = register(new FeatureNicknameColor()); - - - - public static final SimpleFeature DISCORD_RICHPRESENCE = register(new SimpleFeature("Discord", "Discord RPC", "Enable Discord rich presence", "advanced.richpresence", true) { - { - parameters.put("disablenotskyblock", new FeatureParameter<Boolean>("disablenotskyblock", "Disable When not on Skyblock", "Disable When not on skyblock", false, "boolean")); - } - }); - public static final PartyInviteViewer DISCORD_ASKTOJOIN = register(new PartyInviteViewer()); - public static final PlayingDGAlarm DISCORD_ONLINEALARM = register(new PlayingDGAlarm()); - public static final SimpleFeature DISCORD_DONOTUSE = register(new SimpleFeature("Discord", "Disable Native Library", "Disables usage of jna for discord rpc support.\nBreaks any discord related feature in the mod.\nRequires mod restart to get affected.\n\nThis feature is only for those whose minecraft crashes due to discord gamesdk crash.", "discord.rpc", false)); - - - public static final SimpleFeature DEBUG = register(new FeatureDebug()); - public static final SimpleFeature ADVANCED_ROOMEDIT = register(new SimpleFeature("Advanced", "Room Edit", "Allow editing dungeon rooms\n\nWarning: using this feature can break or freeze your Minecraft\nThis is only for advanced users only", "advanced.roomedit", false){ - { - parameters.put("key", new FeatureParameter<Integer>("key", "Key","Press to edit room", Keyboard.KEY_R, "keybind")); - } - }); - - public static final FeatureRoomDebugInfo ADVANCED_DEBUG_ROOM = register(new FeatureRoomDebugInfo()); - public static final FeatureDebuggableMap ADVANCED_DEBUGGABLE_MAP = register(new FeatureDebuggableMap()); - public static final FeatureRoomCoordDisplay ADVANCED_COORDS = register(new FeatureRoomCoordDisplay()); - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java deleted file mode 100644 index 527a1054..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features; - -import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfigV2; -import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; -import kr.syeyoung.dungeonsguide.config.types.GUIRectangle; -import kr.syeyoung.dungeonsguide.config.types.TypeConverterRegistry; -import kr.syeyoung.dungeonsguide.features.listener.ScreenRenderListener; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.gui.elements.MPassiveLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.awt.*; -import java.util.ArrayList; -import java.util.List; - -@Getter -public abstract class GuiFeature extends AbstractFeature implements ScreenRenderListener { - @Setter - private GUIRectangle featureRect; - @Setter(value = AccessLevel.PROTECTED) - private boolean keepRatio; - @Setter(value = AccessLevel.PROTECTED) - private double defaultWidth; - @Setter(value = AccessLevel.PROTECTED) - private double defaultHeight; - private final double defaultRatio; - - protected GuiFeature(String category, String name, String description, String key, boolean keepRatio, int width, int height) { - super(category, name, description, key); - this.keepRatio = keepRatio; - this.defaultWidth = width; - this.defaultHeight = height; - this.defaultRatio = defaultWidth / defaultHeight; - this.featureRect = new GUIRectangle(0, 0, width, height); - } - - @Override - public void drawScreen(float partialTicks) { - if (!isEnabled()) return; - - GlStateManager.pushMatrix(); - Rectangle featureRect = this.featureRect.getRectangleNoScale(); - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GlStateManager.scale(1.0/scaledResolution.getScaleFactor(), 1.0/scaledResolution.getScaleFactor(), 1); - clip(featureRect.x, featureRect.y, featureRect.width, featureRect.height); - GL11.glEnable(GL11.GL_SCISSOR_TEST); - - GlStateManager.translate(featureRect.x, featureRect.y, 0); - drawHUD(partialTicks); - - GL11.glDisable(GL11.GL_SCISSOR_TEST); - GlStateManager.popMatrix(); - - - GlStateManager.enableBlend(); - GlStateManager.color(1,1,1,1); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - } - - - public abstract void drawHUD(float partialTicks); - - public void drawDemo(float partialTicks) { - drawHUD(partialTicks); - } - - private void clip(int x, int y, int width, int height) { -// int scale = resolution.getScaleFactor(); - int scale = 1; - GL11.glScissor((x ) * scale, Minecraft.getMinecraft().displayHeight - (y + height) * scale, (width) * scale, height * scale); - } - - public static FontRenderer getFontRenderer() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - return fr; - } - - @Override - public void loadConfig(JsonObject jsonObject) { - super.loadConfig(jsonObject); - this.featureRect = TypeConverterRegistry.getTypeConverter("guirect",GUIRectangle.class).deserialize(jsonObject.get("$bounds")); - } - - @Override - public JsonObject saveConfig() { - JsonObject object = super.saveConfig(); - object.add("$bounds", TypeConverterRegistry.getTypeConverter("guirect", GUIRectangle.class).serialize(featureRect)); - return object; - } - - public List<MPanel> getTooltipForEditor(GuiGuiLocationConfig guiGuiLocationConfig) { - ArrayList<MPanel> mPanels = new ArrayList<>(); - mPanels.add(new MLabel(){ - { - setText(getName()); - } - - @Override - public Dimension getPreferredSize() { - return new Dimension(Minecraft.getMinecraft().fontRendererObj.getStringWidth(getName()), 20); - } - }); - mPanels.add(new MButton() { - { - setText("Edit"); - setOnActionPerformed(() -> { - GuiScreen guiScreen = guiGuiLocationConfig.getBefore(); - if (guiScreen == null) { - guiScreen = new GuiConfigV2(); - } - Minecraft.getMinecraft().displayGuiScreen(guiScreen); - if (guiScreen instanceof GuiConfigV2) { - ((GuiConfigV2) guiScreen).getRootConfigPanel().setCurrentPageAndPushHistory(getEditRoute(((GuiConfigV2) guiScreen).getRootConfigPanel())); - } - }); - } - - @Override - public Dimension getPreferredSize() { - return new Dimension(100,20); - } - }); - mPanels.add(new MPassiveLabelAndElement("Enabled", new MToggleButton() {{ - setEnabled(GuiFeature.this.isEnabled()); - setOnToggle(() ->{ - GuiFeature.this.setEnabled(isEnabled()); - }); } - })); - return mPanels; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/SimpleFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/SimpleFeature.java deleted file mode 100644 index 11adeb67..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/SimpleFeature.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features; - -public class SimpleFeature extends AbstractFeature { - protected SimpleFeature(String category, String name, String key) { - this(category, name, name, key); - } - protected SimpleFeature(String category, String name, String description, String key) { - this(category, name, description, key, true); - } - - protected SimpleFeature(String category, String name, String description, String key, boolean enabled) { - super(category, name, description, key); - this.setEnabled(enabled); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebug.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebug.java deleted file mode 100644 index 3e8b0a09..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebug.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.advanced; - -import com.google.common.base.Supplier; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.gui.elements.MLabel; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.gui.MPanel; - -public class FeatureDebug extends SimpleFeature { - public FeatureDebug() { - super("Advanced", "Debug", "Toggles debug mode", "debug", false); - parameters.put("Key", new FeatureParameter<String>("Key", "Secret Key given by syeyoung", "Put the debug enable key here to enable debug mode", "","string")); - } - @Override - public boolean isEnabled() { - return "just hide it".equals(this.<String>getParameter("Key").getValue()); - } - @Override - public boolean isDisyllable() { - return false; - } - - @Override - public String getEditRoute(RootConfigPanel rootConfigPanel) { - ConfigPanelCreator.map.put("base." + getKey() , new Supplier<MPanel>() { - @Override - public MPanel get() { - MFeatureEdit featureEdit = new MFeatureEdit(FeatureDebug.this, rootConfigPanel); - for (FeatureParameter parameter: getParameters()) { - featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(FeatureDebug.this, parameter, rootConfigPanel)); - } - featureEdit.addParameterEdit("IsEnabled", new MParameterEdit(FeatureDebug.this, new FeatureParameter("Key Status", "Key Status", "Key Enabled? Or not?", "", "idk"), rootConfigPanel, new MLabel() { - @Override - public String getText() { - return isEnabled() ? "Enabled!" : "Incorrect Key"; - } - }, (a) -> false)); - return featureEdit; - } - }); - return "base." + getKey() ; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java deleted file mode 100644 index d2c3b7f6..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.advanced; - -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.utils.MapUtils; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiChat; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.texture.DynamicTexture; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.client.config.GuiUtils; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.util.Arrays; - -public class FeatureDebuggableMap extends GuiFeature { - public FeatureDebuggableMap() { - super("Advanced", "Display Debug Info included map", "ONLY WORKS WITH SECRET SETTING", "advanced.debug.map", true, 128, 128); - this.setEnabled(false); - } - - - DynamicTexture dynamicTexture = new DynamicTexture(128, 128); - ResourceLocation location = Minecraft.getMinecraft().renderEngine.getDynamicTextureLocation("dungeons/map/", dynamicTexture); - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawHUD(float partialTicks) { -// if (!skyblockStatus.isOnDungeon()) return; - if (!FeatureRegistry.DEBUG.isEnabled()) return; -// DungeonContext context = skyblockStatus.getContext(); -// if (context == null) return; - - GlStateManager.pushMatrix(); - double factor = getFeatureRect().getRectangle().getWidth() / 128; - GlStateManager.scale(factor, factor, 1); - int[] textureData = dynamicTexture.getTextureData(); - MapUtils.getImage().getRGB(0, 0, 128, 128, textureData, 0, 128); - dynamicTexture.updateDynamicTexture(); - Minecraft.getMinecraft().getTextureManager().bindTexture(location); - GlStateManager.enableAlpha(); - GuiScreen.drawModalRectWithCustomSizedTexture(0, 0, 0, 0, 128, 128, 128, 128); - GlStateManager.popMatrix(); - - - if (!(Minecraft.getMinecraft().currentScreen instanceof GuiChat)) return; - Rectangle featureRect = this.getFeatureRect().getRectangleNoScale(); - - int i = (int) ((int) (Mouse.getEventX() - featureRect.getX()) / factor); - int j = (int) ((int) (Minecraft.getMinecraft().displayHeight - Mouse.getEventY() - featureRect.getY())/ factor); - if (i >= 0 && j>= 0 && i <= 128 && j <= 128 && MapUtils.getColors() != null) { - GuiUtils.drawHoveringText(Arrays.asList(i+","+j,"Color: "+MapUtils.getColors()[j * 128 + i]),(int)(Mouse.getEventX() - featureRect.getX()), (int) (Minecraft.getMinecraft().displayHeight - Mouse.getEventY() - featureRect.getY()), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, -1, Minecraft.getMinecraft().fontRendererObj); - } - } - - @Override - public void drawDemo(float partialTicks) { - FontRenderer fr = getFontRenderer(); - Rectangle featureRect = getFeatureRect().getRectangle(); - GL11.glLineWidth(2); - RenderUtils.drawUnfilledBox(0,0,featureRect.width, featureRect.height, 0xff000000, false); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java deleted file mode 100644 index 9762893b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomCoordDisplay.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.advanced; - -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.util.BlockPos; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.awt.*; - -public class FeatureRoomCoordDisplay extends GuiFeature { - public FeatureRoomCoordDisplay() { - super("Advanced", "Display Coordinate Relative to the Dungeon Room and room's rotation", "X: 0 Y: 3 Z: 5 Facing: Z+" , "advanced.coords", false, getFontRenderer().getStringWidth("X: 48 Y: 100 Z: 48 Facing: Z+"), 10); - this.setEnabled(false); - parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.yellow, "color")); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - private static final String[] facing = {"Z+", "X-", "Z-", "X+"}; - @Override - public void drawHUD(float partialTicks) { - if (!skyblockStatus.isOnDungeon()) return; - DungeonContext context = skyblockStatus.getContext(); - if (context == null) return; - - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - if (dungeonRoom == null) { - return; - } - - int facing = (int) (thePlayer.rotationYaw + 45) % 360; - if (facing < 0) facing += 360; - int real = (facing / 90 + dungeonRoom.getRoomMatcher().getRotation()) % 4; - - OffsetPoint offsetPoint = new OffsetPoint(dungeonRoom, new BlockPos((int)thePlayer.posX, (int)thePlayer.posY, (int)thePlayer.posZ)); - - FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; - - double scale = getFeatureRect().getRectangle().getHeight() / fontRenderer.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - - int color = this.<Color>getParameter("color").getValue().getRGB(); - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fontRenderer.drawString("X: "+offsetPoint.getX()+" Y: "+offsetPoint.getY()+" Z: "+offsetPoint.getZ()+" Facing: "+ FeatureRoomCoordDisplay.facing[real], 0, 0, color); - } - - @Override - public void drawDemo(float partialTicks) { - FontRenderer fr = getFontRenderer(); - int facing = (int) (Minecraft.getMinecraft().thePlayer.rotationYaw + 45) % 360; - if (facing < 0) facing += 360; - double scale = getFeatureRect().getRectangle().getHeight() / fr.FONT_HEIGHT; - GlStateManager.scale(scale, scale, 0); - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("X: 0 Y: 3 Z: 5 Facing: "+FeatureRoomCoordDisplay.facing[(facing / 90) % 4], 0,0, this.<Color>getParameter("color").getValue().getRGB()); - } - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java deleted file mode 100644 index 8ad1b470..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureRoomDebugInfo.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.advanced; - -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.GlStateManager; -import org.apache.commons.lang3.StringUtils; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.awt.*; - -public class FeatureRoomDebugInfo extends GuiFeature { - public FeatureRoomDebugInfo() { - super("Advanced", "Display Room Debug Info", "ONLY WORKS WITH SECRET SETTING", "advanced.debug.roominfo", false, getFontRenderer().getStringWidth("longestplayernamepos: 100"), getFontRenderer().FONT_HEIGHT * 6); - this.setEnabled(false); - parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.white, "color")); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawHUD(float partialTicks) { - if (!skyblockStatus.isOnDungeon()) return; - if (!FeatureRegistry.DEBUG.isEnabled()) return; - DungeonContext context = skyblockStatus.getContext(); - if (context == null) return; - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; - int color = this.<Color>getParameter("color").getValue().getRGB(); - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - if (dungeonRoom == null) { - if (context.getBossfightProcessor() == null) { - fontRenderer.drawString("Where are you?!", 0, 0, 0xFFFFFF); - } else { - fontRenderer.drawString("You're prob in bossfight", 0, 0, color); - fontRenderer.drawString("processor: "+context.getBossfightProcessor(), 0, 10, color); - fontRenderer.drawString("phase: "+context.getBossfightProcessor().getCurrentPhase(), 0, 20, color); - fontRenderer.drawString("nextPhase: "+ StringUtils.join(context.getBossfightProcessor().getNextPhases(), ","), 0, 30, color); - fontRenderer.drawString("phases: "+ StringUtils.join(context.getBossfightProcessor().getPhases(), ","), 0, 40, color); - } - } else { - fontRenderer.drawString("you're in the room... color/shape/rot " + dungeonRoom.getColor() + " / " + dungeonRoom.getShape() + " / "+dungeonRoom.getRoomMatcher().getRotation(), 0, 0, color); - fontRenderer.drawString("room uuid: " + dungeonRoom.getDungeonRoomInfo().getUuid() + (dungeonRoom.getDungeonRoomInfo().isRegistered() ? "" : " (not registered)"), 0, 10, color); - fontRenderer.drawString("room name: " + dungeonRoom.getDungeonRoomInfo().getName(), 0, 20, color); - fontRenderer.drawString("room state / max secret: " + dungeonRoom.getCurrentState() + " / "+dungeonRoom.getTotalSecrets(), 0, 30, color); - - } - } - - @Override - public void drawDemo(float partialTicks) { - FontRenderer fr = getFontRenderer(); - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Line 1", 0,0, this.<Color>getParameter("color").getValue().getRGB()); - fr.drawString("Line 2", 0,10, this.<Color>getParameter("color").getValue().getRGB()); - fr.drawString("Line 3", 0,20, this.<Color>getParameter("color").getValue().getRGB()); - fr.drawString("Line 4", 0,30, this.<Color>getParameter("color").getValue().getRGB()); - fr.drawString("Line 5", 0,40, this.<Color>getParameter("color").getValue().getRGB()); - } - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureAutoReparty.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureAutoReparty.java deleted file mode 100644 index 418b1654..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureAutoReparty.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.listener.DungeonQuitListener; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -public class FeatureAutoReparty extends SimpleFeature implements DungeonQuitListener { - public FeatureAutoReparty() { - super("Party.Reparty", "Auto reparty when dungeon finishes","Auto reparty on dungeon finish\n\nThis automates player chatting action, (disbanding, repartying) Thus it might be against hypixel's rules.\nBut mods like auto-gg exist so I'm leaving this feature.\nThis option is use-at-your-risk and you'll be responsible for ban if you somehow get banned because of this feature\n(Although it is not likely to happen)\nDefaults to off", "bossfight.autoreparty", false); - } - - @Override - public void onDungeonQuit() { - if (isEnabled()) DungeonsGuide.getDungeonsGuide().getCommandReparty().requestReparty(true); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java deleted file mode 100644 index fb858adf..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBossHealth.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.HealthData; -import kr.syeyoung.dungeonsguide.utils.TextUtils; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class FeatureBossHealth extends TextHUDFeature { - public FeatureBossHealth() { - super("Bossfight", "Display Boss Health(s)", "Show the health of boss and minibosses in bossfight (Guardians, Priests..)", "bossfight.health", false, getFontRenderer().getStringWidth("The Professor: 4242m"), getFontRenderer().FONT_HEIGHT * 5); - this.setEnabled(true); - parameters.put("totalHealth", new FeatureParameter<Boolean>("totalHealth", "show total health", "Show total health along with current health", false, "boolean")); - parameters.put("formatHealth", new FeatureParameter<Boolean>("formatHealth", "format health", "1234568 -> 1m", true, "boolean")); - parameters.put("ignoreInattackable", new FeatureParameter<Boolean>("ignoreInattackable", "Don't show health of in-attackable enemy", "For example, do not show guardians health when they're not attackable", false, "boolean")); - - getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("health", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator2", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("maxHealth", new AColor(0x55, 0x55,0xFF,255), new AColor(0, 0,0,0), false)); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - - @Override - public boolean doesScaleWithHeight() { - return false; - } - - @Override - public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() != null; - } - - @Override - public java.util.List<String> getUsedTextStyle() { - return Arrays.asList("title", "separator", "health", "separator2", "maxHealth"); - } - - @Override - public java.util.List<StyledText> getDummyText() { - List<StyledText> actualBit = new ArrayList<StyledText>(); - addLine(new HealthData("The Professor", 3300000, 5000000, false), actualBit); - addLine(new HealthData("Chaos Guardian", 500000, 2000000, true), actualBit); - addLine(new HealthData("Healing Guardian", 1000000, 3000000, true), actualBit); - addLine(new HealthData("Laser Guardian", 5000000, 5000000, true), actualBit); - addLine(new HealthData("Giant", 10000000, 20000000, false), actualBit); - return actualBit; - } - - public void addLine(HealthData data, List<StyledText> actualBit) { - boolean format = this.<Boolean>getParameter("formatHealth").getValue(); - boolean total = this.<Boolean>getParameter("totalHealth").getValue(); - boolean ignore = this.<Boolean>getParameter("ignoreInattackable").getValue(); - if (ignore && !data.isAttackable()) return; - - actualBit.add(new StyledText(data.getName(),"title")); - actualBit.add(new StyledText(": ","separator")); - actualBit.add(new StyledText( (format ? TextUtils.format(data.getHealth()) : data.getHealth()) + (total ? "" : "\n"),"health")); - if (total) { - actualBit.add(new StyledText("/", "separator2")); - actualBit.add(new StyledText( (format ? TextUtils.format(data.getMaxHealth()) : data.getMaxHealth()) +"\n","maxHealth")); - } - } - - @Override - public java.util.List<StyledText> getText() { - List<StyledText> actualBit = new ArrayList<StyledText>(); - List<HealthData> healths = skyblockStatus.getContext().getBossfightProcessor().getHealths(); - for (HealthData heal : healths) { - addLine(heal, actualBit); - } - return actualBit; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java deleted file mode 100644 index f70ced10..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureBoxRealLivid.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorLivid; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.entity.EntityOtherPlayerMP; -import net.minecraft.util.AxisAlignedBB; - - -public class FeatureBoxRealLivid extends SimpleFeature implements WorldRenderListener { - public FeatureBoxRealLivid() { - super("Bossfight.Floor 5", "Box Real Livid", "Box Real Livid in bossfight", "bossfight.realLividBox", true); - parameters.put("color", new FeatureParameter<AColor>("color", "Highlight Color", "Highlight Color of Livid", new AColor(0,255,0,150), "acolor")); - } - - - private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawWorld(float partialTicks) { - if (!isEnabled()) return; - if (!skyblockStatus.isOnDungeon()) return; - if (skyblockStatus.getContext() == null) return; - if (skyblockStatus.getContext().getBossfightProcessor() == null) return; - if (!(skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorLivid)) return; - EntityOtherPlayerMP playerMP = ((BossfightProcessorLivid) skyblockStatus.getContext().getBossfightProcessor()).getRealLivid(); - - AColor c = this.<AColor>getParameter("color").getValue(); - if (playerMP != null) - RenderUtils.highlightBox(playerMP, AxisAlignedBB.fromBounds(-0.4,0,-0.4,0.4,1.8,0.4), c, partialTicks, true); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java deleted file mode 100644 index de3873ba..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.listener.GuiBackgroundRenderListener; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.AhUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.client.event.GuiScreenEvent; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.util.Comparator; -import java.util.Set; -import java.util.TreeSet; - -public class FeatureChestPrice extends SimpleFeature implements GuiBackgroundRenderListener { - public FeatureChestPrice() { - super("Bossfight", "Show Profit of Dungeon Chests","Show Profit of Dungeon Chests", "bossfight.profitchest", false); - } - - @Override - public void onGuiBGRender(GuiScreenEvent.BackgroundDrawnEvent rendered) { - if (!isEnabled()) return; - if (!(rendered.gui instanceof GuiChest)) return; - if (!DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; - - GlStateManager.disableLighting(); - - ContainerChest chest = (ContainerChest) ((GuiChest) rendered.gui).inventorySlots; - if (!chest.getLowerChestInventory().getName().endsWith("Chest")) return; - IInventory actualChest = chest.getLowerChestInventory(); - - int chestPrice = 0; - int itemPrice = 0; - for (int i = 0; i <actualChest.getSizeInventory(); i++) { - ItemStack item = actualChest.getStackInSlot(i); - if (item != null) { - if (item.getDisplayName() != null && item.getDisplayName().contains("Reward")) { - NBTTagCompound tagCompound = item.serializeNBT().getCompoundTag("tag"); - if (tagCompound != null && tagCompound.hasKey("display", 10)) { - NBTTagCompound nbttagcompound = tagCompound.getCompoundTag("display"); - - if (nbttagcompound.getTagId("Lore") == 9) { - NBTTagList nbttaglist1 = nbttagcompound.getTagList("Lore", 8); - - if (nbttaglist1.tagCount() > 0) { - for (int j1 = 0; j1 < nbttaglist1.tagCount(); ++j1) { - String str = nbttaglist1.getStringTagAt(j1); - if (str.endsWith("Coins")) { - String coins = TextUtils.stripColor(str).replace(" Coins", "").replace(",",""); - try { - chestPrice = Integer.parseInt(coins); - } catch (Exception e) { - - } - } - } - } - } - } - } - itemPrice += getPrice(item) * item.stackSize; - } - } - - int i = 222; - int j = i - 108; - int ySize = j + (actualChest.getSizeInventory() / 9) * 18; - int left = (rendered.gui.width + 176) / 2; - int top = (rendered.gui.height - ySize ) / 2; - - int width = 120; - - GlStateManager.pushMatrix(); - GlStateManager.translate(left, top, 0); - Gui.drawRect( 0,0,width, 30, 0xFFDDDDDD); - - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("BIN/AH Price: ", 5,5, 0xFF000000); - String str = TextUtils.format(itemPrice); - fr.drawString(str, width - fr.getStringWidth(str) - 5, 5, 0xFF000000); - - fr.drawString("Profit: ", 5,15, 0xFF000000); - str = (itemPrice > chestPrice ? "+" : "") +TextUtils.format(itemPrice - chestPrice); - fr.drawString(str, width - fr.getStringWidth(str) - 5, 15, itemPrice > chestPrice ? 0xFF00CC00 : 0xFFCC0000); - - GlStateManager.popMatrix(); - - GlStateManager.enableLighting(); - GlStateManager.enableBlend(); - } - - public static long getPrice(ItemStack itemStack) { - if (itemStack == null) return 0; - NBTTagCompound compound = itemStack.getTagCompound(); - if (compound == null) - return 0; - if (!compound.hasKey("ExtraAttributes")) - return 0; - final String id = compound.getCompoundTag("ExtraAttributes").getString("id"); - if (id.equals("ENCHANTED_BOOK")) { - final NBTTagCompound enchants = compound.getCompoundTag("ExtraAttributes").getCompoundTag("enchantments"); - Set<String> keys = enchants.getKeySet(); - Set<String> actualKeys = new TreeSet<String>(new Comparator<String>() { - public int compare(String o1, String o2) { - String id2 = id + "::" + o1 + "-" + enchants.getInteger(o1); - AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2); - long price1 = (auctionData == null) ? 0 : auctionData.lowestBin; - String id3 = id + "::" + o2 + "-" + enchants.getInteger(o2); - AhUtils.AuctionData auctionData2 = AhUtils.auctions.get(id3); - long price2 = (auctionData2 == null) ? 0 : auctionData2.lowestBin; - return (compare2(price1, price2) == 0) ? o1.compareTo(o2) : compare2(price1, price2); - } - - public int compare2(long y, long x) { - return (x < y) ? -1 : ((x == y) ? 0 : 1); - } - }); - actualKeys.addAll(keys); - int totalLowestPrice = 0; - for (String key : actualKeys) { - String id2 = id + "::" + key + "-" + enchants.getInteger(key); - AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2); - totalLowestPrice += auctionData.lowestBin; - } - return totalLowestPrice; - } else { - AhUtils.AuctionData auctionData = AhUtils.auctions.get(id); - if (auctionData == null) { - return 0; - } else { - if (auctionData.sellPrice == -1 && auctionData.lowestBin != -1) return auctionData.lowestBin; - else if (auctionData.sellPrice != -1 && auctionData.lowestBin == -1) return auctionData.sellPrice; - else { - long ahPrice = auctionData.lowestBin; - if (ahPrice > auctionData.sellPrice) return ahPrice; - else return auctionData.sellPrice; - } - } - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureCurrentPhase.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureCurrentPhase.java deleted file mode 100644 index 5c199c61..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureCurrentPhase.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class FeatureCurrentPhase extends TextHUDFeature { - public FeatureCurrentPhase() { - super("Bossfight", "Display Current Phase", "Displays the current phase of bossfight", "bossfight.phasedisplay", false, getFontRenderer().getStringWidth("Current Phase: fight-2-idk-howlng"), getFontRenderer().FONT_HEIGHT); - this.setEnabled(true); - getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("phase", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - private static final List<StyledText> dummyText= new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("Current Phase","title")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("fight-2","phase")); - } - @Override - public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() != null; - } - - @Override - public List<String> getUsedTextStyle() { - return Arrays.asList("title", "separator", "phase"); - } - - @Override - public List<StyledText> getDummyText() { - return dummyText; - } - - @Override - public List<StyledText> getText() { - String currentPhsae =skyblockStatus.getContext().getBossfightProcessor().getCurrentPhase(); - List<StyledText> actualBit = new ArrayList<StyledText>(); - actualBit.add(new StyledText("Current Phase","title")); - actualBit.add(new StyledText(": ","separator")); - actualBit.add(new StyledText(currentPhsae,"phase")); - return actualBit; - } - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureHideAnimals.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureHideAnimals.java deleted file mode 100644 index 837b3d71..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureHideAnimals.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.EntityLivingRenderListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn; -import net.minecraft.entity.passive.*; -import net.minecraftforge.client.event.RenderLivingEvent; - - -public class FeatureHideAnimals extends SimpleFeature implements EntityLivingRenderListener { - public FeatureHideAnimals() { - super("Bossfight.Floor 4", "Hide animals on f4", "Hide Spirit Animals on F4. \nClick on Edit for precise setting", "bossfight.hideanimals", false); - parameters.put("sheep", new FeatureParameter<Boolean>("sheep", "Hide Sheeps", "Hide Sheeps", true, "boolean")); - parameters.put("cow", new FeatureParameter<Boolean>("cow", "Hide Cows", "Hide Cows", true, "boolean")); - parameters.put("chicken", new FeatureParameter<Boolean>("chicken", "Hide Chickens", "Hide Chickens", true, "boolean")); - parameters.put("wolf", new FeatureParameter<Boolean>("wolf", "Hide Wolves", "Hide Wolves", true, "boolean")); - parameters.put("rabbit", new FeatureParameter<Boolean>("rabbit", "Hide Rabbits", "Hide Rabbits", true, "boolean")); - } - - - private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - @Override - public void onEntityRenderPre(RenderLivingEvent.Pre renderPlayerEvent) { - if (!isEnabled()) return; - if (!skyblockStatus.isOnDungeon()) return; - if (skyblockStatus.getContext() == null) return; - if (skyblockStatus.getContext().getBossfightProcessor() == null) return; - if (!(skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorThorn)) return; - - if (renderPlayerEvent.entity instanceof EntitySheep && this.<Boolean>getParameter("sheep").getValue()) { - renderPlayerEvent.setCanceled(true); - } else if (renderPlayerEvent.entity instanceof EntityCow && this.<Boolean>getParameter("cow").getValue() ) { - renderPlayerEvent.setCanceled(true); - } else if (renderPlayerEvent.entity instanceof EntityChicken && this.<Boolean>getParameter("chicken").getValue()) { - renderPlayerEvent.setCanceled(true); - } else if (renderPlayerEvent.entity instanceof EntityWolf && this.<Boolean>getParameter("wolf").getValue()) { - renderPlayerEvent.setCanceled(true); - } else if (renderPlayerEvent.entity instanceof EntityRabbit && this.<Boolean>getParameter("rabbit").getValue()) { - renderPlayerEvent.setCanceled(true); - } - } - - @Override - public void onEntityRenderPost(RenderLivingEvent.Post renderPlayerEvent) { - - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureTerracotaTimer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureTerracotaTimer.java deleted file mode 100644 index a581ad0f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureTerracotaTimer.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorSadan; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.entity.boss.BossStatus; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class FeatureTerracotaTimer extends TextHUDFeature { - public FeatureTerracotaTimer() { - super("Bossfight.Floor 6", "Display Terracotta phase timer", "Displays Terracotta phase timer", "bossfight.terracota", true, getFontRenderer().getStringWidth("Terracottas: 1m 99s"), getFontRenderer().FONT_HEIGHT); - this.setEnabled(true); - getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("time", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - private static final List<StyledText> dummyText= new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("Terracottas","title")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("1m 99s","time")); - } - @Override - public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorSadan && - "fight-1".equalsIgnoreCase(skyblockStatus.getContext().getBossfightProcessor().getCurrentPhase()); - } - - @Override - public List<String> getUsedTextStyle() { - return Arrays.asList("title", "separator", "number", "unit"); - } - - @Override - public List<StyledText> getDummyText() { - return dummyText; - } - - @Override - public List<StyledText> getText() { - List<StyledText> actualBit = new ArrayList<StyledText>(); - actualBit.add(new StyledText("Terracottas","title")); - actualBit.add(new StyledText(": ","separator")); - actualBit.add(new StyledText(TextUtils.formatTime((long) (BossStatus.healthScale * 1000 * 60 * 1.5)),"time")); - return actualBit; - } - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java deleted file mode 100644 index c9249df9..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornBearPercentage.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class FeatureThornBearPercentage extends TextHUDFeature { - public FeatureThornBearPercentage() { - super("Bossfight.Floor 4", "Display Spirit Bear Summon Percentage", "Displays spirit bear summon percentage in hud", "bossfight.spiritbear", true, getFontRenderer().getStringWidth("Spirit Bear: 100%"), getFontRenderer().FONT_HEIGHT); - this.setEnabled(true); - getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("number", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("unit", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - private static final java.util.List<StyledText> dummyText= new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("Spirit Bear","title")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("50","number")); - dummyText.add(new StyledText("%","unit")); - } - @Override - public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorThorn; - } - - @Override - public java.util.List<String> getUsedTextStyle() { - return Arrays.asList("title", "separator", "number", "unit"); - } - - @Override - public java.util.List<StyledText> getDummyText() { - return dummyText; - } - - @Override - public java.util.List<StyledText> getText() { - int percentage = (int) (((BossfightProcessorThorn) skyblockStatus.getContext().getBossfightProcessor()).calculatePercentage() * 100); - List<StyledText> actualBit = new ArrayList<StyledText>(); - actualBit.add(new StyledText("Spirit Bear","title")); - actualBit.add(new StyledText(": ","separator")); - actualBit.add(new StyledText(percentage+"","number")); - actualBit.add(new StyledText("%","unit")); - return actualBit; - } - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornSpiritBowTimer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornSpiritBowTimer.java deleted file mode 100644 index c6470692..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureThornSpiritBowTimer.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss; - -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.listener.TitleListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorThorn; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.network.play.server.S45PacketTitle; -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class FeatureThornSpiritBowTimer extends TextHUDFeature implements ChatListener, TitleListener { - public FeatureThornSpiritBowTimer() { - super("Bossfight.Floor 4", "Display Spirit bow timer", "Displays how long until spirit bow gets destroyed", "bossfight.spiritbowdisplay", false, getFontRenderer().getStringWidth("Spirit Bow Destruction: 2m 00s"), getFontRenderer().FONT_HEIGHT); - getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("time", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - private static final List<StyledText> dummyText= new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("Spirit Bow Destruction","title")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("1s","time")); - } - @Override - public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorThorn && time > System.currentTimeMillis(); - } - - @Override - public List<String> getUsedTextStyle() { - return Arrays.asList("title", "separator", "time"); - } - - @Override - public List<StyledText> getDummyText() { - return dummyText; - } - - @Override - public List<StyledText> getText() { - List<StyledText> actualBit = new ArrayList<StyledText>(); - actualBit.add(new StyledText("Spirit Bow Destruction","title")); - actualBit.add(new StyledText(": ","separator")); - actualBit.add(new StyledText(TextUtils.formatTime(time - System.currentTimeMillis()),"time")); - return actualBit; - } - private long time = 0; - - @Override - public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { - if (!(skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorThorn)) return; - String text = clientChatReceivedEvent.message.getFormattedText(); - if (text.equals("§r§a§lThe §r§5§lSpirit Bow §r§a§lhas dropped!§r")) { - time = System.currentTimeMillis() + 16000; - } else if (text.startsWith("§r§c[BOSS] Thorn§r§f: ")) { - if (text.contains("another wound") - || text.contains("My energy, it goes away") - || text.contains("dizzy") - || text.contains("a delicate feeling")) { - time = 0; - } - } else if (text.startsWith("§r§b[CROWD]")) { - if (text.contains("That wasn't fair!!!") || text.contains("how to damage") || text.contains("Cheaters!") || text.contains("BOOOO")) { - time = 0; - } else if (text.contains("missing easy shots like that") || text.contains("missed the shot!") || text.contains("Keep dodging") || text.contains("no thumbs") || text.contains("can't aim")) { - time = 0; - } - } else if (text.equals("§r§cThe §r§5Spirit Bow§r§c disintegrates as you fire off the shot!§r")) { - time = 0; - } - } - - @Override - public void onTitle(S45PacketTitle renderPlayerEvent) { - if (!(skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getBossfightProcessor() instanceof BossfightProcessorThorn)) return; - if (renderPlayerEvent.getMessage().getFormattedText().contains("picked up")) { - time = System.currentTimeMillis() + 21000; - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java deleted file mode 100644 index 555c982d..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureWarningOnPortal.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss; - -import com.google.common.base.Supplier; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.impl.dungeon.FeatureDungeonScore; -import kr.syeyoung.dungeonsguide.features.text.PanelTextParameterConfig; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.StyledTextProvider; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.text.*; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.TextUtils; - -import java.util.*; - -public class FeatureWarningOnPortal extends SimpleFeature implements StyledTextProvider { - public FeatureWarningOnPortal() { - super("Dungeon.Blood Room", "Score Warning on Watcher portal", "Display warnings such as\n- 'NOT ALL ROOMS DISCOVERED'\n- 'NOT ALL ROOMS COMPLETED'\n- 'Expected Score: 304'\n- 'MISSING 3 CRYPTS'\non portal", "bossfight.warningonportal"); - this.parameters.put("textStyles", new FeatureParameter<List<TextStyle>>("textStyles", "", "", new ArrayList<TextStyle>(), "list_textStyle")); - getStyles().add(new TextStyle("warning", new AColor(255, 0,0,255), new AColor(255, 255,255,255), false)); - getStyles().add(new TextStyle("field_name", new AColor(255, 72,255,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("field_separator", new AColor(204, 204,204,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("field_value", new AColor(255, 255,0,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("field_etc", new AColor(204, 204,204,255), new AColor(0, 0,0,0), false)); - } - - - private static final List<StyledText> dummyText = new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("!!!WARNING!!! <- text changes in boss-room\n", "warning")); - - dummyText.add(new StyledText("Total Secrets","field_name")); - dummyText.add(new StyledText(": ","field_separator")); - dummyText.add(new StyledText("103/100 of 50","field_value")); - dummyText.add(new StyledText("(103% 41.2 Explorer)","field_etc")); - - - dummyText.add(new StyledText("Crypts","field_name")); - dummyText.add(new StyledText(": ","field_separator")); - dummyText.add(new StyledText("5/5\n","field_value")); - - - dummyText.add(new StyledText("Deaths","field_name")); - dummyText.add(new StyledText(": ","field_separator")); - dummyText.add(new StyledText("0\n","field_value")); - - dummyText.add(new StyledText("Score Estimate","field_name")); - dummyText.add(new StyledText(": ","field_separator")); - dummyText.add(new StyledText("1000 ","field_value")); - dummyText.add(new StyledText("(S++++)\n","field_etc")); - - - dummyText.add(new StyledText("Skill","field_name")); - dummyText.add(new StyledText(": ","field_separator")); - dummyText.add(new StyledText("100 ","field_value")); - dummyText.add(new StyledText("(0 Deaths: 0 pts)\n","field_etc")); - - dummyText.add(new StyledText("Explorer","field_name")); - dummyText.add(new StyledText(": ","field_separator")); - dummyText.add(new StyledText("100 ","field_value")); - dummyText.add(new StyledText("(100% + secrets)\n","field_etc")); - - dummyText.add(new StyledText("Time","field_name")); - dummyText.add(new StyledText(": ","field_separator")); - dummyText.add(new StyledText("100 ","field_value")); - dummyText.add(new StyledText("(-30m 29s)\n","field_etc")); - - dummyText.add(new StyledText("Bonus","field_name")); - dummyText.add(new StyledText(": ","field_separator")); - dummyText.add(new StyledText("5\n","field_value")); - } - @Override - public List<StyledText> getDummyText() { - return dummyText; - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override - public List<StyledText> getText() { - ArrayList<StyledText> texts = new ArrayList<StyledText>(); - DungeonContext context = skyblockStatus.getContext(); - FeatureDungeonScore.ScoreCalculation scoreCalculation = FeatureRegistry.DUNGEON_SCORE.calculateScore(); - - boolean failed = context.getDungeonRoomList().stream().anyMatch(a -> a.getCurrentState() == DungeonRoom.RoomState.FAILED); - if (context.getMapProcessor().getUndiscoveredRoom() > 0) { - texts.add(new StyledText("There are at least "+context.getMapProcessor().getUndiscoveredRoom()+" undiscovered rooms!\n", "warning")); - } else if (failed) { - texts.add(new StyledText("There is a failed puzzle room! Yikes!\n", "warning")); - } else if (!scoreCalculation.isFullyCleared()) { - texts.add(new StyledText("Some rooms are not fully cleared!\n", "warning")); - } else if (scoreCalculation.getTombs() < 5) { - texts.add(new StyledText("Only less than 5 crypts are blown up!\n", "warning")); - } else { - texts.add(new StyledText("\n", "warning")); - } - - texts.add(new StyledText("Total Secrets","field_name")); - texts.add(new StyledText(": ","field_separator")); - texts.add(new StyledText(scoreCalculation.getSecrets() +"/" + scoreCalculation.getEffectiveTotalSecrets()+" of "+scoreCalculation.getTotalSecrets(),"field_value")); - texts.add(new StyledText(" ("+(int)(scoreCalculation.getSecrets() / (float)scoreCalculation.getEffectiveTotalSecrets() * 100.0f)+"% "+(int)Math.ceil(scoreCalculation.getSecrets() / (float)scoreCalculation.getEffectiveTotalSecrets() * 40.0f)+" Explorer)\n","field_etc")); - - - texts.add(new StyledText("Crypts","field_name")); - texts.add(new StyledText(": ","field_separator")); - texts.add(new StyledText(scoreCalculation.getTombs() +"/5\n","field_value")); - - - texts.add(new StyledText("Deaths","field_name")); - texts.add(new StyledText(": ","field_separator")); - texts.add(new StyledText(scoreCalculation.getDeaths() + "\n","field_value")); - - int sum = scoreCalculation.getTime() + scoreCalculation.getExplorer() + scoreCalculation.getSkill() + scoreCalculation.getBonus(); - texts.add(new StyledText("Score Estimate","field_name")); - texts.add(new StyledText(": ","field_separator")); - texts.add(new StyledText(sum+" ","field_value")); - texts.add(new StyledText("("+FeatureRegistry.DUNGEON_SCORE.getLetter(sum)+")\n","field_etc")); - - - texts.add(new StyledText("Skill","field_name")); - texts.add(new StyledText(": ","field_separator")); - texts.add(new StyledText(scoreCalculation.getSkill()+" ","field_value")); - texts.add(new StyledText("("+scoreCalculation.getDeaths()+" Deaths: "+(scoreCalculation.getDeaths() * -2)+" pts)\n","field_etc")); - - texts.add(new StyledText("Explorer","field_name")); - texts.add(new StyledText(": ","field_separator")); - texts.add(new StyledText(scoreCalculation.getExplorer()+" ","field_value")); - texts.add(new StyledText("("+FeatureRegistry.DUNGEON_SCORE.getPercentage()+"% + secrets)\n","field_etc")); - - texts.add(new StyledText("Time","field_name")); - texts.add(new StyledText(": ","field_separator")); - texts.add(new StyledText(scoreCalculation.getTime()+" ","field_value")); - texts.add(new StyledText("("+ TextUtils.formatTime(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed())+")\n","field_etc")); - - texts.add(new StyledText("Bonus","field_name")); - texts.add(new StyledText(": ","field_separator")); - texts.add(new StyledText(scoreCalculation.getBonus()+"\n","field_value")); - - - return texts; - } - - public List<TextStyle> getStyles() { - return this.<List<TextStyle>>getParameter("textStyles").getValue(); - } - private Map<String, TextStyle> stylesMap; - public Map<String, TextStyle> getStylesMap() { - if (stylesMap == null) { - List<TextStyle> styles = getStyles(); - Map<String, TextStyle> res = new HashMap<String, TextStyle>(); - for (TextStyle ts : styles) { - res.put(ts.getGroupName(), ts); - } - stylesMap = res; - } - return stylesMap; - } - - - @Override - public String getEditRoute(RootConfigPanel rootConfigPanel) { - ConfigPanelCreator.map.put("base." + getKey() , new Supplier<MPanel>() { - @Override - public MPanel get() { - MFeatureEdit featureEdit = new MFeatureEdit(FeatureWarningOnPortal.this, rootConfigPanel); - featureEdit.addParameterEdit("textStyles", new PanelTextParameterConfig(FeatureWarningOnPortal.this)); - for (FeatureParameter parameter: getParameters()) { - if (parameter.getKey().equals("textStyles")) continue; - featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(FeatureWarningOnPortal.this, parameter, rootConfigPanel)); - } - return featureEdit; - } - }); - return "base." + getKey() ; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/CorrectThePaneSolutionProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/CorrectThePaneSolutionProvider.java deleted file mode 100644 index a4172158..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/CorrectThePaneSolutionProvider.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; - -import net.minecraft.init.Blocks; -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.Slot; -import net.minecraft.item.EnumDyeColor; -import net.minecraft.item.Item; - -import java.util.ArrayList; -import java.util.List; - -public class CorrectThePaneSolutionProvider implements TerminalSolutionProvider { - @Override - public TerminalSolution provideSolution(ContainerChest chest, List<Slot> clicked) { - TerminalSolution ts = new TerminalSolution(); - ts.setCurrSlots(new ArrayList<Slot>()); - for (Slot inventorySlot : chest.inventorySlots) { - if (inventorySlot.inventory != chest.getLowerChestInventory()) continue; - if (inventorySlot.getHasStack() && inventorySlot.getStack() != null) { - if (inventorySlot.getStack().getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) && - inventorySlot.getStack().getItemDamage() == EnumDyeColor.RED.getMetadata()) { - ts.getCurrSlots().add(inventorySlot); - } - } - } - - - return ts; - } - - @Override - public boolean isApplicable(ContainerChest chest) { - return chest.getLowerChestInventory().getName().equals("Correct all the panes!"); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureSimonSaysSolver.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureSimonSaysSolver.java deleted file mode 100644 index bd90f724..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureSimonSaysSolver.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.InteractListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.roomprocessor.bossfight.BossfightProcessorNecron; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; - -import java.awt.*; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; - -public class FeatureSimonSaysSolver extends SimpleFeature implements WorldRenderListener, TickListener, InteractListener { - public FeatureSimonSaysSolver() { - super("Solver.Floor 7+.Bossfight","Simon Says Solver","Solver for Simon says puzzle", "bossfight.simonsays2"); - } - - private final SkyblockStatus ss = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - private final List<BlockPos> orderbuild = new ArrayList<BlockPos>(); - private final LinkedList<BlockPos> orderclick = new LinkedList<BlockPos>(); - - @Override - public void drawWorld(float partialTicks) { - if (!isEnabled()) return; - DungeonContext dc = ss.getContext(); - if (dc == null) { - return; - } - if (!(dc.getBossfightProcessor() instanceof BossfightProcessorNecron)) return; - if (Minecraft.getMinecraft().thePlayer.getPosition().distanceSq(309,123,291) > 400) return; - - - if (orderclick.size() >= 1) - RenderUtils.highlightBlock(orderclick.get(0), new Color(0, 255 ,255, 100), partialTicks, false); - if (orderclick.size() >= 2) - RenderUtils.highlightBlock(orderclick.get(1), new Color(255, 170, 0, 100), partialTicks, false); - } - private boolean wasButton = false; - @Override - public void onTick() { - DungeonContext dc = ss.getContext(); - if (dc == null) { - wasButton = false; - return; - } - if (!(dc.getBossfightProcessor() instanceof BossfightProcessorNecron)) return; - - World w = dc.getWorld(); - - if (wasButton && w.getBlockState(new BlockPos(309, 123, 291)).getBlock() == Blocks.air) { - orderclick.clear(); - orderbuild.clear(); - wasButton = false; - } else if (!wasButton && w.getBlockState(new BlockPos(309, 123, 291)).getBlock() == Blocks.stone_button){ - orderclick.addAll(orderbuild); - wasButton = true; - } - - - if (!wasButton) { - for (BlockPos allInBox : BlockPos.getAllInBox(new BlockPos(310, 123, 291), new BlockPos(310, 120, 294))) { - if (w.getBlockState(allInBox).getBlock() == Blocks.sea_lantern && !orderbuild.contains(allInBox)) { - orderbuild.add(allInBox); - } - } - } - } - - @Override - public void onInteract(PlayerInteractEvent event) { - if (!isEnabled()) return; - - DungeonContext dc = ss.getContext(); - if (dc == null) return; - if (!(dc.getBossfightProcessor() instanceof BossfightProcessorNecron)) return; - if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) return; - World w = dc.getWorld(); - - BlockPos pos = event.pos.add(1,0,0); - if (120 <= pos.getY() && pos.getY() <= 123 && pos.getX() == 310 && 291 <= pos.getZ() && pos.getZ() <= 294) { - if (w.getBlockState(event.pos).getBlock() != Blocks.stone_button) return; - if (pos.equals(orderclick.peek())) { - orderclick.poll(); - } - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureTerminalSolvers.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureTerminalSolvers.java deleted file mode 100644 index e6e03318..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureTerminalSolvers.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; - -import kr.syeyoung.dungeonsguide.features.listener.*; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.*; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.Slot; -import net.minecraftforge.client.event.GuiOpenEvent; -import net.minecraftforge.client.event.GuiScreenEvent; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; -import org.lwjgl.input.Mouse; - -import java.util.ArrayList; -import java.util.List; - -public class FeatureTerminalSolvers extends SimpleFeature implements GuiOpenListener, TickListener, GuiPostRenderListener, GuiClickListener, TooltipListener { - public FeatureTerminalSolvers() { - super("Solver.Floor 7+.Bossfight","F7 GUI Terminal Solver", "Solve f7 gui terminals. (color, startswith, order, navigate, correct panes)", "bossfight.terminals"); - } - - public static final List<TerminalSolutionProvider> solutionProviders = new ArrayList<TerminalSolutionProvider>(); - - static { - solutionProviders.add(new WhatStartsWithSolutionProvider()); - solutionProviders.add(new SelectAllColorSolutionProivider()); - solutionProviders.add(new SelectInOrderSolutionProvider()); - solutionProviders.add(new NavigateMazeSolutionProvider()); - solutionProviders.add(new CorrectThePaneSolutionProvider()); - } - - private TerminalSolutionProvider solutionProvider; - private TerminalSolution solution; - private final List<Slot> clicked = new ArrayList<Slot>(); - - @Override - public void onGuiOpen(GuiOpenEvent event) { - if (!isEnabled()) return; - solution = null; - solutionProvider = null; - clicked.clear(); - if (event.gui instanceof GuiChest) { - ContainerChest cc = (ContainerChest) ((GuiChest) event.gui).inventorySlots; - for (TerminalSolutionProvider solutionProvider : solutionProviders) { - if (solutionProvider.isApplicable(cc)) { - solution = solutionProvider.provideSolution(cc, clicked); - this.solutionProvider = solutionProvider; - } - } - } - } - - @Override - public void onTick() { - if (!isEnabled()) return; - if (solutionProvider == null) return; - if (!(Minecraft.getMinecraft().currentScreen instanceof GuiChest)) { - solution = null; - solutionProvider = null; - clicked.clear(); - return; - } - ContainerChest cc = (ContainerChest) ((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots; - - solution = solutionProvider.provideSolution(cc, clicked); - } - - @Override - public void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered) { - if (!isEnabled()) return; - if (solutionProvider == null) return; - if (!(Minecraft.getMinecraft().currentScreen instanceof GuiChest)) { - solution = null; - solutionProvider = null; - clicked.clear(); - return; - } - - if (solution != null) { - int i = 222; - int j = i - 108; - int ySize = j + (((ContainerChest)(((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots)).getLowerChestInventory().getSizeInventory() / 9) * 18; - int left = (rendered.gui.width - 176) / 2; - int top = (rendered.gui.height - ySize ) / 2; - GlStateManager.pushMatrix(); - GlStateManager.disableDepth(); - GlStateManager.disableLighting(); - GlStateManager.colorMask(true, true, true, false); - GlStateManager.translate(left, top, 0); - if (solution.getCurrSlots() != null) { - for (Slot currSlot : solution.getCurrSlots()) { - int x = currSlot.xDisplayPosition; - int y = currSlot.yDisplayPosition; - Gui.drawRect(x, y, x + 16, y + 16, 0x7700FFFF); - } - } - if (solution.getNextSlots() != null) { - for (Slot nextSlot : solution.getNextSlots()) { - int x = nextSlot.xDisplayPosition; - int y = nextSlot.yDisplayPosition; - Gui.drawRect(x, y, x + 16, y + 16, 0x77FFFF00); - } - } - GlStateManager.colorMask(true, true, true, true); - GlStateManager.popMatrix(); - } - GlStateManager.enableBlend(); - GlStateManager.enableLighting(); - } - - @Override - public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) { - if (!isEnabled()) return; - if (Mouse.getEventButton() == -1) return; - if (solutionProvider == null) return; - if (solution == null) return; - if (solution.getCurrSlots() == null) { - return; - } - Slot s = ((GuiChest) Minecraft.getMinecraft().currentScreen).getSlotUnderMouse(); - if (solution.getCurrSlots().contains(s)) { - clicked.add(s); - return; - } - } - - @Override - public void onTooltip(ItemTooltipEvent event) { - if (!isEnabled()) return; - if (solutionProvider == null) return; - event.toolTip.clear(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/NavigateMazeSolutionProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/NavigateMazeSolutionProvider.java deleted file mode 100644 index 78a64733..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/NavigateMazeSolutionProvider.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; - -import net.minecraft.init.Blocks; -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.Slot; -import net.minecraft.item.EnumDyeColor; -import net.minecraft.item.Item; - -import java.util.ArrayList; -import java.util.List; - -public class NavigateMazeSolutionProvider implements TerminalSolutionProvider { - @Override - public TerminalSolution provideSolution(ContainerChest chest, List<Slot> clicked) { - TerminalSolution ts = new TerminalSolution(); - ts.setCurrSlots(new ArrayList<Slot>()); - Slot solution = null; - for (Slot inventorySlot : chest.inventorySlots) { - if (inventorySlot.inventory != chest.getLowerChestInventory()) continue; - if (inventorySlot.getHasStack() && inventorySlot.getStack() != null) { - if (inventorySlot.getStack().getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) && - inventorySlot.getStack().getItemDamage() == EnumDyeColor.WHITE.getMetadata()) { - int x = inventorySlot.slotNumber % 9; - int y = inventorySlot.slotNumber / 9; - - if (x > 0) { - Slot toChk = chest.inventorySlots.get(y * 9 + x - 1); - - if (toChk.getHasStack() && toChk.getStack() != null && - toChk.getStack().getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) && - toChk.getStack().getItemDamage() == EnumDyeColor.LIME.getMetadata()) { - solution = inventorySlot; - break; - } - } - if (x < 8) { - Slot toChk = chest.inventorySlots.get(y * 9 + x + 1); - - if (toChk.getHasStack() && toChk.getStack() != null && - toChk.getStack().getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) && - toChk.getStack().getItemDamage() == EnumDyeColor.LIME.getMetadata()) { - solution = inventorySlot; - break; - } - } - if (y > 0) { - Slot toChk = chest.inventorySlots.get((y-1) * 9 + x); - - if (toChk.getHasStack() && toChk.getStack() != null && - toChk.getStack().getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) && - toChk.getStack().getItemDamage() == EnumDyeColor.LIME.getMetadata()) { - solution = inventorySlot; - break; - } - } - if (y < chest.getLowerChestInventory().getSizeInventory() / 9 - 1) { - Slot toChk = chest.inventorySlots.get((y+1) * 9 + x); - - if (toChk.getHasStack() && toChk.getStack() != null && - toChk.getStack().getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) && - toChk.getStack().getItemDamage() == EnumDyeColor.LIME.getMetadata()) { - solution = inventorySlot; - break; - } - } - } - } - } - - if (solution == null) return null; - ts.getCurrSlots().add(solution); - ts.setNextSlots(new ArrayList<Slot>()); - { - int x = solution.slotNumber % 9; - int y = solution.slotNumber / 9; - - if (x > 0) { - Slot toChk = chest.inventorySlots.get(y * 9 + x - 1); - - if (toChk.getHasStack() && toChk.getStack() != null && - toChk.getStack().getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) && - toChk.getStack().getItemDamage() == EnumDyeColor.WHITE.getMetadata()) { - ts.getNextSlots().add(toChk); - return ts; - } - } - if (x < 8) { - Slot toChk = chest.inventorySlots.get(y * 9 + x + 1); - - if (toChk.getHasStack() && toChk.getStack() != null && - toChk.getStack().getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) && - toChk.getStack().getItemDamage() == EnumDyeColor.WHITE.getMetadata()) { - ts.getNextSlots().add(toChk); - return ts; - } - } - if (y > 0) { - Slot toChk = chest.inventorySlots.get((y-1) * 9 + x); - - if (toChk.getHasStack() && toChk.getStack() != null && - toChk.getStack().getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) && - toChk.getStack().getItemDamage() == EnumDyeColor.WHITE.getMetadata()) { - ts.getNextSlots().add(toChk); - return ts; - } - } - if (y < chest.getLowerChestInventory().getSizeInventory() / 9 - 1) { - Slot toChk = chest.inventorySlots.get((y+1) * 9 + x); - - if (toChk.getHasStack() && toChk.getStack() != null && - toChk.getStack().getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) && - toChk.getStack().getItemDamage() == EnumDyeColor.WHITE.getMetadata()) { - ts.getNextSlots().add(toChk); - return ts; - } - } - } - - return ts; - } - - @Override - public boolean isApplicable(ContainerChest chest) { - return chest.getLowerChestInventory().getName().equals("Navigate the maze!"); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/SelectAllColorSolutionProivider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/SelectAllColorSolutionProivider.java deleted file mode 100644 index 36a1834f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/SelectAllColorSolutionProivider.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; - -import net.minecraft.init.Items; -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.Slot; -import net.minecraft.item.EnumDyeColor; - -import java.util.ArrayList; -import java.util.List; - -public class SelectAllColorSolutionProivider implements TerminalSolutionProvider { - @Override - public TerminalSolution provideSolution(ContainerChest chest, List<Slot> clicked) { - TerminalSolution ts = new TerminalSolution(); - ts.setCurrSlots(new ArrayList<Slot>()); - String name = chest.getLowerChestInventory().getName(); - EnumDyeColor edc = null; - for (EnumDyeColor edc2 : EnumDyeColor.values()) { - if (name.contains(edc2.getName().toUpperCase().replace("_"," "))) { - edc = edc2; - break; - } - } - if (edc == null) return null; - - for (Slot inventorySlot : chest.inventorySlots) { - if (inventorySlot.inventory != chest.getLowerChestInventory()) continue; - if (inventorySlot.getHasStack() && inventorySlot.getStack() != null && !inventorySlot.getStack().isItemEnchanted()) { - if (inventorySlot.getStack().getItem() != Items.dye && inventorySlot.getStack().getItemDamage() == edc.getMetadata()) - ts.getCurrSlots().add(inventorySlot); - else if (inventorySlot.getStack().getItem() == Items.dye && inventorySlot.getStack().getItemDamage() == edc.getDyeDamage()) - ts.getCurrSlots().add(inventorySlot); - } - } - return ts; - } - - @Override - public boolean isApplicable(ContainerChest chest) { - return chest.getLowerChestInventory().getName().startsWith("Select all the "); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/SelectInOrderSolutionProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/SelectInOrderSolutionProvider.java deleted file mode 100644 index 7295a899..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/SelectInOrderSolutionProvider.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; - -import net.minecraft.init.Blocks; -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.Slot; -import net.minecraft.item.EnumDyeColor; -import net.minecraft.item.Item; - -import java.util.ArrayList; -import java.util.List; - -public class SelectInOrderSolutionProvider implements TerminalSolutionProvider { - @Override - public TerminalSolution provideSolution(ContainerChest chest, List<Slot> clicked) { - TerminalSolution ts = new TerminalSolution(); - ts.setCurrSlots(new ArrayList<Slot>()); - int lowest = 1000; - Slot slotLowest = null; - for (Slot inventorySlot : chest.inventorySlots) { - if (inventorySlot.inventory != chest.getLowerChestInventory()) continue; - if (inventorySlot.getHasStack() && inventorySlot.getStack() != null && inventorySlot.getStack().getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) - && inventorySlot.getStack().getItemDamage() == EnumDyeColor.RED.getMetadata()) { - if (inventorySlot.getStack().stackSize < lowest) { - lowest = inventorySlot.getStack().stackSize; - slotLowest = inventorySlot; - } - } - } - if (slotLowest != null) - ts.getCurrSlots().add(slotLowest); - - Slot next = null; - for (Slot inventorySlot : chest.inventorySlots) { - if (inventorySlot.inventory != chest.getLowerChestInventory()) continue; - if (inventorySlot.getHasStack() && inventorySlot.getStack() != null && inventorySlot.getStack().getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane) - && inventorySlot.getStack().getItemDamage() == EnumDyeColor.RED.getMetadata()) { - if (inventorySlot.getStack().stackSize == lowest + 1) { - next = inventorySlot; - } - } - } - if (next != null) { - ts.setNextSlots(new ArrayList<Slot>()); - ts.getNextSlots().add(next); - } - - return ts; - } - - @Override - public boolean isApplicable(ContainerChest chest) { - return chest.getLowerChestInventory().getName().equals("Click in order!"); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/TerminalSolution.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/TerminalSolution.java deleted file mode 100644 index a3f3f558..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/TerminalSolution.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; - -import lombok.Data; -import net.minecraft.inventory.Slot; - -import java.util.List; - -@Data -public class TerminalSolution { - private List<Slot> currSlots; - private List<Slot> nextSlots; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/TerminalSolutionProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/TerminalSolutionProvider.java deleted file mode 100644 index b04b5094..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/TerminalSolutionProvider.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; - -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.Slot; - -import java.util.List; - -public interface TerminalSolutionProvider { - TerminalSolution provideSolution(ContainerChest chest, List<Slot> clicked); - boolean isApplicable(ContainerChest chest); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/WhatStartsWithSolutionProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/WhatStartsWithSolutionProvider.java deleted file mode 100644 index dc9828fb..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/WhatStartsWithSolutionProvider.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; - -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.Slot; - -import java.util.ArrayList; -import java.util.List; - -public class WhatStartsWithSolutionProvider implements TerminalSolutionProvider{ - @Override - public TerminalSolution provideSolution(ContainerChest chest, List<Slot> clicked) { - String that = chest.getLowerChestInventory().getName().replace("What starts with: '", "").replace("'?", "").trim().toLowerCase(); - - TerminalSolution ts = new TerminalSolution(); - ts.setCurrSlots(new ArrayList<Slot>()); - for (Slot inventorySlot : chest.inventorySlots) { - if (inventorySlot.inventory != chest.getLowerChestInventory()) continue; - if (inventorySlot.getHasStack() && inventorySlot.getStack() != null && !inventorySlot.getStack().isItemEnchanted() ) { - String name = TextUtils.stripColor(inventorySlot.getStack().getDisplayName()).toLowerCase(); - if (name.startsWith(that)) - ts.getCurrSlots().add(inventorySlot); - } - } - return ts; - } - - @Override - public boolean isApplicable(ContainerChest chest) { - return chest.getLowerChestInventory().getName().startsWith("What starts with: '"); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java deleted file mode 100644 index 89d80ca5..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknameColor.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.cosmetics; - -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -public class FeatureNicknameColor extends SimpleFeature { - public FeatureNicknameColor() { - super("Cosmetics", "Nickname Color", "Click on Edit to choose nickname color cosmetic", "cosmetic.nickname"); - this.parameters.put("dummy", new FeatureParameter("dummy", "dummy", "dummy", "dummy", "string")); - } - - @Override - public String getEditRoute(RootConfigPanel rootConfigPanel) { - ConfigPanelCreator.map.put("base." + getKey() , () -> new PrefixSelectorGUI("color", new String[] { - "§9Party §8> §r§a[RANK§6+§a] %prefix%%name%§f: TEST", - "§2Guild > §r§a[RANK§6+§a] %prefix%%name% §3[Vet]§f: TEST", - "§dTo §r§r§a[RANK§r§6+§r§a] %prefix%%name%§r§7: §r§7TEST§r", - "§dFrom §r§r§a[RANK§r§6+§r§a] %prefix%%name%§r§7: §r§7TEST§r", - "§r§b[RANK§c+§b] %prefix%%name%§f: TEST", - "§r§bCo-op > §r§a[RANK§6+§a] %prefix%%name%§f: §rTEST§r" - }, a -> (a.replace("&", "§")+"Color "+(a.replace("&", "§").equals("§z") ? "(Rainbow on sba)" : "")))); - return "base." + getKey(); - } - - @Override - public boolean isDisyllable() { - return false; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java deleted file mode 100644 index 78a9c1c8..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/FeatureNicknamePrefix.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.cosmetics; - -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -public class FeatureNicknamePrefix extends SimpleFeature { - public FeatureNicknamePrefix() { - super("Cosmetics", "Nickname Prefix", "Click on Edit to choose prefix cosmetic", "cosmetic.prefix"); - this.parameters.put("dummy", new FeatureParameter("dummy", "dummy", "dummy", "dummy", "string")); - } - - @Override - public String getEditRoute(RootConfigPanel rootConfigPanel) { - ConfigPanelCreator.map.put("base." + getKey() , () -> new PrefixSelectorGUI("prefix", new String[] { - "§9Party §8> §r%prefix% §a[RANK§6+§a] %name%§f: TEST", - "§2Guild > §r%prefix% §a[RANK§6+§a] %name% §3[Vet]§f: TEST", - "§dTo §r%prefix% §r§a[RANK§r§6+§r§a] %name%§r§7: §r§7TEST§r", - "§dFrom §r%prefix% §r§a[RANK§r§6+§r§a] %name%§r§7: §r§7TEST§r", - "§r%prefix% §b[RANK§c+§b] %name%§f: TEST", - "§r§bCo-op > §r%prefix% §a[RANK§6+§a] %name%§f: §rTEST§r" - }, a->a.replace("&", "§"))); - return "base." + getKey(); - } - - @Override - public boolean isDisyllable() { - return false; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java deleted file mode 100644 index 4750831e..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/cosmetics/PrefixSelectorGUI.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.cosmetics; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.cosmetics.ActiveCosmetic; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticData; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticsManager; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.awt.*; -import java.util.*; -import java.util.List; -import java.util.function.Function; - -public class PrefixSelectorGUI extends MPanel { - private String cosmeticType; - private Function<String, String> optionTransformer; - - public PrefixSelectorGUI(String cosmeticType, String[] previews, Function<String, String> optionTransformer) { - this.cosmeticType = cosmeticType; - this.previews = previews; - this.optionTransformer = optionTransformer; - CosmeticsManager cosmeticsManager = DungeonsGuide.getDungeonsGuide().getCosmeticsManager(); - List<ActiveCosmetic> activeCosmeticList = cosmeticsManager.getActiveCosmeticByPlayer().computeIfAbsent(Minecraft.getMinecraft().thePlayer.getGameProfile().getId(), (a) -> new ArrayList<>()); - for (ActiveCosmetic activeCosmetic : activeCosmeticList) { - CosmeticData cosmeticData = cosmeticsManager.getCosmeticDataMap().get(activeCosmetic.getCosmeticData()); - if (cosmeticData != null && cosmeticData.getCosmeticType().equals(cosmeticType)) { - selected = cosmeticData; - return; - } - } - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); - } - - private CosmeticData selected; - // §9Party §8> §a[VIP§6+§a] syeyoung§f: ty - // §2Guild > §a[VIP§6+§a] syeyoung §3[Vet]§f - // §dTo §r§a[VIP§r§6+§r§a] SlashSlayer§r§7: §r§7what§r - // §dFrom §r§a[VIP§r§6+§r§a] SlashSlayer§r§7: §r§7?§r - // §7Rock_Bird§7§r§7: SELLING 30 DIAMOD BLOCK /p me§r - // §b[MVP§c+§b] Probutnoobgamer§f: quitting skyblock! highe - // §r§bCo-op > §a[VIP§6+§a] syeyoung§f: §rwhat§r - String[] previews; - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - CosmeticsManager cosmeticsManager = DungeonsGuide.getDungeonsGuide().getCosmeticsManager(); - - List<ActiveCosmetic> activeCosmeticList2 = cosmeticsManager.getActiveCosmeticByPlayer().get(Minecraft.getMinecraft().thePlayer.getGameProfile().getId()); - Set<UUID> activeCosmeticList = new HashSet<>(); - if (activeCosmeticList2 !=null) { - for (ActiveCosmetic activeCosmetic : activeCosmeticList2) { - activeCosmeticList.add(activeCosmetic.getCosmeticData()); - } - } - - - - GlStateManager.translate(0,2,0); - Gui.drawRect(0,0,getBounds().width, getBounds().height-2, 0xFF444444); - Gui.drawRect(5,5,265, getBounds().height-7, 0xFF222222); - Gui.drawRect(6,17,264, getBounds().height-8, 0xFF555555); - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Preview", (270 - fr.getStringWidth("Preview")) / 2, 7, 0xFFFFFFFF); - - { - String prefix = selected != null ? selected.getData() : "[DG]"; - GlStateManager.pushMatrix(); - GlStateManager.translate(6,17,0); - for (int i = 0; i < previews.length; i++) { - fr.drawString(previews[i].replace("%name%", Minecraft.getMinecraft().getSession().getUsername()).replace("%prefix%", prefix.replace("&", "§")), 0, i*fr.FONT_HEIGHT, -1); - } - GlStateManager.popMatrix(); - } - { - GlStateManager.pushMatrix(); - GlStateManager.translate(270,17,0); - int relX = relMousex0 - 270, relY = relMousey0 - 19; - int cnt = 0; - for (CosmeticData value : cosmeticsManager.getCosmeticDataMap().values()) { - if (value.getCosmeticType().equals(cosmeticType)) { - if (!cosmeticsManager.getPerms().contains(value.getReqPerm()) && value.getReqPerm().startsWith("invis_")) continue; - Gui.drawRect(0,0,220, fr.FONT_HEIGHT+3, 0xFF222222); - Gui.drawRect(1,1, 219, fr.FONT_HEIGHT+2, 0xFF555555); - Gui.drawRect(120,1,160, fr.FONT_HEIGHT+2, new Rectangle(120,cnt * (fr.FONT_HEIGHT+4) + 2,40,fr.FONT_HEIGHT+1).contains(relX, relY) ? 0xFF859DF0 : 0xFF7289da); - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString(optionTransformer.apply(value.getData()), 2, 2, -1); - fr.drawString("TEST", (280-fr.getStringWidth("TEST"))/2, 2, -1); - - if (cosmeticsManager.getPerms().contains(value.getReqPerm())) { - Gui.drawRect(161,1,219, fr.FONT_HEIGHT+2, new Rectangle(161,cnt * (fr.FONT_HEIGHT+4) + 2,58,fr.FONT_HEIGHT+1).contains(relX, relY) ? 0xFF859DF0 : 0xFF7289da); - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - if (activeCosmeticList.contains(value.getId())) { - fr.drawString("UNSELECT", (381 - fr.getStringWidth("UNSELECT")) / 2, 2, -1); - } else { - fr.drawString("SELECT", (381 - fr.getStringWidth("SELECT")) / 2, 2, -1); - } - } else { - Gui.drawRect(161,1,219, fr.FONT_HEIGHT+2, 0xFFFF3333); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Locked", (381 - fr.getStringWidth("Locked")) / 2, 2, -1); - } - GlStateManager.translate(0,fr.FONT_HEIGHT+4, 0); - - cnt++; - } - } - GlStateManager.popMatrix(); - } - } - - @Override - public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - CosmeticsManager cosmeticsManager = DungeonsGuide.getDungeonsGuide().getCosmeticsManager(); - - int relX = relMouseX - 270, relY = relMouseY - 19; - int cnt = 0; - - List<ActiveCosmetic> activeCosmeticList = cosmeticsManager.getActiveCosmeticByPlayer().computeIfAbsent(Minecraft.getMinecraft().thePlayer.getGameProfile().getId(), (a) -> new ArrayList<>()); - - for (CosmeticData value : cosmeticsManager.getCosmeticDataMap().values()) { - if (value.getCosmeticType().equals(cosmeticType)) { - if (!cosmeticsManager.getPerms().contains(value.getReqPerm()) && value.getReqPerm().startsWith("invis_")) continue; - if (new Rectangle(120,cnt * (fr.FONT_HEIGHT+4) + 2,40,fr.FONT_HEIGHT+1).contains(relX, relY)) { - selected = value; - return; - } - try { - if (new Rectangle(161, cnt * (fr.FONT_HEIGHT + 4) + 2, 58, fr.FONT_HEIGHT + 1).contains(relX, relY) && cosmeticsManager.getPerms().contains(value.getReqPerm())) { - for (ActiveCosmetic activeCosmetic : activeCosmeticList) { - if (activeCosmetic.getCosmeticData().equals(value.getId())) { - cosmeticsManager.removeCosmetic(activeCosmetic); - return; - } - } - cosmeticsManager.setCosmetic(value); - selected = value; - } - } catch (Exception e) { - e.printStackTrace(); - } - - cnt++; - } - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/ImageTexture.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/ImageTexture.java deleted file mode 100644 index 730fe355..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/ImageTexture.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.discord.inviteViewer; - - -import lombok.Data; -import lombok.Getter; -import lombok.Setter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.texture.DynamicTexture; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.ResourceLocation; - -import javax.imageio.ImageIO; -import javax.imageio.ImageReader; -import javax.imageio.stream.ImageInputStream; -import java.awt.*; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.Iterator; - -@Data -public class ImageTexture { - private String url; - private BufferedImage image; - private DynamicTexture previewTexture; - private ResourceLocation resourceLocation; - - private int width; - private int height; - private int frames; - private int size; - - @Getter @Setter - private int lastFrame = 0; - - public void buildGLThings() { - previewTexture = new DynamicTexture(image); - resourceLocation = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("dgurl/"+url, previewTexture); - } - - public ImageTexture(String url) throws IOException { - this.url = url; - - URL urlObj = new URL(url); - HttpURLConnection huc = (HttpURLConnection) urlObj.openConnection(); - huc.addRequestProperty("User-Agent", "DungeonsGuideMod (dungeons.guide, 1.0)"); - ImageInputStream imageInputStream = ImageIO.createImageInputStream(huc.getInputStream()); - Iterator<ImageReader> readers = ImageIO.getImageReaders(imageInputStream); - if(!readers.hasNext()) throw new IOException("No image reader what" + url); - ImageReader reader = readers.next(); - reader.setInput(imageInputStream); - frames = reader.getNumImages(true); - BufferedImage dummyFrame = reader.read(0); - width = dummyFrame.getWidth(); height = dummyFrame.getHeight(); - - - image = new BufferedImage(width, height * frames, dummyFrame.getType()); - Graphics2D graphics2D = image.createGraphics(); - - for (int i = 0; i < frames; i++) { - BufferedImage bufferedImage = reader.read(i); - graphics2D.drawImage(bufferedImage, 0, i*height, null); - } - reader.dispose(); imageInputStream.close(); huc.disconnect(); - } - - public void drawFrame(int frame, int x, int y, int width, int height) { - if (getResourceLocation() == null) - buildGLThings(); - - TextureManager textureManager = Minecraft.getMinecraft().getTextureManager(); - textureManager.bindTexture(getResourceLocation()); - - GlStateManager.color(1, 1, 1, 1.0F); - - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); - worldrenderer.pos((double)x, (double)(y + height), 0.0D) - .tex(0,((frame+1) * height)/ ((double)frames * height)).endVertex(); - worldrenderer.pos((double)(x + width), (double)(y + height), 0.0D) - .tex(1, ((frame+1) * height)/ ((double)frames * height)).endVertex(); - worldrenderer.pos((double)(x + width), (double)y, 0.0D) - .tex(1,(frame * height)/ ((double)frames * height)).endVertex(); - worldrenderer.pos((double)x, (double)y, 0.0D) - .tex(0, (frame * height) / ((double)frames * height)).endVertex(); - tessellator.draw(); - } - - public void drawFrameAndIncrement(int x, int y, int width, int height) { - drawFrame(lastFrame, x,y,width,height); - lastFrame++; - if (lastFrame >= frames) lastFrame = 0; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/PartyInviteViewer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/PartyInviteViewer.java deleted file mode 100644 index ad40a91c..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/PartyInviteViewer.java +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.discord.inviteViewer; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.listener.*; -import kr.syeyoung.dungeonsguide.events.DiscordUserJoinRequestEvent; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.*; -import kr.syeyoung.dungeonsguide.rpc.RichPresenceManager; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordActivityJoinRequestReply; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraftforge.client.event.GuiScreenEvent; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.util.*; -import java.util.List; -import java.util.concurrent.*; - -public class PartyInviteViewer extends SimpleFeature implements GuiPostRenderListener, ScreenRenderListener, TickListener, GuiClickListener, DiscordUserJoinRequestListener { - public PartyInviteViewer() { - super("Discord", "Party Invite Viewer","Simply type /dg asktojoin or /dg atj to toggle whether ask-to-join would be presented as option on discord!\n\nRequires Discord RPC to be enabled", "discord.party_invite_viewer"); - } - - @Override - public boolean isDisyllable() { - return false; - } - - @Override - public void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered) { - renderRequests(true); - } - - @Override - public void drawScreen(float partialTicks) { - if (!isEnabled()) return; - try { - renderRequests(false); - } catch (Throwable t) { - t.printStackTrace(); - } - } - @Override - public void onTick() { - try { - List<PartyJoinRequest> partyJoinRequestList = new ArrayList<>(); - boolean isOnHypixel = DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnHypixel(); - for (PartyJoinRequest joinRequest:joinRequests) { - if (joinRequest.getTtl() != -1) { - joinRequest.setTtl(joinRequest.getTtl() - 1); - if (joinRequest.getTtl() == 0 || !isOnHypixel) { - partyJoinRequestList.add(joinRequest); - } - } else if (!isOnHypixel){ -// DiscordRPC.discordRespond(joinRequest.getDiscordUser().userId, DiscordRPC.DiscordReply.NO); - partyJoinRequestList.add(joinRequest); - } else if (joinRequest.getExpire() < System.currentTimeMillis()) { - partyJoinRequestList.add(joinRequest); - } - } - joinRequests.removeAll(partyJoinRequestList); - } catch (Throwable e) {e.printStackTrace();} - } - - - @Override - public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) { - if (!isEnabled()) return; - int mouseX = Mouse.getX(); - int mouseY = Minecraft.getMinecraft().displayHeight - Mouse.getY() +3; - for (PartyJoinRequest joinRequest:joinRequests) { - if (joinRequest.getWholeRect() != null && joinRequest.getWholeRect().contains(mouseX, mouseY)) { - mouseInputEvent.setCanceled(true); - - if (Mouse.getEventButton() == -1) return; - - if (joinRequest.getReply() != null) { - joinRequests.remove(joinRequest); - return; - } - - if (!joinRequest.isInvite()) { - if (joinRequest.getAcceptRect().contains(mouseX, mouseY)) { - joinRequest.setReply(PartyJoinRequest.Reply.ACCEPT); - joinRequest.setTtl(60); - RichPresenceManager.INSTANCE.respond(joinRequest.getDiscordUser().id, EDiscordActivityJoinRequestReply.DiscordActivityJoinRequestReply_Yes); - return; - } - - if (joinRequest.getDenyRect().contains(mouseX, mouseY)) { - joinRequest.setReply(PartyJoinRequest.Reply.DENY); - joinRequest.setTtl(60); - RichPresenceManager.INSTANCE.respond(joinRequest.getDiscordUser().id, EDiscordActivityJoinRequestReply.DiscordActivityJoinRequestReply_No); - return; - } - - if (joinRequest.getIgnoreRect().contains(mouseX, mouseY)) { - joinRequest.setReply(PartyJoinRequest.Reply.IGNORE); - joinRequest.setTtl(60); - RichPresenceManager.INSTANCE.respond(joinRequest.getDiscordUser().id, EDiscordActivityJoinRequestReply.DiscordActivityJoinRequestReply_Ignore); - return; - } - } else { - if (joinRequest.getAcceptRect().contains(mouseX, mouseY)) { - joinRequest.setReply(PartyJoinRequest.Reply.ACCEPT); - joinRequest.setTtl(60); - RichPresenceManager.INSTANCE.accept(joinRequest.getDiscordUser().id); - return; - } - - if (joinRequest.getDenyRect().contains(mouseX, mouseY)) { - joinRequest.setReply(PartyJoinRequest.Reply.DENY); - joinRequest.setTtl(60); - return; - } - } - - return; - } - } - } - - - - public CopyOnWriteArrayList<PartyJoinRequest> joinRequests = new CopyOnWriteArrayList<>(); - - ExecutorService executorService = Executors.newFixedThreadPool(3); - public Map<String, Future<ImageTexture>> futureMap = new HashMap<>(); - public Map<String, ImageTexture> imageMap = new HashMap<>(); - - public Future<ImageTexture> loadImage(String url) { - if (imageMap.containsKey(url)) return CompletableFuture.completedFuture(imageMap.get(url)); - if (futureMap.containsKey(url)) return futureMap.get(url); - Future<ImageTexture> future = executorService.submit(() -> { - try { - ImageTexture imageTexture = new ImageTexture(url); - imageMap.put(url, imageTexture); - return imageTexture; - } catch (Exception e) { - throw e; - } - }); - futureMap.put(url,future); - return future; - } - - - public void renderRequests(boolean hover) { - try { - GlStateManager.pushMatrix(); - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - GlStateManager.scale(1.0 / sr.getScaleFactor(), 1.0 / sr.getScaleFactor(), 1.0); - int height = 90; - int gap = 5; - int x = 5; - int y = 5; - for (PartyJoinRequest partyJoinRequest : joinRequests) { - renderRequest(partyJoinRequest, x, y, 350,height, hover); - y += height + gap; - } - GlStateManager.popMatrix(); - GlStateManager.enableBlend(); - } catch (Throwable t) { - t.printStackTrace(); - } - } - - - public void renderRequest(PartyJoinRequest partyJoinRequest, int x, int y, int width, int height, boolean hover) { - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - - int mouseX = Mouse.getX(); - int mouseY = Minecraft.getMinecraft().displayHeight - Mouse.getY() +3; - - partyJoinRequest.getWholeRect().setBounds(x,y,width,height); - - - GlStateManager.pushMatrix(); - GlStateManager.translate(x,y,0); - - Gui.drawRect(0, 0,width,height, 0xFF23272a); - Gui.drawRect(2, 2, width-2, height-2, 0XFF2c2f33); - { - String avatar = "https://cdn.discordapp.com/avatars/"+Long.toUnsignedString(partyJoinRequest.getDiscordUser().id.longValue())+"/"+partyJoinRequest.getAvatar()+"."+(partyJoinRequest.getAvatar().startsWith("a_") ? "gif":"png"); - Future<ImageTexture> loadedImageFuture = loadImage(avatar); - ImageTexture loadedImage = null; - if (loadedImageFuture.isDone()) { - try { - loadedImage = loadedImageFuture.get(); - } catch (InterruptedException | ExecutionException e) { - e.printStackTrace(); - } - } - if (loadedImage != null) { - loadedImage.drawFrameAndIncrement( 7,7,height-14,height-14); - } else { - Gui.drawRect(7, 7, height - 7, height-7, 0xFF4E4E4E); - } - } - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - GlStateManager.pushMatrix(); - GlStateManager.translate(height +3,7, 0); - - GlStateManager.pushMatrix(); - GlStateManager.scale(3.0,3.0,1.0); - fr.drawString(partyJoinRequest.getUsername()+"", 0,0, 0xFFFFFFFF, true); - GlStateManager.popMatrix(); - - GlStateManager.pushMatrix(); - GlStateManager.translate(fr.getStringWidth(partyJoinRequest.getUsername()+"") * 3 + 1, (int)(fr.FONT_HEIGHT*1.5), 0); - fr.drawString("#"+partyJoinRequest.getDiscriminator(), 0,0,0xFFaaaaaa, true); - GlStateManager.popMatrix(); - GlStateManager.pushMatrix(); - GlStateManager.translate(0, fr.FONT_HEIGHT * 3 + 5, 0); - GlStateManager.scale(1.0,1.0,1.0); - if (partyJoinRequest.isInvite()) - fr.drawString("§ewants to you to join their party! ("+(TextUtils.formatTime(partyJoinRequest.getExpire() - System.currentTimeMillis()))+")", 0,0,0xFFFFFFFF,false); - else - fr.drawString("wants to join your party! ("+(TextUtils.formatTime(partyJoinRequest.getExpire() - System.currentTimeMillis()))+")", 0,0,0xFFFFFFFF,false); - GlStateManager.popMatrix(); - GlStateManager.popMatrix(); - if (partyJoinRequest.getReply() == null) { - GlStateManager.pushMatrix(); - GlStateManager.translate(height + 3, height - 32, 0); - int widthForTheThing = (width - height) / 3; - GlStateManager.pushMatrix(); - String text = "Accept"; - partyJoinRequest.getAcceptRect().setBounds(x + height + 3, y + height - 25, widthForTheThing - 10, 25); - Gui.drawRect(0, 0, widthForTheThing - 10, 25, hover && partyJoinRequest.getAcceptRect().contains(mouseX, mouseY) ? 0xFF859DF0 : 0xFF7289da); - GlStateManager.translate((widthForTheThing - 10 - fr.getStringWidth(text) * 2) / 2, 15 - fr.FONT_HEIGHT, 0); - - GlStateManager.scale(2.0f, 2.0f, 1.0f); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString(text, 0, 0, 0xFFFFFFFF); - GlStateManager.popMatrix(); - GlStateManager.translate(widthForTheThing, 0, 0); - partyJoinRequest.getDenyRect().setBounds(x + height + 3 + widthForTheThing, y + height - 25, widthForTheThing - 10, 25); - Gui.drawRect(0, 0, widthForTheThing - 10, 25, hover && partyJoinRequest.getDenyRect().contains(mouseX, mouseY) ? 0xFFAEC0CB : 0xFF99aab5); - GlStateManager.pushMatrix(); - text = "Deny"; - GlStateManager.translate((widthForTheThing - 10 - fr.getStringWidth(text) * 2) / 2, 15 - fr.FONT_HEIGHT, 0); - GlStateManager.scale(2.0f, 2.0f, 1.0f); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString(text, 0, 0, 0xFFFFFFFF); - GlStateManager.popMatrix(); - if (!partyJoinRequest.isInvite()) { - GlStateManager.translate(widthForTheThing, 0, 0); - partyJoinRequest.getIgnoreRect().setBounds(x + height + 3 + widthForTheThing + widthForTheThing, y + height - 25, widthForTheThing - 10, 25); - Gui.drawRect(0, 0, widthForTheThing - 10, 25, hover && partyJoinRequest.getIgnoreRect().contains(mouseX, mouseY) ? 0xFFAEC0CB : 0xFF99aab5); // AEC0CB - - GlStateManager.pushMatrix(); - text = "Ignore"; - GlStateManager.translate((widthForTheThing - 10 - fr.getStringWidth(text) * 2) / 2, 15 - fr.FONT_HEIGHT, 0); - GlStateManager.scale(2.0f, 2.0f, 1.0f); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString(text, 0, 0, 0xFFFFFFFF); - GlStateManager.popMatrix(); - } - GlStateManager.popMatrix(); - } else { - GlStateManager.pushMatrix(); - GlStateManager.translate(height + 3, height - 28, 0); - GlStateManager.scale(2.0f,2.0f,1.0f); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString(partyJoinRequest.getReply().getPast()+" the invite.",0,0,0xFFFFFFFF); - GlStateManager.popMatrix(); - } - GlStateManager.popMatrix(); - } - - @Override - public void onDiscordUserJoinRequest(DiscordUserJoinRequestEvent event) { - PartyJoinRequest partyInvite = new PartyJoinRequest(); - partyInvite.setDiscordUser(event.getDiscordUser()); - partyInvite.setExpire(System.currentTimeMillis() + 30000L); - partyInvite.setInvite(event.isInvite()); - joinRequests.add(partyInvite); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/PartyJoinRequest.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/PartyJoinRequest.java deleted file mode 100644 index de025698..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/inviteViewer/PartyJoinRequest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.discord.inviteViewer; - -import kr.syeyoung.dungeonsguide.gamesdk.GameSDK; -import kr.syeyoung.dungeonsguide.gamesdk.jna.datastruct.DiscordUser; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.Getter; - -import java.awt.*; - -@Data -public class PartyJoinRequest { - private DiscordUser discordUser; - - public void setDiscordUser(DiscordUser discordUser) { - this.discordUser = discordUser; - username = GameSDK.readString(discordUser.username); - discriminator = GameSDK.readString(discordUser.discriminator); - avatar = GameSDK.readString(discordUser.avatar); - } - - private String username, discriminator, avatar; - private long expire; - - private Rectangle wholeRect = new Rectangle(); - private Rectangle acceptRect = new Rectangle(); - private Rectangle denyRect = new Rectangle(); - private Rectangle ignoreRect = new Rectangle(); - - private boolean isInvite; - private int ttl = -1; - private Reply reply; - - @AllArgsConstructor - public enum Reply { - ACCEPT("Accepted"), DENY("Denied"), IGNORE("Ignored"); - - @Getter - private final String past; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInvite.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInvite.java deleted file mode 100644 index fdeda8d3..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInvite.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.discord.invteTooltip; - -import com.sun.jna.Pointer; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordActivityActionType; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordRelationshipType; -import kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct.IDiscordActivityManager; -import kr.syeyoung.dungeonsguide.gamesdk.jna.interfacestruct.IDiscordCore; -import kr.syeyoung.dungeonsguide.gamesdk.jna.typedef.DiscordSnowflake; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.rpc.JDiscordRelation; -import kr.syeyoung.dungeonsguide.rpc.RichPresenceManager; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.renderer.GlStateManager; - -import java.awt.*; -import java.util.HashSet; -import java.util.Set; - -public class MTooltipInvite extends MModal { - private MScrollablePanel mScrollablePanel; - private MList list; - private MTextField search; - private MButton close; - private Set<Long> invited = new HashSet<>(); - public MTooltipInvite() { - setTitle("Invite Discord Friend"); - mScrollablePanel = new MScrollablePanel(1); - mScrollablePanel.setHideScrollBarWhenNotNecessary(true); - add(mScrollablePanel); - - list = new MList() { - @Override - public void resize(int parentWidth, int parentHeight) { - setSize(new Dimension(parentWidth, 9999)); - realignChildren(); - } - }; - list.setGap(1); - list.setDrawLine(true); - list.setGapLineColor(RenderUtils.blendAlpha(0x141414, 0.13f)); - mScrollablePanel.add(list); - mScrollablePanel.getScrollBarY().setWidth(5); - - search = new MTextField() { - @Override - public void edit(String str) { - super.edit(str); resetListContent(); - } - }; - search.setPlaceHolder("Search..."); - add(search); - - close = new MButton(); - close.setText("X"); - close.setBackground( RenderUtils.blendAlpha(0x141414, 0.20f)); - close.setHover( RenderUtils.blendAlpha(0x141414, 0.25f)); - close.setClicked( RenderUtils.blendAlpha(0x141414, 0.24f)); - close.setOnActionPerformed(this::close); - addSuper(close); - resetListContent(); - } - - @Override - public void onBoundsUpdate() { - super.onBoundsUpdate(); - Dimension effDim = getModalContent().getSize(); - search.setBounds(new Rectangle(5,2,effDim.width-10, 15)); - mScrollablePanel.setBounds(new Rectangle(10,18,effDim.width-20, effDim.height-25)); - close.setBounds(new Rectangle(getModalContent().getBounds().x + effDim.width-15,getModalContent().getBounds().y - 16,15,15)); - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - GlStateManager.pushMatrix(); - super.render(absMousex, absMousey, relMousex0, relMousey0, partialTicks, scissor); - GlStateManager.popMatrix(); - - Dimension modalSize = getModalSize(); - Dimension effDim = getEffectiveDimension(); - int x = (effDim.width-modalSize.width)/2; - int y = (effDim.height - modalSize.height)/2; - GlStateManager.translate(x,y, 0); - } - - private void resetListContent() { - for (MPanel childComponent : list.getChildComponents()) { - list.remove(childComponent); - } - - String searchTxt = search.getText().trim().toLowerCase(); - for (JDiscordRelation value : RichPresenceManager.INSTANCE.getRelationMap().values()) { -// if (value.getDiscordActivity().getApplicationId() != 816298079732498473L) continue; - if (value.getDiscordRelationshipType() == EDiscordRelationshipType.DiscordRelationshipType_Blocked) continue; - if (!searchTxt.isEmpty() && !(value.getDiscordUser().getUsername().toLowerCase().contains(searchTxt))) continue; - list.add(new MTooltipInviteElement(value, invited.contains(value.getDiscordUser().getId()), this::invite)); - } - setBounds(getBounds()); - } - - public void invite(long id) { - invited.add(id); - IDiscordCore iDiscordCore = RichPresenceManager.INSTANCE.getIDiscordCore(); - IDiscordActivityManager iDiscordActivityManager = iDiscordCore.GetActivityManager.getActivityManager(iDiscordCore); - iDiscordActivityManager.SendInvite.sendInvite(iDiscordActivityManager, new DiscordSnowflake(id), EDiscordActivityActionType.DiscordActivityActionType_Join, "Dungeons Guide RPC Invite TESt", Pointer.NULL, (callbackData, result) -> { - System.out.println("Discord returned "+result+" For inviting "+id); - }); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInviteElement.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInviteElement.java deleted file mode 100644 index 9a7cad07..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/invteTooltip/MTooltipInviteElement.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.discord.invteTooltip; - -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.impl.discord.inviteViewer.ImageTexture; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.rpc.JDiscordRelation; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; - -import java.awt.*; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.function.Consumer; - -public class MTooltipInviteElement extends MPanel { - private JDiscordRelation relation; - private MButton invite; - public MTooltipInviteElement(JDiscordRelation jDiscordRelation, boolean invited, Consumer<Long> inviteCallback) { - this.relation = jDiscordRelation; - this.invite = new MButton(); - if (!invited) { - invite.setText("Invite"); - invite.setRoundness(2); - invite.setBorder(0xFF02EE67); - invite.setHover(RenderUtils.blendAlpha(0x141414, 0.2f)); - invite.setBackground(RenderUtils.blendAlpha(0x141414, 0.17f)); - invite.setForeground(new Color(0xFF02EE67)); - - invite.setOnActionPerformed(() -> { - if (invite.isEnabled()) - inviteCallback.accept(jDiscordRelation.getDiscordUser().getId()); - - invite.setText("Sent"); - invite.setRoundness(2); - invite.setHover(0); invite.setBorder(0); - invite.setBackground(0); invite.setDisabled(0); invite.setEnabled(false); - invite.setForeground(new Color(0xFF02EE67)); - }); - } else { - invite.setText("Sent"); - invite.setRoundness(2); - invite.setHover(0); - invite.setBackground(0); invite.setDisabled(0); invite.setEnabled(false); - invite.setForeground(new Color(0xFF02EE67)); - } - - add(invite); - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - if (lastAbsClip.contains(absMousex, absMousey) && getTooltipsOpen() == 0) { - RenderUtils.drawRoundedRectangle(0,0,bounds.width, bounds.height, 3, Math.PI/8, RenderUtils.blendAlpha(0x141414, 0.17f)); - GlStateManager.enableTexture2D(); - } - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - if (!relation.getDiscordUser().getAvatar().isEmpty()){ - String avatar = "https://cdn.discordapp.com/avatars/"+Long.toUnsignedString(relation.getDiscordUser().getId())+"/"+relation.getDiscordUser().getAvatar()+"."+(relation.getDiscordUser().getAvatar().startsWith("a_") ? "gif":"png"); - Future<ImageTexture> loadedImageFuture = FeatureRegistry.DISCORD_ASKTOJOIN.loadImage(avatar); - ImageTexture loadedImage = null; - if (loadedImageFuture.isDone()) { - try { - loadedImage = loadedImageFuture.get(); - } catch (InterruptedException | ExecutionException e) { - e.printStackTrace(); - } - } - if (loadedImage != null) { - loadedImage.drawFrameAndIncrement( 3,3,bounds.height-6,bounds.height-6); - } else { - Gui.drawRect(3, 3, bounds.height - 6, bounds.height-6, 0xFF4E4E4E); - } - } - fr.drawString(relation.getDiscordUser().getUsername()+"#"+relation.getDiscordUser().getDiscriminator(), bounds.height,(bounds.height-fr.FONT_HEIGHT)/2, -1); - } - - @Override - public Dimension getPreferredSize() { - return new Dimension(100, 20); - } - - @Override - public void onBoundsUpdate() { - invite.setBounds(new Rectangle(bounds.width-53,2,50,bounds.height-4)); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/onlinealarm/PlayingDGAlarm.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/onlinealarm/PlayingDGAlarm.java deleted file mode 100644 index c475ce36..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/discord/onlinealarm/PlayingDGAlarm.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.discord.onlinealarm; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.listener.DiscordUserUpdateListener; -import kr.syeyoung.dungeonsguide.features.listener.ScreenRenderListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.events.DiscordUserUpdateEvent; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.impl.discord.inviteViewer.ImageTexture; -import kr.syeyoung.dungeonsguide.gamesdk.jna.enumuration.EDiscordRelationshipType; -import kr.syeyoung.dungeonsguide.rpc.JDiscordActivity; -import kr.syeyoung.dungeonsguide.rpc.JDiscordRelation; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import lombok.AllArgsConstructor; -import lombok.Data; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; - -public class PlayingDGAlarm extends SimpleFeature implements DiscordUserUpdateListener, ScreenRenderListener, TickListener { - public PlayingDGAlarm() { - super("Discord", "Friend Online Notification","Notifies you in bottom when your discord friend has launched a Minecraft with DG!\n\nRequires the Friend's Discord RPC to be enabled", "discord.playingalarm"); - } - private List<PlayerOnline> notif = new CopyOnWriteArrayList<>(); - - @Override - public void onTick() { - try { - List<PlayerOnline> partyJoinRequestList = new ArrayList<>(); - boolean isOnHypixel = DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnHypixel(); - for (PlayerOnline joinRequest:notif) { - if (!isOnHypixel){ - partyJoinRequestList.add(joinRequest); - } else if (joinRequest.getEnd() < System.currentTimeMillis()) { - partyJoinRequestList.add(joinRequest); - } - } - notif.removeAll(partyJoinRequestList); - } catch (Throwable e) {e.printStackTrace();} - } - - - - @Override - public void drawScreen(float partialTicks) { - if (!isEnabled()) return; - try { - GlStateManager.pushMatrix(); - GlStateManager.translate(0,0,100); - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - GlStateManager.scale(1.0 / sr.getScaleFactor(), 1.0 / sr.getScaleFactor(), 1.0); - int height = 90; - int gap = 5; - int x = Minecraft.getMinecraft().displayWidth-350-gap; - int y = Minecraft.getMinecraft().displayHeight-(height+gap)*notif.size(); - for (PlayerOnline partyJoinRequest : notif) { - renderRequest(partyJoinRequest, x, y, 350,height); - y += height + gap; - } - GlStateManager.popMatrix(); - GlStateManager.enableBlend(); - } catch (Throwable t) { - t.printStackTrace(); - } - } - - public void renderRequest(PlayerOnline online, int x, int y, int width, int height) { - GlStateManager.pushMatrix(); - GlStateManager.translate(x,y,0); - - Gui.drawRect(0, 0,width,height, 0xFF23272a); - Gui.drawRect(2, 2, width-2, height-2, 0XFF2c2f33); - { - String avatar = "https://cdn.discordapp.com/avatars/"+Long.toUnsignedString(online.getJDiscordRelation().getDiscordUser().getId())+"/"+online.getJDiscordRelation().getDiscordUser().getAvatar()+"."+(online.getJDiscordRelation().getDiscordUser().getAvatar().startsWith("a_") ? "gif":"png"); - Future<ImageTexture> loadedImageFuture = FeatureRegistry.DISCORD_ASKTOJOIN.loadImage(avatar); - ImageTexture loadedImage = null; - if (loadedImageFuture.isDone()) { - try { - loadedImage = loadedImageFuture.get(); - } catch (InterruptedException | ExecutionException e) { - e.printStackTrace(); - } - } - if (loadedImage != null) { - loadedImage.drawFrameAndIncrement( 7,7,height-14,height-14); - } else { - Gui.drawRect(7, 7, height - 7, height-7, 0xFF4E4E4E); - } - } - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - GlStateManager.pushMatrix(); - GlStateManager.translate(height +3,7, 0); - - GlStateManager.pushMatrix(); - GlStateManager.scale(3.0,3.0,1.0); - fr.drawString(online.getJDiscordRelation().getDiscordUser().getUsername()+"", 0,0, 0xFFFFFFFF, true); - GlStateManager.popMatrix(); - - GlStateManager.pushMatrix(); - GlStateManager.translate(fr.getStringWidth(online.getJDiscordRelation().getDiscordUser().getUsername()+"") * 3 + 1, (int)(fr.FONT_HEIGHT*1.5), 0); - fr.drawString("#"+online.getJDiscordRelation().getDiscordUser().getDiscriminator(), 0,0,0xFFaaaaaa, true); - GlStateManager.popMatrix(); - GlStateManager.pushMatrix(); - GlStateManager.translate(0, fr.FONT_HEIGHT * 3 + 5, 0); - GlStateManager.scale(1.0,1.0,1.0); - fr.drawString("Started Playing Skyblock! (Dismissed in "+(TextUtils.formatTime(online.getEnd() - System.currentTimeMillis()))+")", 0,0,0xFFFFFFFF,false); - GlStateManager.popMatrix(); - GlStateManager.popMatrix(); - GlStateManager.popMatrix(); - } - - - @Data @AllArgsConstructor - public static class PlayerOnline { - private JDiscordRelation jDiscordRelation; - private long end; - } - - @Override - public void onDiscordUserUpdate(DiscordUserUpdateEvent event) { - JDiscordRelation prev = event.getPrev(), current = event.getCurrent(); - if (!isDisplayable(prev) && isDisplayable(current)) { - notif.add(new PlayerOnline(current, System.currentTimeMillis()+3000)); - } - } - - public boolean isDisplayable(JDiscordRelation jDiscordRelation) { - EDiscordRelationshipType relationshipType = jDiscordRelation.getDiscordRelationshipType(); - if (relationshipType == EDiscordRelationshipType.DiscordRelationshipType_Blocked) return false; - if (relationshipType == EDiscordRelationshipType.DiscordRelationshipType_None) return false; - if (relationshipType == EDiscordRelationshipType.DiscordRelationshipType_PendingIncoming) return false; - if (relationshipType == EDiscordRelationshipType.DiscordRelationshipType_PendingOutgoing) return false; - - JDiscordActivity jDiscordActivity = jDiscordRelation.getDiscordActivity(); - return jDiscordActivity.getApplicationId() == 816298079732498473L; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxBats.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxBats.java deleted file mode 100644 index c8ed9cd3..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxBats.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import com.google.common.base.Predicate; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.passive.EntityBat; -import net.minecraft.util.BlockPos; -import org.jetbrains.annotations.Nullable; - -import java.util.List; - - -public class FeatureBoxBats extends SimpleFeature implements WorldRenderListener { - public FeatureBoxBats() { - super("Dungeon.Mobs", "Box Bats", "Box bats in dungeons\nDoes not appear through walls", "dungeon.batbox", true); - parameters.put("radius", new FeatureParameter<Integer>("radius", "Highlight Radius", "The maximum distance between player and bats to be boxed", 20, "integer")); - parameters.put("color", new FeatureParameter<AColor>("color", "Highlight Color", "Highlight Color of Bats", new AColor(255,0,0,50), "acolor")); - } - - - private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawWorld(float partialTicks) { - if (!isEnabled()) return; - if (!skyblockStatus.isOnDungeon()) return; - - final BlockPos player = Minecraft.getMinecraft().thePlayer.getPosition(); - int val = this.<Integer>getParameter("radius").getValue(); - final int sq = val * val; - - List<EntityBat> skeletonList = Minecraft.getMinecraft().theWorld.getEntities(EntityBat.class, new Predicate<EntityBat>() { - @Override - public boolean apply(@Nullable EntityBat input) { - if (input != null && input.isInvisible()) return false; - return input != null && input.getDistanceSq(player) < sq; - } - }); - AColor c = this.<AColor>getParameter("color").getValue(); - for (EntityBat entitySkeleton : skeletonList) { - if (!entitySkeleton.isInvisible()) - RenderUtils.highlightBox(entitySkeleton, c, partialTicks, true); - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java deleted file mode 100644 index f21de67b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxSkelemaster.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import com.google.common.base.Predicate; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.util.BlockPos; -import org.jetbrains.annotations.Nullable; - -import java.util.List; - - -public class FeatureBoxSkelemaster extends SimpleFeature implements WorldRenderListener { - public FeatureBoxSkelemaster() { - super("Dungeon.Mobs", "Box Skeleton Masters", "Box skeleton masters in dungeons", "dungeon.skeletonmasterbox", true); - parameters.put("radius", new FeatureParameter<Integer>("radius", "Highlight Radius", "The maximum distance between player and skeletonmaster to be boxed", 20, "integer")); - parameters.put("color", new FeatureParameter<AColor>("color", "Highlight Color", "Highlight Color of Skeleton master", new AColor(255,0,0,50), "acolor")); - } - - - private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawWorld(float partialTicks) { - if (!isEnabled()) return; - if (!skyblockStatus.isOnDungeon()) return; - - final BlockPos player = Minecraft.getMinecraft().thePlayer.getPosition(); - int val = this.<Integer>getParameter("radius").getValue(); - final int sq = val * val; - - List<EntityArmorStand> skeletonList = Minecraft.getMinecraft().theWorld.getEntities(EntityArmorStand.class, new Predicate<EntityArmorStand>() { - @Override - public boolean apply(@Nullable EntityArmorStand input) { - if (player.distanceSq(input.getPosition()) > sq) return false; - if (!input.getAlwaysRenderNameTag()) return false; - return input.getName().contains("Skeleton Master"); - } - }); - AColor c = this.<AColor>getParameter("color").getValue(); - for (EntityArmorStand entitySkeleton : skeletonList) { - RenderUtils.highlightBox(entitySkeleton, c, partialTicks, true); - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java deleted file mode 100644 index eeda16d0..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureBoxStarMobs.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import com.google.common.base.Predicate; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.util.BlockPos; -import org.jetbrains.annotations.Nullable; - -import java.util.List; - - -public class FeatureBoxStarMobs extends SimpleFeature implements WorldRenderListener { - public FeatureBoxStarMobs() { - super("Dungeon.Mobs", "Box Starred mobs", "Box Starred mobs in dungeons", "dungeon.starmobbox", false); - parameters.put("radius", new FeatureParameter<Integer>("radius", "Highlight Radius", "The maximum distance between player and starred mobs to be boxed", 20, "integer")); - parameters.put("color", new FeatureParameter<AColor>("color", "Highlight Color", "Highlight Color of Starred mobs", new AColor(0,255,255,50), "acolor")); - } - - - private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override - public void drawWorld(float partialTicks) { - if (!isEnabled()) return; - if (!skyblockStatus.isOnDungeon()) return; - - final BlockPos player = Minecraft.getMinecraft().thePlayer.getPosition(); - int val = this.<Integer>getParameter("radius").getValue(); - final int sq = val * val; - - List<EntityArmorStand> skeletonList = Minecraft.getMinecraft().theWorld.getEntities(EntityArmorStand.class, new Predicate<EntityArmorStand>() { - @Override - public boolean apply(@Nullable EntityArmorStand input) { - if (player.distanceSq(input.getPosition()) > sq) return false; - if (!input.getAlwaysRenderNameTag()) return false; - return input.getName().contains("✯"); - } - }); - AColor c = this.<AColor>getParameter("color").getValue(); - for (EntityArmorStand entitySkeleton : skeletonList) { - RenderUtils.highlightBox(entitySkeleton, c, partialTicks, true); - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureCollectScore.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureCollectScore.java deleted file mode 100644 index 897d8b64..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureCollectScore.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -public class FeatureCollectScore extends SimpleFeature { - public FeatureCollectScore() { - super("Misc", "Collect Speed Score", "Collect Speed score, run time, and floor and send that to developer's server for speed formula. This data is completely anonymous, opt out of the feature by disabling this feature", "misc.gatherscoredata", true); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java deleted file mode 100644 index 5f68187e..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonCurrentRoomSecrets.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class FeatureDungeonCurrentRoomSecrets extends TextHUDFeature implements ChatListener { - public FeatureDungeonCurrentRoomSecrets() { - super("Dungeon.Dungeon Information", "Display # Secrets in current room", "Display what your actionbar says", "dungeon.stats.secretsroom", true, getFontRenderer().getStringWidth("Secrets In Room: 8/8"), getFontRenderer().FONT_HEIGHT); - this.setEnabled(false); - getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("currentSecrets", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator2", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("totalSecrets", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - - private static final List<StyledText> dummyText= new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("Secrets In Room","title")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("5","currentSecrets")); - dummyText.add(new StyledText("/","separator2")); - dummyText.add(new StyledText("8","totalSecrets")); - } - - @Override - public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon(); - } - - @Override - public List<String> getUsedTextStyle() { - return Arrays.asList("title", "separator", "currentSecrets", "separator2", "totalSecrets"); - } - - @Override - public List<StyledText> getDummyText() { - return dummyText; - } - - private int latestCurrSecrets = 0; - private int latestTotalSecrets = 0; - - - @Override - public List<StyledText> getText() { - if (skyblockStatus.getContext().getBossfightProcessor() != null) return new ArrayList<StyledText>(); - List<StyledText> actualBit = new ArrayList<StyledText>(); - actualBit.add(new StyledText("Secrets In Room","title")); - actualBit.add(new StyledText(": ","separator")); - actualBit.add(new StyledText(latestCurrSecrets +"","currentSecrets")); - actualBit.add(new StyledText("/","separator2")); - actualBit.add(new StyledText(latestTotalSecrets +"","totalSecrets")); - return actualBit; - } - - @Override - public void onChat(ClientChatReceivedEvent chat) { - if (chat.type != 2) return; - String text = chat.message.getFormattedText(); - if (!text.contains("/")) return; - - int secretsIndex = text.indexOf("Secrets"); - if (secretsIndex != -1) { - int theindex = 0; - for (int i = secretsIndex; i >= 0; i--) { - if (text.startsWith("§7", i)) { - theindex = i; - } - } - String it = text.substring(theindex + 2, secretsIndex - 1); - - latestCurrSecrets = Integer.parseInt(it.split("/")[0]); - latestTotalSecrets = Integer.parseInt(it.split("/")[1]); - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java deleted file mode 100644 index 3dafd79e..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonDeaths.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.events.DungeonDeathEvent; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.util.ChatComponentText; -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -import java.util.*; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class FeatureDungeonDeaths extends TextHUDFeature implements ChatListener { - public FeatureDungeonDeaths() { - super("Dungeon.Dungeon Information", "Display Deaths", "Display names of player and death count in dungeon run", "dungeon.stats.deaths", false, getFontRenderer().getStringWidth("longestplayernamepos: 100"), getFontRenderer().FONT_HEIGHT * 6); - this.setEnabled(false); - getStyles().add(new TextStyle("username", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("total", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("deaths", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("totalDeaths", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override - public boolean isHUDViewable() { - if (!skyblockStatus.isOnDungeon()) return false; - DungeonContext context = skyblockStatus.getContext(); - return context != null; - } - - @Override - public boolean doesScaleWithHeight() { - return false; - } - - @Override - public List<String> getUsedTextStyle() { - return Arrays.asList("username", "separator", "deaths", "total", "totalDeaths"); - } - - @Override - public List<StyledText> getText() { - - List<StyledText> text= new ArrayList<StyledText>(); - - DungeonContext context = skyblockStatus.getContext(); - Map<String, Integer> deaths = context.getDeaths(); - int i = 0; - int deathsCnt = 0; - for (Map.Entry<String, Integer> death:deaths.entrySet()) { - text.add(new StyledText(death.getKey(),"username")); - text.add(new StyledText(": ","separator")); - text.add(new StyledText(death.getValue()+"\n","deaths")); - deathsCnt += death.getValue(); - } - text.add(new StyledText("Total Deaths","total")); - text.add(new StyledText(": ","separator")); - text.add(new StyledText(getTotalDeaths()+"","totalDeaths")); - - return text; - } - - private static final List<StyledText> dummyText= new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("syeyoung","username")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("-130\n","deaths")); - dummyText.add(new StyledText("rioho","username")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("-999999\n","deaths")); - dummyText.add(new StyledText("dungeonsguide","username")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("-42\n","deaths")); - dummyText.add(new StyledText("penguinman","username")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("0\n","deaths")); - dummyText.add(new StyledText("probablysalt","username")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("0\n","deaths")); - dummyText.add(new StyledText("Total Deaths","total")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("0","totalDeaths")); - } - - @Override - public List<StyledText> getDummyText() { - return dummyText; - } - - public int getTotalDeaths() { - if (!skyblockStatus.isOnDungeon()) return 0; - for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { - String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); - if (name.contains("Deaths")) { - String whatever = TextUtils.keepIntegerCharactersOnly(TextUtils.keepScoreboardCharacters(TextUtils.stripColor(name))); - if (whatever.isEmpty()) break; - return Integer.parseInt(whatever); - } - } - DungeonContext context = skyblockStatus.getContext(); - if (context == null) return 0; - int d = 0; - for (Integer value : context.getDeaths().values()) { - d += value; - } - return d; - } - - Pattern deathPattern = Pattern.compile("§r§c ☠ (.+?)§r§7 .+and became a ghost.+"); - Pattern meDeathPattern = Pattern.compile("§r§c ☠ §r§7You .+and became a ghost.+"); - - @Override - public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { - if (clientChatReceivedEvent.type == 2) return; - if (!skyblockStatus.isOnDungeon()) return; - DungeonContext context = skyblockStatus.getContext(); - if (context == null) return; - - String txt = clientChatReceivedEvent.message.getFormattedText(); - Matcher m = deathPattern.matcher(txt); - if (m.matches()) { - String nickname = TextUtils.stripColor(m.group(1)); - int deaths = context.getDeaths().getOrDefault(nickname, 0); - context.getDeaths().put(nickname, deaths + 1); - context.createEvent(new DungeonDeathEvent(nickname, txt, deaths)); - DungeonsGuide.sendDebugChat(new ChatComponentText("Death verified :: "+nickname+" / "+(deaths + 1))); - } - Matcher m2 = meDeathPattern.matcher(txt); - if (m2.matches()) { - String nickname = "me"; - int deaths = context.getDeaths().getOrDefault(nickname, 0); - context.getDeaths().put(nickname, deaths + 1); - context.createEvent(new DungeonDeathEvent(Minecraft.getMinecraft().thePlayer.getName(), txt, deaths)); - DungeonsGuide.sendDebugChat(new ChatComponentText("Death verified :: me / "+(deaths + 1))); - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java deleted file mode 100644 index 62074c32..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import com.google.common.collect.ComparisonChain; -import com.google.common.collect.Ordering; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.BossroomEnterListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.MapProcessor; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.features.listener.BossroomEnterListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.block.material.MapColor; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.texture.DynamicTexture; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EnumPlayerModelParts; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec4b; -import net.minecraft.world.WorldSettings; -import net.minecraft.world.storage.MapData; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import org.jetbrains.annotations.Nullable; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import javax.vecmath.Vector2d; -import java.awt.*; -import java.util.Comparator; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, DungeonStartListener, BossroomEnterListener { - public FeatureDungeonMap() { - super("Dungeon", "Dungeon Map", "Display dungeon map!", "dungeon.map", true, 128, 128); - this.setEnabled(false); - parameters.put("scale", new FeatureParameter<>("scale", "Scale map", "Whether to scale map to fit screen", true, "boolean")); - parameters.put("playerCenter", new FeatureParameter<>("playerCenter", "Center map at player", "Render you in the center", false, "boolean")); - parameters.put("rotate", new FeatureParameter<>("rotate", "Rotate map centered at player", "Only works with Center map at player enabled", false, "boolean")); - parameters.put("postScale", new FeatureParameter<>("postScale", "Scale factor of map", "Only works with Center map at player enabled", 1.0f, "float")); - parameters.put("useplayerheads", new FeatureParameter<>("useplayerheads", "Use player heads instead of arrows", "Option to use player heads instead of arrows", true, "boolean")); - parameters.put("showotherplayers", new FeatureParameter<>("showotherplayers", "Show other players", "Option to show other players in map", true, "boolean")); - parameters.put("showtotalsecrets", new FeatureParameter<>("showtotalsecrets", "Show Total secrets in the room", "Option to overlay total secrets in the specific room", true, "boolean")); - parameters.put("playerheadscale", new FeatureParameter<>("playerheadscale", "Player head scale", "Scale factor of player heads, defaults to 1", 1.0f, "float")); - parameters.put("textScale", new FeatureParameter<>("textScale", "Text scale", "Scale factor of texts on map, defaults to 1", 1.0f, "float")); - - parameters.put("border_color", new FeatureParameter<>("border_color", "Color of the border", "Same as name", new AColor(255, 255, 255, 255), "acolor")); - parameters.put("background_color", new FeatureParameter<>("background_color", "Color of the background", "Same as name", new AColor(0x22000000, true), "acolor")); - parameters.put("player_color", new FeatureParameter<>("player_color", "Color of the player border", "Same as name", new AColor(255, 255, 255, 0), "acolor")); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - public static final Ordering<NetworkPlayerInfo> field_175252_a = Ordering.from(new PlayerComparator()); - - private boolean on = false; - - @Override - public void onDungeonEnd() { - on = false; - } - - @Override - public void onDungeonStart() { - on = true; - } - - @Override - public void onBossroomEnter() { - on = false; - } - - @SideOnly(Side.CLIENT) - static class PlayerComparator implements Comparator<NetworkPlayerInfo> { - private PlayerComparator() { - } - - public int compare(NetworkPlayerInfo compare1, NetworkPlayerInfo compare2) { - ScorePlayerTeam scoreplayerteam = compare1.getPlayerTeam(); - ScorePlayerTeam scoreplayerteam1 = compare2.getPlayerTeam(); - return ComparisonChain.start().compareTrueFirst(compare1.getGameType() != WorldSettings.GameType.SPECTATOR, compare2.getGameType() != WorldSettings.GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "").compare(compare1.getGameProfile().getName(), compare2.getGameProfile().getName()).result(); - } - } - - @Override - public void drawHUD(float partialTicks) { - if (!skyblockStatus.isOnDungeon()) return; - if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) - return; - if (!on) return; - - DungeonContext context = skyblockStatus.getContext(); - MapProcessor mapProcessor = context.getMapProcessor(); - MapData mapData = mapProcessor.getLastMapData2(); - Rectangle featureRect = getFeatureRect().getRectangle(); - Gui.drawRect(0, 0, featureRect.width, featureRect.height, RenderUtils.getColorAt(featureRect.x, featureRect.y, this.<AColor>getParameter("background_color").getValue())); - GlStateManager.color(1, 1, 1, 1); - GlStateManager.pushMatrix(); - if (mapData == null) { - Gui.drawRect(0, 0, featureRect.width, featureRect.height, 0xFFFF0000); - } else { - renderMap(partialTicks, mapProcessor, mapData, context); - } - GlStateManager.popMatrix(); - GL11.glLineWidth(2); - RenderUtils.drawUnfilledBox(0, 0, featureRect.width, featureRect.height, this.<AColor>getParameter("border_color").getValue()); - } - - @Override - public void drawDemo(float partialTicks) { - if (skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getMapProcessor().isInitialized() && on) { - drawHUD(partialTicks); - return; - } - Rectangle featureRect = getFeatureRect().getRectangle(); - Gui.drawRect(0, 0, featureRect.width, featureRect.height, RenderUtils.getColorAt(featureRect.x, featureRect.y, this.<AColor>getParameter("background_color").getValue())); - FontRenderer fr = getFontRenderer(); - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Please join a dungeon to see preview", featureRect.width / 2 - fr.getStringWidth("Please join a dungeon to see preview") / 2, featureRect.height / 2 - fr.FONT_HEIGHT / 2, 0xFFFFFFFF); - GL11.glLineWidth(2); - RenderUtils.drawUnfilledBox(0, 0, featureRect.width, featureRect.height, this.<AColor>getParameter("border_color").getValue()); - } - - public void renderMap(float partialTicks, MapProcessor mapProcessor, MapData mapData, DungeonContext context) { - float postScale; - if (this.<Boolean>getParameter("playerCenter").getValue()) { - postScale = this.<Float>getParameter("postScale").getValue(); - } else { - postScale = 1; - } - Rectangle featureRect = getFeatureRect().getRectangle(); - int width = featureRect.width; - float scale; - if (this.<Boolean>getParameter("scale").getValue()) { - scale = width / 128.0f; - } else { - scale = 1; - } - GlStateManager.translate(width / 2d, width / 2d, 0); - GlStateManager.scale(scale, scale, 0); - GlStateManager.scale(postScale, postScale, 0); - EntityPlayer p = Minecraft.getMinecraft().thePlayer; - - Vector2d pt = mapProcessor.worldPointToMapPointFLOAT(p.getPositionEyes(partialTicks)); - double yaw = p.rotationYaw; - if (this.<Boolean>getParameter("playerCenter").getValue()) { - if (this.<Boolean>getParameter("rotate").getValue()) { - GlStateManager.rotate((float) (180.0 - yaw), 0, 0, 1); - } - GlStateManager.translate(-pt.x, -pt.y, 0); - } else { - GlStateManager.translate(-64, -64, 0); - } - updateMapTexture(mapData.colors, mapProcessor, context.getDungeonRoomList()); - render(); - - - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(1, 771, 0, 1); - - if (this.<Boolean>getParameter("useplayerheads").getValue()) { - renderHeads(mapProcessor, mapData, scale, postScale, partialTicks); - } else { - renderArrows(mapData, scale, postScale); - } - - - FontRenderer fr = getFontRenderer(); - if (this.<Boolean>getParameter("showtotalsecrets").getValue()) { - for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { - GlStateManager.pushMatrix(); - - Point mapPt = mapProcessor.roomPointToMapPoint(dungeonRoom.getUnitPoints().get(0)); - GlStateManager.translate(mapPt.x + mapProcessor.getUnitRoomDimension().width / 2d, mapPt.y + mapProcessor.getUnitRoomDimension().height / 2d, 0); - - if (this.<Boolean>getParameter("playerCenter").getValue() && this.<Boolean>getParameter("rotate").getValue()) { - GlStateManager.rotate((float) (yaw - 180), 0, 0, 1); - } - GlStateManager.scale(1 / scale, 1 / scale, 0); - GlStateManager.scale(1 / postScale, 1 / postScale, 0); - float s = this.<Float>getParameter("textScale").getValue(); - GlStateManager.scale(s, s, 0); - String str = ""; - str += dungeonRoom.getTotalSecrets() == -1 ? "?" : String.valueOf(dungeonRoom.getTotalSecrets()); - str += " "; - if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.FINISHED) { - str += "✔"; - } else if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.COMPLETE_WITHOUT_SECRETS) { - str += "☑"; - } else if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED) { - str += "☐"; - } else if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.FAILED) { - str += "❌"; - } - - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - if (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.FINISHED) - fr.drawString(str, -(fr.getStringWidth(str) / 2), -(fr.FONT_HEIGHT / 2), 0xFF00FF00); - else { - if (dungeonRoom.getColor() == 74) - fr.drawString(str, -(fr.getStringWidth(str) / 2), -(fr.FONT_HEIGHT / 2), 0xff000000); - else fr.drawString(str, -(fr.getStringWidth(str) / 2), -(fr.FONT_HEIGHT / 2), 0xFFFFFFFF); - } - - GlStateManager.popMatrix(); - } - } - - } - - - private final DynamicTexture mapTexture = new DynamicTexture(128, 128); - private final ResourceLocation location = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("dungeonmap/map", mapTexture); - private final int[] mapTextureData = mapTexture.getTextureData(); - - private void updateMapTexture(byte[] colors, MapProcessor mapProcessor, List<DungeonRoom> dungeonRooms) { - for (int i = 0; i < 16384; ++i) { - int j = colors[i] & 255; - - if (j / 4 == 0) { - this.mapTextureData[i] = 0x00000000; - } else { - this.mapTextureData[i] = MapColor.mapColorArray[j / 4].getMapColor(j & 3); - } - } - - if (this.<Boolean>getParameter("showtotalsecrets").getValue()) { - for (DungeonRoom dungeonRoom : dungeonRooms) { - for (Point pt : dungeonRoom.getUnitPoints()) { - for (int y1 = 0; y1 < mapProcessor.getUnitRoomDimension().height; y1++) { - for (int x1 = 0; x1 < mapProcessor.getUnitRoomDimension().width; x1++) { - int x = MathHelper.clamp_int(pt.x * (mapProcessor.getUnitRoomDimension().width + mapProcessor.getDoorDimension().height) + x1 + mapProcessor.getTopLeftMapPoint().x, 0, 128); - int y = MathHelper.clamp_int(pt.y * (mapProcessor.getUnitRoomDimension().height + mapProcessor.getDoorDimension().height) + y1 + mapProcessor.getTopLeftMapPoint().y, 0, 128); - int i = y * 128 + x; - int j = dungeonRoom.getColor(); - - if (j / 4 == 0) { - this.mapTextureData[i] = 0x00000000; - } else { - this.mapTextureData[i] = MapColor.mapColorArray[j / 4].getMapColor(j & 3); - } - } - } - } - } - } - - - this.mapTexture.updateDynamicTexture(); - } - - - private void renderHeads(MapProcessor mapProcessor, MapData mapData, float scale, float postScale, float partialTicks) { - List<NetworkPlayerInfo> list = field_175252_a.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); - if (list.size() < 40) return; - - // 19 iterations bc we only want to scan the player part of tab list - for (int i = 1; i < 20; i++) { - NetworkPlayerInfo networkPlayerInfo = list.get(i); - - String name = getPlayerNameWithChecks(networkPlayerInfo); - if (name == null) continue; - - - EntityPlayer entityplayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(name); - - Vector2d pt2; - double yaw2; - - - if (entityplayer != null && (!entityplayer.isInvisible() || entityplayer == Minecraft.getMinecraft().thePlayer)) { - pt2 = mapProcessor.worldPointToMapPointFLOAT(entityplayer.getPositionEyes(partialTicks)); - yaw2 = entityplayer.prevRotationYawHead + (entityplayer.rotationYawHead - entityplayer.prevRotationYawHead) * partialTicks; - } else { - String iconName = mapProcessor.getMapIconToPlayerMap().get(name); - if (iconName == null) continue; - Vec4b vec = mapData.mapDecorations.get(iconName); - if (vec == null) { - continue; - } else { - pt2 = new Vector2d(vec.func_176112_b() / 2d + 64, vec.func_176113_c() / 2d + 64); - yaw2 = vec.func_176111_d() * 360 / 16.0f; - } - } - - GlStateManager.pushMatrix(); - - boolean showOtherPlayers = this.<Boolean>getParameter("showotherplayers").getValue(); - - if (entityplayer == Minecraft.getMinecraft().thePlayer || showOtherPlayers) { - boolean flag1 = entityplayer != null && entityplayer.isWearing(EnumPlayerModelParts.CAPE); - GlStateManager.enableTexture2D(); - Minecraft.getMinecraft().getTextureManager().bindTexture(networkPlayerInfo.getLocationSkin()); - int l2 = 8 + (flag1 ? 8 : 0); - int i3 = 8 * (flag1 ? -1 : 1); - - GlStateManager.translate(pt2.x, pt2.y, 0); - GlStateManager.rotate((float) yaw2, 0, 0, 1); - - GlStateManager.scale(1 / scale, 1 / scale, 0); - GlStateManager.scale(1 / postScale, 1 / postScale, 0); - - float s = this.<Float>getParameter("playerheadscale").getValue(); - GlStateManager.scale(s, s, 0); - - // cutting out the player head out of the skin texture - Gui.drawScaledCustomSizeModalRect(-4, -4, 8.0F, l2, 8, i3, 8, 8, 64.0F, 64.0F); - GL11.glLineWidth(1); - RenderUtils.drawUnfilledBox(-4, -4, 4, 4, this.<AColor>getParameter("player_color").getValue()); - } - GlStateManager.popMatrix(); - } - } - - final Pattern tabListRegex = Pattern.compile("\\*[a-zA-Z0-9_]{2,16}\\*", Pattern.MULTILINE); - - /** - * We make sure that the player is alive and regex their name out - * @param networkPlayerInfo the network player info of player - * @return the username of player - */ - @Nullable - private String getPlayerNameWithChecks(NetworkPlayerInfo networkPlayerInfo) { - String name; - if (networkPlayerInfo.getDisplayName() != null) { - name = networkPlayerInfo.getDisplayName().getFormattedText(); - } else { - name = ScorePlayerTeam.formatPlayerName( - networkPlayerInfo.getPlayerTeam(), - networkPlayerInfo.getGameProfile().getName() - ); - } - - if (name.trim().equals("§r") || name.startsWith("§r ")) return null; - - name = TextUtils.stripColor(name); - - if(name.contains("(DEAD)")) { - return null; - } - - name = name.replace(" ", "*"); - - Matcher matcher = tabListRegex.matcher(name); - if (!matcher.find()) return null; - - name = matcher.group(0); - name = name.substring(0, name.length() - 1); - name = name.substring(1); - return name; - } - - - private static final ResourceLocation mapIcons = new ResourceLocation("textures/map/map_icons.png"); - - private void renderArrows(MapData mapData, float scale, float postScale) { - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - int k = 0; - Minecraft.getMinecraft().getTextureManager().bindTexture(mapIcons); - for (Vec4b vec4b : mapData.mapDecorations.values()) { - if (vec4b.func_176110_a() == 1 || this.<Boolean>getParameter("showotherplayers").getValue()) { - GlStateManager.pushMatrix(); - GlStateManager.translate(vec4b.func_176112_b() / 2.0F + 64.0F, vec4b.func_176113_c() / 2.0F + 64.0F, -0.02F); - GlStateManager.rotate((vec4b.func_176111_d() * 360) / 16.0F, 0.0F, 0.0F, 1.0F); - - GlStateManager.scale(1 / scale, 1 / scale, 0); - GlStateManager.scale(1 / postScale, 1 / postScale, 0); - float s = this.<Float>getParameter("playerheadscale").getValue(); - GlStateManager.scale(s * 5, s * 5, 0); - - GlStateManager.translate(-0.125F, 0.125F, 0.0F); - byte b0 = vec4b.func_176110_a(); - float f1 = (b0 % 4) / 4.0F; - float f2 = (b0 / 4f) / 4.0F; - float f3 = (b0 % 4 + 1) / 4.0F; - float f4 = (b0 / 4f + 1) / 4.0F; - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); - worldrenderer.pos(-1.0D, 1.0D, k * -0.001F).tex(f1, f2).endVertex(); - worldrenderer.pos(1.0D, 1.0D, k * -0.001F).tex(f3, f2).endVertex(); - worldrenderer.pos(1.0D, -1.0D, k * -0.001F).tex(f3, f4).endVertex(); - worldrenderer.pos(-1.0D, -1.0D, k * -0.001F).tex(f1, f4).endVertex(); - tessellator.draw(); - GlStateManager.popMatrix(); - ++k; - } - } - } - - private void render() { - int i = 0; - int j = 0; - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - float f = 0.0F; - Minecraft.getMinecraft().getTextureManager().bindTexture(this.location); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(1, 771, 0, 1); - GlStateManager.disableAlpha(); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); - worldrenderer.pos((i) + f, (j + 128) - f, -0.009999999776482582D).tex(0.0D, 1.0D).endVertex(); - worldrenderer.pos((i + 128) - f, (j + 128) - f, -0.009999999776482582D).tex(1.0D, 1.0D).endVertex(); - worldrenderer.pos((i + 128) - f, (j) + f, -0.009999999776482582D).tex(1.0D, 0.0D).endVertex(); - worldrenderer.pos((i) + f, (j) + f, -0.009999999776482582D).tex(0.0D, 0.0D).endVertex(); - tessellator.draw(); - GlStateManager.enableAlpha(); - GlStateManager.disableBlend(); - - GlStateManager.pushMatrix(); - GlStateManager.translate(0.0F, 0.0F, -0.04F); - GlStateManager.scale(1.0F, 1.0F, 1.0F); - GlStateManager.popMatrix(); - } - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMilestone.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMilestone.java deleted file mode 100644 index 5fe72cc9..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMilestone.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.util.ChatComponentText; -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.regex.Pattern; - -public class FeatureDungeonMilestone extends TextHUDFeature implements ChatListener { - public FeatureDungeonMilestone() { - super("Dungeon.Dungeon Information", "Display Current Class Milestone", "Display current class milestone of yourself", "dungeon.stats.milestone", true, getFontRenderer().getStringWidth("Milestone: 12"), getFontRenderer().FONT_HEIGHT); - this.setEnabled(false); - getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("number", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - private static final List<StyledText> dummyText= new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("Milestone","title")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("9","number")); - } - - @Override - public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon(); - } - - @Override - public List<String> getUsedTextStyle() { - return Arrays.asList("title", "separator", "number"); - } - - @Override - public List<StyledText> getDummyText() { - return dummyText; - } - - @Override - public List<StyledText> getText() { - List<StyledText> actualBit = new ArrayList<StyledText>(); - actualBit.add(new StyledText("Milestone","title")); - actualBit.add(new StyledText(": ","separator")); - for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { - String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); - if (name.startsWith("§r Milestone: §r")) { - String milestone = TextUtils.stripColor(name).substring(13); - actualBit.add(new StyledText(milestone+"","number")); - break; - } - } - return actualBit; - } - - public static final Pattern milestone_pattern = Pattern.compile("§r§e§l(.+) Milestone §r§e(.)§r§7: .+ §r§a(.+)§r"); - - - @Override - public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { - if (clientChatReceivedEvent.type == 2) return; - if (!skyblockStatus.isOnDungeon()) return; - DungeonContext context = skyblockStatus.getContext(); - if (context == null) return; - String txt = clientChatReceivedEvent.message.getFormattedText(); - if (milestone_pattern.matcher(txt).matches()) { - context.getMilestoneReached().add(new String[] { - TextUtils.formatTime(FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()), - TextUtils.formatTime(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed()) - }); - DungeonsGuide.sendDebugChat(new ChatComponentText("Reached Milestone At " + TextUtils.formatTime(FeatureRegistry.DUNGEON_REALTIME.getTimeElapsed()) + " / "+TextUtils.formatTime(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed()))); - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRealTime.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRealTime.java deleted file mode 100644 index 88bfe8fe..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRealTime.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.DungeonQuitListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.utils.TextUtils; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class FeatureDungeonRealTime extends TextHUDFeature implements DungeonStartListener, DungeonQuitListener { - public FeatureDungeonRealTime() { - super("Dungeon.Dungeon Information", "Display Real Time-Dungeon Time", "Display how much real time has passed since dungeon run started", "dungeon.stats.realtime", true, getFontRenderer().getStringWidth("Time(Real): 59m 59s"), getFontRenderer().FONT_HEIGHT); - this.setEnabled(false); - getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("discriminator", new AColor(0xAA,0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("number", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - } - - private long started = -1; - - public long getTimeElapsed() { - return System.currentTimeMillis() - started; - } - - private static final java.util.List<StyledText> dummyText= new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("Time","title")); - dummyText.add(new StyledText("(Real)","discriminator")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("-42h","number")); - } - - @Override - public boolean isHUDViewable() { - return started != -1; - } - - @Override - public java.util.List<String> getUsedTextStyle() { - return Arrays.asList("title", "discriminator", "separator", "number"); - } - - @Override - public java.util.List<StyledText> getDummyText() { - return dummyText; - } - - @Override - public java.util.List<StyledText> getText() { - List<StyledText> actualBit = new ArrayList<StyledText>(); - actualBit.add(new StyledText("Time","title")); - actualBit.add(new StyledText("(Real)","discriminator")); - actualBit.add(new StyledText(": ","separator")); - actualBit.add(new StyledText(TextUtils.formatTime(getTimeElapsed()),"number")); - return actualBit; - } - - @Override - public void onDungeonStart() { - started= System.currentTimeMillis(); - } - - @Override - public void onDungeonQuit() { - started = -1; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRoomName.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRoomName.java deleted file mode 100644 index 512ec964..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonRoomName.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; - -import java.awt.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class FeatureDungeonRoomName extends TextHUDFeature { - public FeatureDungeonRoomName() { - super("Dungeon.Dungeon Information", "Display name of the room you are in", "Display name of the room you are in", "dungeon.roomname", false, getFontRenderer().getStringWidth("You're in puzzle-tictactoe"), getFontRenderer().FONT_HEIGHT); - getStyles().add(new TextStyle("in", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("roomname", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - public int getTotalSecretsInt() { - DungeonContext context = skyblockStatus.getContext(); - int totalSecrets = 0; - for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { - if (dungeonRoom.getTotalSecrets() != -1) - totalSecrets += dungeonRoom.getTotalSecrets(); - } - return totalSecrets; - } - - private static final List<StyledText> dummyText= new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("You're in ","in")); - dummyText.add(new StyledText("puzzle-tictactoe","roomname")); - } - - @Override - public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon() && skyblockStatus.getContext() != null && skyblockStatus.getContext().getMapProcessor() != null; - } - - @Override - public List<String> getUsedTextStyle() { - return Arrays.asList("roomname", "in"); - } - - @Override - public List<StyledText> getDummyText() { - return dummyText; - } - - @Override - public List<StyledText> getText() { - EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; - - Point roomPt = skyblockStatus.getContext().getMapProcessor().worldPointToRoomPoint(player.getPosition()); - DungeonRoom dungeonRoom = skyblockStatus.getContext().getRoomMapper().get(roomPt); - List<StyledText> actualBit = new ArrayList<StyledText>(); - actualBit.add(new StyledText("You're in ","in")); - if (dungeonRoom == null) { - actualBit.add(new StyledText("Unknown","roomname")); - } else { - actualBit.add(new StyledText(dungeonRoom.getDungeonRoomInfo().getName(),"roomname")); - } - - - return actualBit; - } - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSBTime.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSBTime.java deleted file mode 100644 index 00928806..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSBTime.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.scoreboard.Score; -import net.minecraft.scoreboard.ScoreObjective; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.scoreboard.Scoreboard; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -public class FeatureDungeonSBTime extends TextHUDFeature { - - private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - public FeatureDungeonSBTime() { - super("Dungeon.Dungeon Information", "Display Ingame Dungeon Time", "Display how much time skyblock thinks has passed since dungeon run started", "dungeon.stats.igtime", true, getFontRenderer().getStringWidth("Time(IG): 1h 59m 59s"), getFontRenderer().FONT_HEIGHT); - this.setEnabled(false); - getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("discriminator", new AColor(0xAA,0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("number", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - } - - public int getTimeElapsed() { - Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard(); - ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); - Collection<Score> scores = scoreboard.getSortedScores(objective); - String time = "idkyet"; - for (Score sc:scores) { - ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName()); - String strippedLine = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()))).trim(); - if (strippedLine.startsWith("Time Elapsed: ")) { - time = strippedLine.substring(14); - } - } - time = time.replace(" ", ""); - int hour = time.indexOf('h') == -1 ? 0 : Integer.parseInt(time.substring(0, time.indexOf('h'))); - if (time.contains("h")) time = time.substring(time.indexOf('h') + 1); - int minute = time.indexOf('m') == -1 ? 0 : Integer.parseInt(time.substring(0, time.indexOf('m'))); - if (time.contains("m")) time = time.substring(time.indexOf('m') + 1); - int second = time.indexOf('s') == -1 ? 0 : Integer.parseInt(time.substring(0, time.indexOf('s'))); - - int time2 = hour * 60 * 60 + minute * 60 + second; - return time2 * 1000; - } - - private static final java.util.List<StyledText> dummyText= new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("Time","title")); - dummyText.add(new StyledText("(Ig)","discriminator")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("-42h","number")); - } - - @Override - public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon(); - } - - @Override - public java.util.List<String> getUsedTextStyle() { - return Arrays.asList("title", "discriminator", "separator", "number"); - } - - @Override - public java.util.List<StyledText> getDummyText() { - return dummyText; - } - - @Override - public java.util.List<StyledText> getText() { - List<StyledText> actualBit = new ArrayList<StyledText>(); - actualBit.add(new StyledText("Time","title")); - actualBit.add(new StyledText("(Ig)","discriminator")); - actualBit.add(new StyledText(": ","separator")); - Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard(); - ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); - Collection<Score> scores = scoreboard.getSortedScores(objective); - String time = "unknown"; - for (Score sc:scores) { - ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName()); - String strippedLine = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()))).trim(); - if (strippedLine.startsWith("Time Elapsed: ")) { - time = strippedLine.substring(14); - } - } - actualBit.add(new StyledText(time,"number")); - return actualBit; - } - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java deleted file mode 100644 index b62df644..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.TimeScoreUtil; -import kr.syeyoung.dungeonsguide.wsresource.StaticResource; -import kr.syeyoung.dungeonsguide.wsresource.StaticResourceCache; -import lombok.AllArgsConstructor; -import lombok.Data; -import net.minecraft.client.Minecraft; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.util.MathHelper; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; - -public class FeatureDungeonScore extends TextHUDFeature { - public FeatureDungeonScore() { - super("Dungeon.Dungeon Information", "Display Current Score", "Calculate and Display current score\nThis data is from pure calculation and can be different from actual score.", "dungeon.stats.score", false, 200, getFontRenderer().FONT_HEIGHT * 4); - this.setEnabled(false); - parameters.put("verbose", new FeatureParameter<Boolean>("verbose", "Show each score instead of sum", "Skill: 100 Explore: 58 S->S+(5 tombs) instead of Score: 305", true, "boolean")); - - getStyles().add(new TextStyle("scorename", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("score", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("brackets", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("etc", new AColor(0xAA,0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("currentScore", new AColor(0xFF, 0xAA,0x00,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("arrow", new AColor(0xAA,0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("nextScore", new AColor(0xFF, 0xAA,0x00,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("required", new AColor(0xAA,0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override - public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon(); - } - - private static final java.util.List<StyledText> dummyText= new ArrayList<StyledText>(); - private static final java.util.List<StyledText> dummyText2= new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("Score","scorename")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("305 ","score")); - dummyText.add(new StyledText("(","brackets")); - dummyText.add(new StyledText("S+","currentScore")); - dummyText.add(new StyledText(")","brackets")); - - - - dummyText2.add(new StyledText("Skill","scorename")); - dummyText2.add(new StyledText(": ","separator")); - dummyText2.add(new StyledText("100 ","score")); - dummyText2.add(new StyledText("(","brackets")); - dummyText2.add(new StyledText("0 Deaths","etc")); - dummyText2.add(new StyledText(")\n","brackets")); - dummyText2.add(new StyledText("Explorer","scorename")); - dummyText2.add(new StyledText(": ","separator")); - dummyText2.add(new StyledText("99 ","score")); - dummyText2.add(new StyledText("(","brackets")); - dummyText2.add(new StyledText("Rooms O Secrets 39/40","etc")); - dummyText2.add(new StyledText(")\n","brackets")); - dummyText2.add(new StyledText("Time","scorename")); - dummyText2.add(new StyledText(": ","separator")); - dummyText2.add(new StyledText("100 ","score")); - dummyText2.add(new StyledText("Bonus","scorename")); - dummyText2.add(new StyledText(": ","separator")); - dummyText2.add(new StyledText("0 ","score")); - dummyText2.add(new StyledText("Total","scorename")); - dummyText2.add(new StyledText(": ","separator")); - dummyText2.add(new StyledText("299\n","score")); - dummyText2.add(new StyledText("S","currentScore")); - dummyText2.add(new StyledText("->","arrow")); - dummyText2.add(new StyledText("S+ ","nextScore")); - dummyText2.add(new StyledText("(","brackets")); - dummyText2.add(new StyledText("1 Required 1 crypt","required")); - dummyText2.add(new StyledText(")","brackets")); - - } - - @Override - public java.util.List<String> getUsedTextStyle() { - return Arrays.asList("scorename", "separator", "score", "brackets", "etc", "currentScore", "arrow", "nextScore", "required"); - - } - - @Override - public java.util.List<StyledText> getDummyText() { - - if (this.<Boolean>getParameter("verbose").getValue()) {return dummyText2;} else return dummyText; - } - - @Override - public java.util.List<StyledText> getText() { - List<StyledText> actualBit = new ArrayList<StyledText>(); - - ScoreCalculation score = calculateScore(); - if (score == null) return new ArrayList<StyledText>(); - int sum = score.time + score.skill + score.explorer + score.bonus; - if (this.<Boolean>getParameter("verbose").getValue()) { - actualBit.add(new StyledText("Skill", "scorename")); - actualBit.add(new StyledText(": ", "separator")); - actualBit.add(new StyledText(score.skill + " ", "score")); - actualBit.add(new StyledText("(", "brackets")); - actualBit.add(new StyledText(score.deaths + " Deaths", "etc")); - actualBit.add(new StyledText(")\n", "brackets")); - actualBit.add(new StyledText("Explorer", "scorename")); - actualBit.add(new StyledText(": ", "separator")); - actualBit.add(new StyledText(score.explorer + " ", "score")); - actualBit.add(new StyledText("(", "brackets")); - actualBit.add(new StyledText("Rooms " + (score.fullyCleared ? "O" : "X") + " Secrets " + score.secrets + "/" + score.effectiveTotalSecrets +" of "+score.getTotalSecrets() + (score.totalSecretsKnown ? "" : "?"), "etc")); - actualBit.add(new StyledText(")\n", "brackets")); - actualBit.add(new StyledText("Time", "scorename")); - actualBit.add(new StyledText(": ", "separator")); - actualBit.add(new StyledText(score.time + " ", "score")); - actualBit.add(new StyledText("Bonus", "scorename")); - actualBit.add(new StyledText(": ", "separator")); - actualBit.add(new StyledText(score.bonus + " ", "score")); - actualBit.add(new StyledText("Total", "scorename")); - actualBit.add(new StyledText(": ", "separator")); - actualBit.add(new StyledText(sum + "\n", "score")); - actualBit.addAll(buildRequirement(score)); - } else { - String letter = getLetter(sum); - actualBit.add(new StyledText("Score", "scorename")); - actualBit.add(new StyledText(": ", "separator")); - actualBit.add(new StyledText(sum + " ", "score")); - actualBit.add(new StyledText("(", "brackets")); - actualBit.add(new StyledText(letter, "currentScore")); - actualBit.add(new StyledText(")", "brackets")); - } - - return actualBit; - } - - @Data - @AllArgsConstructor - public static class ScoreCalculation { - private int skill, explorer, time, bonus, tombs; - private boolean fullyCleared; - private int secrets, totalSecrets, effectiveTotalSecrets; - private boolean totalSecretsKnown; - private int deaths; - } - - public int getPercentage() { - return skyblockStatus.getPercentage(); - } - public int getCompleteRooms() { - for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { - String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); - if (name.startsWith("§r Completed Rooms: §r")) { - String milestone = TextUtils.stripColor(name).substring(18); - return Integer.parseInt(milestone); - } - } - return 0; - } - public int getTotalRooms() { - int compRooms = getCompleteRooms(); - if (compRooms == 0) return 100; - return (int) (100 * (compRooms / (double)getPercentage())); - } - public int getUndiscoveredPuzzles() { - int cnt = 0; - for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { - String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); - if (name.startsWith("§r ???: ")) { - cnt ++; - } - } - return cnt; - } - - public ScoreCalculation calculateScore() { - if (!skyblockStatus.isOnDungeon()) return null; - DungeonContext context = skyblockStatus.getContext(); - if (context == null) return null; - if (!context.getMapProcessor().isInitialized()) return null; - - int skill = 100; - int deaths = 0; - { - deaths = FeatureRegistry.DUNGEON_DEATHS.getTotalDeaths(); - skill -= FeatureRegistry.DUNGEON_DEATHS.getTotalDeaths() * 2; - int totalCompRooms= 0; - int roomCnt = 0; - int roomSkillPenalty = 0; -// boolean bossroomIncomplete = true; - boolean traproomIncomplete = context.isTrapRoomGen(); - int incompletePuzzles = getUndiscoveredPuzzles(); - - for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { -// if (dungeonRoom.getColor() == 74 && dungeonRoom.getCurrentState() != DungeonRoom.RoomState.DISCOVERED) -// bossroomIncomplete = false; - if (dungeonRoom.getColor() == 62 && dungeonRoom.getCurrentState() != DungeonRoom.RoomState.DISCOVERED) - traproomIncomplete = false; - if (dungeonRoom.getCurrentState() != DungeonRoom.RoomState.DISCOVERED) - totalCompRooms += dungeonRoom.getUnitPoints().size(); - if (dungeonRoom.getColor() == 66 && (dungeonRoom.getCurrentState() == DungeonRoom.RoomState.DISCOVERED || dungeonRoom.getCurrentState() == DungeonRoom.RoomState.FAILED)) // INCOMPLETE PUZZLE ON MAP - incompletePuzzles++; - roomCnt += dungeonRoom.getUnitPoints().size(); - } - roomSkillPenalty += incompletePuzzles * 10; - if (context.getMapProcessor().getUndiscoveredRoom() != 0) - roomCnt = getTotalRooms(); - roomSkillPenalty += (roomCnt - totalCompRooms) * 4; -// if (bossroomIncomplete) roomSkillPenalty -=1; - if (traproomIncomplete) roomSkillPenalty -=1; - - - skill -= roomSkillPenalty; - - - - skill = MathHelper.clamp_int(skill, 0, 100); - } - int explorer = 0; - boolean fullyCleared = false; - boolean totalSecretsKnown = true; - int totalSecrets = 0; - int secrets = 0; - { - int completed = 0; - double total = 0; - - for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { - if (dungeonRoom.getCurrentState() != DungeonRoom.RoomState.DISCOVERED && dungeonRoom.getCurrentState() != DungeonRoom.RoomState.FAILED) - completed += dungeonRoom.getUnitPoints().size(); - total += dungeonRoom.getUnitPoints().size(); - } - - totalSecrets = FeatureRegistry.DUNGEON_SECRETS.getTotalSecretsInt() ; - totalSecretsKnown = FeatureRegistry.DUNGEON_SECRETS.sureOfTotalSecrets(); - - fullyCleared = completed >= getTotalRooms() && context.getMapProcessor().getUndiscoveredRoom() == 0; - explorer += MathHelper.clamp_int((int) Math.floor(6.0 / 10.0 * (context.getMapProcessor().getUndiscoveredRoom() != 0 ? getPercentage() : completed / total * 100)), 0, 60); - explorer += MathHelper.clamp_int((int) Math.floor(40 * (secrets = FeatureRegistry.DUNGEON_SECRETS.getSecretsFound()) / Math.ceil(totalSecrets * context.getSecretPercentage())),0,40); - } - int time = 0; - { - int maxTime = context.getMaxSpeed(); -// int timeSec = FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed() / 1000 - maxTime + 480; -// -// if (timeSec <= 480) time = 100; -// else if (timeSec <= 580) time = (int) Math.ceil(148 - 0.1 * timeSec); -// else if (timeSec <= 980) time = (int) Math.ceil(119 - 0.05 * timeSec); -// else if (timeSec < 3060) time = (int) Math.ceil(3102 - (1/30.0) * timeSec); -// time = MathHelper.clamp_int(time, 0, 100); // just in case. - time = TimeScoreUtil.estimate(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed(), maxTime); - } - int bonus = 0; - int tombs; - { - bonus += tombs = MathHelper.clamp_int(FeatureRegistry.DUNGEON_TOMBS.getTombsFound(), 0, 5); - if (context.isGotMimic()) bonus += 2; - CompletableFuture<StaticResource> staticResourceCompletableFuture = StaticResourceCache.INSTANCE.getResource(StaticResourceCache.BONUS_SCORE); - if (staticResourceCompletableFuture.isDone()) { - try { - bonus += Integer.parseInt(staticResourceCompletableFuture.get().getValue().trim()); - } catch (InterruptedException | ExecutionException e) { - e.printStackTrace(); - } - } - } - - // amazing thing - return new ScoreCalculation(skill, explorer, time, bonus, tombs, fullyCleared, secrets, totalSecrets, (int)Math.ceil (totalSecrets * context.getSecretPercentage()), totalSecretsKnown, deaths); - } - public String getLetter(int score) { - if (score <= 99) return "D"; - if (score <= 159) return "C"; - if (score <= 229) return "B"; - if (score <= 269) return "A"; - if (score <= 299) return "S"; - return "S+"; - } - public int getScoreRequirement(String letter) { - if (letter.equals("D")) return 0; - if (letter.equals("C")) return 100; - if (letter.equals("B")) return 160; - if (letter.equals("A")) return 230; - if (letter.equals("S")) return 270; - if (letter.equals("S+")) return 300; - return -1; - } - public String getNextLetter(String letter) { - if (letter.equals("D")) return "C"; - if (letter.equals("C")) return "B"; - if (letter.equals("B")) return "A"; - if (letter.equals("A")) return "S"; - if (letter.equals("S")) return "S+"; - else return null; - } - public List<StyledText> buildRequirement(ScoreCalculation calculation) { - List<StyledText> actualBit = new ArrayList<StyledText>(); - int current = calculation.time + calculation.bonus + calculation.explorer + calculation.skill; - String currentLetter = getLetter(current); - String nextLetter= getNextLetter(currentLetter); - if (nextLetter == null) { - actualBit.add(new StyledText("S+ Expected","nextScore")); - return actualBit; - } - int req = getScoreRequirement(nextLetter); - int reqPT2 = req- current; - int reqPT = req - current; - - int tombsBreakable = Math.min(5 - calculation.tombs, reqPT); - reqPT -= tombsBreakable; - - double secretPer = 40.0 / calculation.effectiveTotalSecrets; - int secrets = (int) Math.ceil(reqPT / secretPer); - - actualBit.add(new StyledText(currentLetter,"currentScore")); - actualBit.add(new StyledText("->","arrow")); - actualBit.add(new StyledText(nextLetter+" ","nextScore")); - actualBit.add(new StyledText("(","brackets")); - actualBit.add(new StyledText(reqPT2+" required "+tombsBreakable+" crypt "+secrets+" secrets","required")); - actualBit.add(new StyledText(")","brackets")); - return actualBit; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java deleted file mode 100644 index 11de62a3..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonSecrets.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.scoreboard.ScorePlayerTeam; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class FeatureDungeonSecrets extends TextHUDFeature { - public FeatureDungeonSecrets() { - super("Dungeon.Dungeon Information", "Display Total # of Secrets", "Display how much total secrets have been found in a dungeon run.\n+ sign means DG does not know the correct number, but it's somewhere above that number.", "dungeon.stats.secrets", true, getFontRenderer().getStringWidth("Secrets: 999/999+ of 999+"), getFontRenderer().FONT_HEIGHT); - this.setEnabled(false); - getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("currentSecrets", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator2", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("totalSecrets", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("unknown", new AColor(0xFF, 0xFF,0x55,255), new AColor(0, 0,0,0), false)); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - public int getSecretsFound() { - for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { - String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); - if (name.startsWith("§r Secrets Found: §r§b") && !name.contains("%")) { - String noColor = TextUtils.stripColor(name); - return Integer.parseInt(noColor.substring(16)); - } - } - return 0; - } - public double getSecretPercentage() { - for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { - String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); - if (name.startsWith("§r Secrets Found: §r") && name.contains("%")) { - String noColor = TextUtils.stripColor(name); - return Double.parseDouble(noColor.substring(16).replace("%", "")); - } - } - return 0; - } - - public int getTotalSecretsInt() { - if (getSecretsFound() != 0) return (int) Math.ceil (getSecretsFound() / getSecretPercentage() * 100); - DungeonContext context = skyblockStatus.getContext(); - int totalSecrets = 0; - for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { - if (dungeonRoom.getTotalSecrets() != -1) - totalSecrets += dungeonRoom.getTotalSecrets(); - } - return totalSecrets; - } - public boolean sureOfTotalSecrets() { - if (getSecretsFound() != 0) return true; - DungeonContext context = skyblockStatus.getContext(); - if (context.getMapProcessor().getUndiscoveredRoom() > 0) return false; - boolean allknown = true; - for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { - if (dungeonRoom.getTotalSecrets() == -1) allknown = false; - } - return allknown; - } - - public String getTotalSecrets() { - DungeonContext context = skyblockStatus.getContext(); - if (context == null) return "?"; - int totalSecrets = 0; - boolean allknown = true; - for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { - if (dungeonRoom.getTotalSecrets() != -1) - totalSecrets += dungeonRoom.getTotalSecrets(); - else allknown = false; - } - return totalSecrets + (allknown ? "":"+"); - } - - - private static final java.util.List<StyledText> dummyText= new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("Secrets","title")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("999","currentSecrets")); - dummyText.add(new StyledText("/","separator2")); - dummyText.add(new StyledText("2","totalSecrets")); - dummyText.add(new StyledText("+","unknown")); - } - - @Override - public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon(); - } - - @Override - public java.util.List<String> getUsedTextStyle() { - return Arrays.asList("title", "separator", "currentSecrets", "separator2", "totalSecrets", "unknown"); - } - - @Override - public java.util.List<StyledText> getDummyText() { - return dummyText; - } - - @Override - public java.util.List<StyledText> getText() { - List<StyledText> actualBit = new ArrayList<StyledText>(); - actualBit.add(new StyledText("Secrets","title")); - actualBit.add(new StyledText(": ","separator")); - actualBit.add(new StyledText(getSecretsFound() +"","currentSecrets")); - actualBit.add(new StyledText("/","separator2")); - actualBit.add(new StyledText((int)Math.ceil(getTotalSecretsInt() * DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext().getSecretPercentage())+" of "+getTotalSecretsInt(),"totalSecrets")); - actualBit.add(new StyledText(getTotalSecrets().contains("+") ? "+" : "","unknown")); - return actualBit; - } - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java deleted file mode 100644 index 59c669bf..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.scoreboard.ScorePlayerTeam; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class FeatureDungeonTombs extends TextHUDFeature { - public FeatureDungeonTombs() { - super("Dungeon.Dungeon Information", "Display # of Crypts", "Display how much total crypts have been blown up in a dungeon run", "dungeon.stats.tombs", true, getFontRenderer().getStringWidth("Crypts: 42"), getFontRenderer().FONT_HEIGHT); - this.setEnabled(false); - getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("number", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - public int getTombsFound() { - for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { - String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); - if (name.startsWith("§r Crypts: §r§6")) { - return Integer.parseInt(TextUtils.stripColor(name).substring(9)); - } - } - return 0; - } - - private static final java.util.List<StyledText> dummyText= new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("Crypts","title")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("42","number")); - } - - @Override - public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon(); - } - - @Override - public java.util.List<String> getUsedTextStyle() { - return Arrays.asList("title", "separator", "number"); - } - - @Override - public java.util.List<StyledText> getDummyText() { - return dummyText; - } - - @Override - public java.util.List<StyledText> getText() { - List<StyledText> actualBit = new ArrayList<StyledText>(); - actualBit.add(new StyledText("Crypts","title")); - actualBit.add(new StyledText(": ","separator")); - actualBit.add(new StyledText(getTombsFound()+"","number")); - return actualBit; - } - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureHideNameTags.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureHideNameTags.java deleted file mode 100644 index b8985a78..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureHideNameTags.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.EntityLivingRenderListener; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import net.minecraft.entity.item.EntityArmorStand; -import net.minecraftforge.client.event.RenderLivingEvent; - - -public class FeatureHideNameTags extends SimpleFeature implements EntityLivingRenderListener { - public FeatureHideNameTags() { - super("Dungeon.Mobs", "Hide mob nametags", "Hide mob nametags in dungeon", "dungeon.hidenametag", false); - } - - - private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - @Override - public void onEntityRenderPre(RenderLivingEvent.Pre renderPlayerEvent) { - if (!isEnabled()) return; - if (!skyblockStatus.isOnDungeon()) return; - - if (renderPlayerEvent.entity instanceof EntityArmorStand) { - EntityArmorStand armorStand = (EntityArmorStand) renderPlayerEvent.entity; - if (armorStand.getAlwaysRenderNameTag()) - renderPlayerEvent.setCanceled(true); - } - } - - @Override - public void onEntityRenderPost(RenderLivingEvent.Post renderPlayerEvent) { - - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePlayerESP.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePlayerESP.java deleted file mode 100644 index 273a9bca..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePlayerESP.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.PlayerRenderListener; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import net.minecraft.client.entity.AbstractClientPlayer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.client.event.RenderPlayerEvent; -import org.lwjgl.opengl.GL11; - - -public class FeaturePlayerESP extends SimpleFeature implements PlayerRenderListener { - public FeaturePlayerESP() { - super("Dungeon.Teammates", "See players through walls", "See players through walls", "dungeon.playeresp", false); - setEnabled(false); - } - - - private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - private boolean preCalled = false; - @Override - public void onEntityRenderPre(RenderPlayerEvent.Pre renderPlayerEvent) { - - - if (preCalled) return; - if (!isEnabled()) return; - - - DungeonContext dungeonContext = skyblockStatus.getContext(); - if (dungeonContext == null) return; - if (!dungeonContext.getPlayers().contains(renderPlayerEvent.entityPlayer.getName())) { - return; - } - - preCalled = true; - - GL11.glEnable(GL11.GL_STENCIL_TEST); - GL11.glClearStencil(0); - GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT); - - GL11.glStencilMask(0xFF); - GL11.glStencilFunc(GL11.GL_ALWAYS, 1, 0xFF); - GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_REPLACE, GL11.GL_REPLACE); - - EntityPlayer entity = renderPlayerEvent.entityPlayer; - InventoryPlayer inv = entity.inventory; - ItemStack[] armor = inv.armorInventory; - inv.armorInventory = new ItemStack[4]; - ItemStack[] hand = inv.mainInventory; - inv.mainInventory = new ItemStack[36]; - - float f = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * renderPlayerEvent.partialRenderTick; - try { - renderPlayerEvent.renderer.doRender((AbstractClientPlayer) renderPlayerEvent.entityPlayer, renderPlayerEvent.x, renderPlayerEvent.y, renderPlayerEvent.z, f, renderPlayerEvent.partialRenderTick); - } catch (Throwable t) {} - - GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP); - GL11.glStencilFunc(GL11.GL_NOTEQUAL, 1, 0xff); - GL11.glDepthMask(false); - GL11.glDepthFunc(GL11.GL_GEQUAL); - - GlStateManager.pushMatrix(); - GlStateManager.translate(renderPlayerEvent.x, renderPlayerEvent.y + 0.9, renderPlayerEvent.z); - GlStateManager.scale(1.2f, 1.1f, 1.2f); - renderPlayerEvent.renderer.setRenderOutlines(true); - try { - renderPlayerEvent.renderer.doRender((AbstractClientPlayer) renderPlayerEvent.entityPlayer, 0,-0.9,0, f, renderPlayerEvent.partialRenderTick); - } catch (Throwable t) {} - - renderPlayerEvent.renderer.setRenderOutlines(false); - GL11.glDepthFunc(GL11.GL_LEQUAL); - GlStateManager.popMatrix(); - - GL11.glDisable(GL11.GL_STENCIL_TEST); // Turn this shit off! - - inv.armorInventory = armor; - inv.mainInventory = hand; - - preCalled = false; - - } - - @Override - public void onEntityRenderPost(RenderPlayerEvent.Post renderPlayerEvent) { - } - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java deleted file mode 100644 index ffff3a08..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeaturePressAnyKeyToCloseChest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.features.listener.GuiClickListener; -import kr.syeyoung.dungeonsguide.features.listener.KeyInputListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.impl.boss.FeatureChestPrice; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.IInventory; -import net.minecraftforge.client.event.GuiScreenEvent; -import org.lwjgl.input.Mouse; - -public class FeaturePressAnyKeyToCloseChest extends SimpleFeature implements KeyInputListener, GuiClickListener { - public FeaturePressAnyKeyToCloseChest() { - super("Dungeon", "Press Any Mouse Button or Key to close Secret Chest", "dungeon.presskeytoclose"); - parameters.put("threshold", new FeatureParameter<Integer>("threshold", "Price Threshold", "The maximum price of item for chest to be closed. Default 1m", 1000000, "integer")); - } - - @Override - public void onKeyInput(GuiScreenEvent.KeyboardInputEvent keyboardInputEvent) { - GuiScreen screen = Minecraft.getMinecraft().currentScreen; - if (!isEnabled()) return; - if (!DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; - - if (screen instanceof GuiChest){ - ContainerChest ch = (ContainerChest) ((GuiChest)screen).inventorySlots; - if (!("Large Chest".equals(ch.getLowerChestInventory().getName()) - || "Chest".equals(ch.getLowerChestInventory().getName()))) return; - IInventory actualChest = ch.getLowerChestInventory(); - - int priceSum = 0; - for (int i = 0; i < actualChest.getSizeInventory(); i++) { - priceSum += FeatureChestPrice.getPrice(actualChest.getStackInSlot(i)); - } - - int threshold = this.<Integer>getParameter("threshold").getValue(); - if (priceSum < threshold) { - Minecraft.getMinecraft().thePlayer.closeScreen(); - } - } - } - - @Override - public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) { - GuiScreen screen = Minecraft.getMinecraft().currentScreen; - if (!isEnabled()) return; - if (!DungeonsGuide.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return; - if (Mouse.getEventButton() == -1) return; - - if (screen instanceof GuiChest){ - ContainerChest ch = (ContainerChest) ((GuiChest)screen).inventorySlots; - if (!("Large Chest".equals(ch.getLowerChestInventory().getName()) - || "Chest".equals(ch.getLowerChestInventory().getName()))) return; - IInventory actualChest = ch.getLowerChestInventory(); - - int priceSum = 0; - for (int i = 0; i < actualChest.getSizeInventory(); i++) { - priceSum += FeatureChestPrice.getPrice(actualChest.getStackInSlot(i)); - } - - int threshold = this.<Integer>getParameter("threshold").getValue(); - if (priceSum < threshold) { - Minecraft.getMinecraft().thePlayer.closeScreen(); - } - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java deleted file mode 100644 index 15f02e86..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWarnLowHealth.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.scoreboard.Score; -import net.minecraft.scoreboard.ScoreObjective; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.scoreboard.Scoreboard; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - - -public class FeatureWarnLowHealth extends TextHUDFeature { - public FeatureWarnLowHealth() { - super("Dungeon.Teammates", "Low Health Warning", "Warn if someone is on low health", "dungeon.lowhealthwarn", false, 500, 20); - parameters.put("threshold", new FeatureParameter<Integer>("threshold", "Health Threshold", "Health Threshold for this feature to be toggled. default to 500", 500, "integer")); - getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("number", new AColor(0xFF, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("unit", new AColor(0xFF, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - setEnabled(false); - } - - - private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - - @Override - public boolean isHUDViewable() { - return skyblockStatus.isOnDungeon(); - } - - @Override - public List<String> getUsedTextStyle() { - return Arrays.asList("title", "separator", "number", "unit"); - } - - private static final java.util.List<StyledText> dummyText= new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("DungeonsGuide","title")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("500","number")); - dummyText.add(new StyledText("hp","unit")); - } - - @Override - public List<StyledText> getDummyText() { - return dummyText; - } - - @Override - public List<StyledText> getText() { - String lowestHealthName = ""; - int lowestHealth = 999999999; - Scoreboard scoreboard = Minecraft.getMinecraft().thePlayer.getWorldScoreboard(); - ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); - for (Score sc : scoreboard.getSortedScores(objective)) { - ScorePlayerTeam scorePlayerTeam = scoreboard.getPlayersTeam(sc.getPlayerName()); - String line = ScorePlayerTeam.formatPlayerName(scorePlayerTeam, sc.getPlayerName()).trim(); - String stripped = TextUtils.keepScoreboardCharacters(TextUtils.stripColor(line)); - if (line.contains("[") && line.endsWith("❤")) { - String name = stripped.split(" ")[stripped.split(" ").length - 2]; - int health = Integer.parseInt(stripped.split(" ")[stripped.split(" ").length - 1]); - if (health < lowestHealth) { - lowestHealth = health; - lowestHealthName = name; - } - } - } - if (lowestHealth > this.<Integer>getParameter("threshold").getValue()) return new ArrayList<StyledText>(); - - List<StyledText> actualBit = new ArrayList<StyledText>(); - actualBit.add(new StyledText(lowestHealthName,"title")); - actualBit.add(new StyledText(": ","separator")); - actualBit.add(new StyledText(lowestHealth+"","number")); - actualBit.add(new StyledText("hp","unit")); - return actualBit; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWatcherWarning.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWatcherWarning.java deleted file mode 100644 index bc48d51f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureWatcherWarning.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.dungeon; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonEndListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -public class FeatureWatcherWarning extends TextHUDFeature implements ChatListener, DungeonEndListener { - - public FeatureWatcherWarning() { - super("Dungeon.Blood Room","Watcher Spawn Alert", "Alert when watcher says 'That will be enough for now'", "dungen.watcherwarn", true, getFontRenderer().getStringWidth("Watcher finished spawning all mobs!"), getFontRenderer().FONT_HEIGHT); - getStyles().add(new TextStyle("warning", new AColor(0xFF, 0x69,0x17,255), new AColor(0, 0,0,0), false)); - setEnabled(false); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override - public boolean isHUDViewable() { - return warning > System.currentTimeMillis(); - } - - @Override - public List<String> getUsedTextStyle() { - return Collections.singletonList("warning"); - } - - private final UUID lastRoomUID = UUID.randomUUID(); - private long warning = 0; - - private static final List<StyledText> text = new ArrayList<StyledText>(); - static { - text.add(new StyledText("Watcher finished spawning all mobs!", "warning")); - } - - @Override - public List<StyledText> getText() { - return text; - } - - @Override - public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { - if (clientChatReceivedEvent.message.getFormattedText().equals("§r§c[BOSS] The Watcher§r§f: That will be enough for now.§r")) { - warning = System.currentTimeMillis() + 2500; - DungeonContext context = skyblockStatus.getContext(); - if (context ==null) return; - for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { - if (dungeonRoom != null && dungeonRoom.getColor() == 18) - dungeonRoom.setCurrentState(DungeonRoom.RoomState.DISCOVERED); - } - } - } - - @Override - public void onDungeonEnd() { - warning = 0; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureAutoAcceptReparty.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureAutoAcceptReparty.java deleted file mode 100644 index 7be4b22b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureAutoAcceptReparty.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.etc; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.chat.ChatProcessor; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -public class FeatureAutoAcceptReparty extends SimpleFeature implements ChatListener { - public FeatureAutoAcceptReparty() { - super("Party.Reparty", "Auto accept reparty", "Automatically accept reparty", "qol.autoacceptreparty", true); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - private String lastDisband; - @Override - public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { - if (clientChatReceivedEvent.message.getFormattedText().endsWith("§ehas disbanded the party!§r")) { - lastDisband = null; - String[] texts = TextUtils.stripColor(clientChatReceivedEvent.message.getFormattedText()).split(" "); - for (String s : texts) { - if (s.isEmpty()) continue; - if (s.startsWith("[")) continue; - if (s.equalsIgnoreCase("has")) break; - lastDisband = s; - break; - } - } else if (clientChatReceivedEvent.message.getFormattedText().contains("§ehas invited you to join their party!")) { - String[] texts = TextUtils.stripColor(clientChatReceivedEvent.message.getFormattedText()).split(" "); - boolean equals = false; - for (String s : texts) { - if (s.isEmpty()) continue; - if (s.startsWith("[")) continue; - if (s.equalsIgnoreCase("has")) continue; - if (s.equalsIgnoreCase(lastDisband)) { - equals = true; - break; - } - } - - if (equals && isEnabled()) { - ChatProcessor.INSTANCE.addToChatQueue("/p accept " + lastDisband, () -> {}, true); - lastDisband = null; - } - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java deleted file mode 100644 index 5499353a..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCooldownCounter.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.etc; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.DungeonQuitListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiOpenListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.inventory.ContainerChest; -import net.minecraftforge.client.event.GuiOpenEvent; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class FeatureCooldownCounter extends TextHUDFeature implements DungeonQuitListener, GuiOpenListener { - public FeatureCooldownCounter() { - super("Dungeon", "Dungeon Cooldown Counter", "Counts 10 seconds after leaving dungeon", "qol.cooldown", true, getFontRenderer().getStringWidth("Cooldown: 10s "), getFontRenderer().FONT_HEIGHT); - getStyles().add(new TextStyle("title", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("number", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - } - - private long leftDungeonTime = 0L; - - private static final java.util.List<StyledText> dummyText= new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("Cooldown","title")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("20s","number")); - } - - @Override - public List<StyledText> getDummyText() { - return dummyText; - } - - @Override - public boolean isHUDViewable() { - return System.currentTimeMillis() - leftDungeonTime < 20000; - } - - @Override - public java.util.List<String> getUsedTextStyle() { - return Arrays.asList("title", "separator", "number"); - } - - @Override - public List<StyledText> getText() { - List<StyledText> actualBit = new ArrayList<StyledText>(); - actualBit.add(new StyledText("Cooldown","title")); - actualBit.add(new StyledText(": ","separator")); - actualBit.add(new StyledText((20 - (System.currentTimeMillis() - leftDungeonTime) / 1000)+"s","number")); - return actualBit; - } - - @Override - public boolean doesScaleWithHeight() { - return true; - } - - @Override - public void onDungeonQuit() { - leftDungeonTime = System.currentTimeMillis(); - } - - @Override - public void onGuiOpen(GuiOpenEvent rendered) { - if (!(rendered.gui instanceof GuiChest)) return; - ContainerChest chest = (ContainerChest) ((GuiChest) rendered.gui).inventorySlots; - if (chest.getLowerChestInventory().getName().contains("On cooldown!")) { - leftDungeonTime = System.currentTimeMillis(); - } else if (chest.getLowerChestInventory().getName().contains("Error")) { - leftDungeonTime = System.currentTimeMillis(); - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCopyMessages.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCopyMessages.java deleted file mode 100644 index d2b23e48..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureCopyMessages.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.etc; - -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.event.ClickEvent; -import net.minecraft.event.HoverEvent; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChatStyle; -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -public class FeatureCopyMessages extends SimpleFeature implements ChatListener { - public FeatureCopyMessages() { - super("Misc.Chat", "Copy Chat Messages", "Click on copy to copy", "etc.copymsg"); - setEnabled(false); - } - @Override - public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { - if (!isEnabled()) return; - if (clientChatReceivedEvent.type == 2) return; - - clientChatReceivedEvent.message.appendSibling(new ChatComponentText(" §7[Copy]").setChatStyle(new ChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, TextUtils.stripColor(clientChatReceivedEvent.message.getFormattedText()))).setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText("§eCopy Message"))))); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDecreaseExplosionSound.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDecreaseExplosionSound.java deleted file mode 100644 index 2786ca53..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDecreaseExplosionSound.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.etc; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.SoundListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraftforge.client.event.sound.PlaySoundEvent; - -public class FeatureDecreaseExplosionSound extends SimpleFeature implements SoundListener { - public FeatureDecreaseExplosionSound() { - super("Misc", "Decrease Explosion sound effect", "Decreases volume of explosions while on skyblock", "qol.explosionsound"); - parameters.put("sound", new FeatureParameter<Float>("sound", "Sound Multiplier %", "The volume of explosion effect will be multiplied by this value. 0~100", 10.0f, "float")); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - @Override - public void onSound(PlaySoundEvent soundEvent) { - if (!skyblockStatus.isOnSkyblock()) return; - - if (soundEvent.name.equalsIgnoreCase("random.explode") && soundEvent.result instanceof PositionedSoundRecord) { - PositionedSoundRecord positionedSoundRecord = (PositionedSoundRecord) soundEvent.result; - PositionedSoundRecord neweff = new PositionedSoundRecord( - positionedSoundRecord.getSoundLocation(), - positionedSoundRecord.getVolume() * (this.<Float>getParameter("sound").getValue() / 100), - positionedSoundRecord.getPitch(), - positionedSoundRecord.getXPosF(), - positionedSoundRecord.getYPosF(), - positionedSoundRecord.getZPosF() - ); - - soundEvent.result = neweff; - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java deleted file mode 100644 index 0e65f849..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureDisableMessage.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.etc; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import lombok.AllArgsConstructor; -import lombok.Data; -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -import java.util.regex.Pattern; - -public class FeatureDisableMessage extends SimpleFeature implements ChatListener { - @Data - @AllArgsConstructor - public static class MessageData { - private Pattern pattern; - private String name; - private String description; - private String key; - } - - private static final MessageData[] PRE_DEFINED = new MessageData[] { - new MessageData(Pattern.compile("§r§cThere are blocks in the way!§r"), "Aote block message", "\"There are blocks in the way!\"", "aote"), - new MessageData(Pattern.compile("§r§cThis ability is currently on cooldown for .+ more seconds?\\.§r"), "Ability cooldown message", "\"This ability is currently on cooldown for 3 more seconds.\"", "cooldown"), - new MessageData(Pattern.compile("§r§cThis ability is on cooldown for .+s\\.§r"), "Ability cooldown message2", "\"This ability is on cooldown for 3s.\"", "cooldown2"), - new MessageData(Pattern.compile("§r§cWhow! Slow down there!§r"), "Grappling hook cooldown", "\"Whow! Slow down there!\"", "grappling"), - new MessageData(Pattern.compile("§r§cNo more charges, next one in §r§e.+§r§cs!§r"), "Zombie Sword Charging", "\"No more charges, next one in 3s!\"", "zombie"), - new MessageData(Pattern.compile("§r§7Your .+ hit §r§c.+ §r§7enem(?:y|ies) for §r§c.+ §r§7damage\\.§r"), "Ability Damage", "\"Your blahblah hit 42 enemy for a lots of damage\"", "ability"), - new MessageData(Pattern.compile("§r§cYou do not have enough mana to do this!§r"), "Not enough mana", "\"You do not have enough mana to do this!\"", "mana"), - new MessageData(Pattern.compile("§r§aUsed §r.+§r§a!§r"), "Dungeon Ability Usage", "\"Used Guided Sheep!\" and such", "dungeonability"), - new MessageData(Pattern.compile("§r.+§r§a is ready to use! Press §r.+§r§a to activate it!§r"), "Ready to use message", "\"Blah is ready to use! Press F to activate it!", "readytouse"), - new MessageData(Pattern.compile("§r.+ §r§ais now available!§r"), "Ability Available","\"blah is now available!\"", "available"), - new MessageData(Pattern.compile("§r§cThe Stone doesn't seem to do anything here\\.§r"), "Stone Message", "\"The Stone doesn't seem to do anything here\"", "stone"), - new MessageData(Pattern.compile("§r§cNo target found!§r"), "Voodoo Doll No Target", "\"No target found!\"", "voodotarget") - }; - - public FeatureDisableMessage() { - super("Misc.Chat", "Disable ability messages", "Do not let ability messages show up in chatbox\nclick on Edit for more precise settings", "fixes.messagedisable", true); - for (MessageData messageData : PRE_DEFINED) { - this.parameters.put(messageData.key, new FeatureParameter<Boolean>(messageData.key, messageData.name, messageData.description, true, "boolean")); - } - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - @Override - public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { - if (clientChatReceivedEvent.type == 2) return; - if (!isEnabled()) return; - if (!skyblockStatus.isOnSkyblock()) return; - String msg = clientChatReceivedEvent.message.getFormattedText(); - for (MessageData md:PRE_DEFINED) { - if (this.<Boolean>getParameter(md.key).getValue() && md.pattern.matcher(msg).matches()) { - clientChatReceivedEvent.setCanceled(true); - return; - } - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeaturePenguins.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeaturePenguins.java deleted file mode 100644 index ce65a273..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeaturePenguins.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.etc; - -import com.google.common.collect.ImmutableMap; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.PlayerRenderListener; -import kr.syeyoung.dungeonsguide.features.listener.TextureStichListener; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.AbstractClientPlayer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.*; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.event.RenderPlayerEvent; -import net.minecraftforge.client.event.TextureStitchEvent; -import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.client.model.obj.OBJLoader; -import net.minecraftforge.client.model.obj.OBJModel; - -import java.io.IOException; - - -public class FeaturePenguins extends SimpleFeature implements PlayerRenderListener, TextureStichListener { - public FeaturePenguins() { - super("Misc", "Penguins", "Awwww", "etc.penguin", false); - OBJLoader.instance.addDomain("dungeonsguide"); - - } - @Override - public void onTextureStitch(TextureStitchEvent event) { - if (event instanceof TextureStitchEvent.Pre) { - objModel = null; - ResourceLocation modelResourceLocation = new ResourceLocation("dungeonsguide:models/penguin.obj"); - try { - objModel = (OBJModel) OBJLoader.instance.loadModel(modelResourceLocation); - objModel = (OBJModel) objModel.process(new ImmutableMap.Builder<String, String>().put("flip-v", "true").build()); - for (String obj : objModel.getMatLib().getMaterialNames()) { - ResourceLocation resourceLocation = objModel.getMatLib().getMaterial(obj).getTexture().getTextureLocation(); - event.map.registerSprite(resourceLocation); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - if (objModel != null && event instanceof TextureStitchEvent.Post) { - model = objModel.bake(objModel.getDefaultState(), DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter()); - } - } - - - private OBJModel objModel; - private final SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - private IBakedModel model; - - @Override - public void onEntityRenderPre(RenderPlayerEvent.Pre renderPlayerEvent) { - - if (!isEnabled()) return; - if (renderPlayerEvent.entityPlayer.isInvisible()) return; - renderPlayerEvent.setCanceled(true); - GlStateManager.pushMatrix(); - GlStateManager.color(1,1,1,1); - GlStateManager.translate(renderPlayerEvent.x, renderPlayerEvent.y, renderPlayerEvent.z); - if (renderPlayerEvent.entityPlayer.isSneaking()) - { - GlStateManager.translate(0.0F, -0.203125F, 0.0F); - } - float f1 = renderPlayerEvent.entityPlayer.prevRotationYawHead + (renderPlayerEvent.entityPlayer.rotationYawHead - renderPlayerEvent.entityPlayer.prevRotationYawHead) * renderPlayerEvent.partialRenderTick; - GlStateManager.rotate(f1+180,0,-1,0); - Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture); - - Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor( - model, 1,1,1,1 - ); - GlStateManager.popMatrix(); - - - EntityPlayer entitylivingbaseIn = renderPlayerEvent.entityPlayer; - { - ItemStack itemstack = entitylivingbaseIn.getHeldItem(); - - if (itemstack != null) - { - GlStateManager.pushMatrix(); - GlStateManager.translate(renderPlayerEvent.x, renderPlayerEvent.y, renderPlayerEvent.z); - if (renderPlayerEvent.entityPlayer.isSneaking()) - { - GlStateManager.translate(0.0F, -0.203125F, 0.0F); - } - GlStateManager.rotate(f1+180, 0.0f, -1.0f, 0.0f); - GlStateManager.translate(0,1.30 ,-0.5); - - - - if (entitylivingbaseIn.fishEntity != null) - { - itemstack = new ItemStack(Items.fishing_rod, 0); - } - - Item item = itemstack.getItem(); - Minecraft minecraft = Minecraft.getMinecraft(); - - GlStateManager.rotate(180, 0.0f, 0.0f, 1.0f); - if (item.isFull3D()) { - GlStateManager.translate(0.05,0,0); - GlStateManager.rotate(90, 0.0f, 0.0f, 1.0f); - GlStateManager.rotate(-45, 1.0f, 0.0f, 0.0f); - } else if (item instanceof ItemBow) { - GlStateManager.translate(0,0.1, -0); - GlStateManager.rotate(90, 0.0f, 1.0f, 0.0f); - GlStateManager.rotate(-90, 0.0f, 0.0f, 1.0f); - } else if (item instanceof ItemBlock && Block.getBlockFromItem(item).getRenderType() == 2) { - GlStateManager.translate(0,-0.20,0.1); - GlStateManager.translate(0.0F, 0.1875F, -0.3125F); - GlStateManager.rotate(-25.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F); - f1 = 0.375F; - GlStateManager.scale(-f1, -f1, f1); - } else if (item instanceof ItemBlock) { - GlStateManager.translate(0.0F, 0.05, 0.1); - GlStateManager.rotate(-25.0F, 1.0F, 0.0F, 0.0F); - } else { - GlStateManager.translate(0,-0.1, 0.1); - } - - GlStateManager.scale(0.8,0.8,0.8); - - minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.THIRD_PERSON); - GlStateManager.popMatrix(); - } - } - - - renderPlayerEvent.renderer.renderName((AbstractClientPlayer) renderPlayerEvent.entityPlayer, renderPlayerEvent.x, renderPlayerEvent.y, renderPlayerEvent.z); - - - } - - @Override - public void onEntityRenderPost(RenderPlayerEvent.Post renderPlayerEvent) { - } - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureRepartyCommand.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureRepartyCommand.java deleted file mode 100644 index e4eb8a22..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureRepartyCommand.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.etc; - -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -public class FeatureRepartyCommand extends SimpleFeature { - public FeatureRepartyCommand() { - super("Party.Reparty", "Enable Reparty Command From DG", "if you disable, /dg reparty will still work, Auto reparty will still work\nRequires Restart to get applied", "qol.reparty"); - parameters.put("command", new FeatureParameter<String>("command", "The Command", "Command that the reparty will be bound to", "reparty", "string")); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipDungeonStat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipDungeonStat.java deleted file mode 100644 index 533400aa..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipDungeonStat.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.etc; - -import kr.syeyoung.dungeonsguide.features.listener.TooltipListener; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; - -public class FeatureTooltipDungeonStat extends SimpleFeature implements TooltipListener { - public FeatureTooltipDungeonStat() { - super("Misc", "Dungeon Item Stats", "Shows quality of dungeon items (floor, percentage)", "tooltip.dungeonitem"); - } - - @Override - public void onTooltip(ItemTooltipEvent event) { - if (!isEnabled()) return; - - ItemStack hoveredItem = event.itemStack; - NBTTagCompound compound = hoveredItem.getTagCompound(); - if (compound == null) - return; - if (!compound.hasKey("ExtraAttributes")) - return; - NBTTagCompound nbtTagCompound = compound.getCompoundTag("ExtraAttributes"); - - int floor = nbtTagCompound.getInteger("item_tier"); - int percentage = nbtTagCompound.getInteger("baseStatBoostPercentage"); - - if (nbtTagCompound.hasKey("item_tier")) - event.toolTip.add("§7Obtained in: §c"+(floor == 0 ? "Entrance" : "Floor "+floor)); - if (nbtTagCompound.hasKey("baseStatBoostPercentage")) - event.toolTip.add("§7Stat Percentage: §"+(percentage == 50 ? "6§l":"c")+(percentage * 2)+"%"); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipPrice.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipPrice.java deleted file mode 100644 index aaf4c01b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureTooltipPrice.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.etc; - -import kr.syeyoung.dungeonsguide.features.listener.TooltipListener; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.AhUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; -import org.lwjgl.input.Keyboard; - -import java.util.Comparator; -import java.util.Set; -import java.util.TreeSet; - -public class FeatureTooltipPrice extends SimpleFeature implements TooltipListener { - public FeatureTooltipPrice() { - super("Misc.API Features", "Item Price", "Shows price of items", "tooltip.price"); - parameters.put("reqShift", new FeatureParameter<Boolean>("reqShift", "Require Shift", "If shift needs to be pressed in order for this feature to be activated", false, "boolean")); - setEnabled(false); - } - - @Override - public void onTooltip(ItemTooltipEvent event) { - if (!isEnabled()) return; - - boolean activated = !this.<Boolean>getParameter("reqShift").getValue() || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); - - ItemStack hoveredItem = event.itemStack; - NBTTagCompound compound = hoveredItem.getTagCompound(); - if (compound == null) - return; - if (!compound.hasKey("ExtraAttributes")) - return; - if (!activated) { - event.toolTip.add("§7Shift to view price"); - return; - } - - final String id = compound.getCompoundTag("ExtraAttributes").getString("id"); - if (id.equals("ENCHANTED_BOOK")) { - final NBTTagCompound enchants = compound.getCompoundTag("ExtraAttributes").getCompoundTag("enchantments"); - Set<String> keys = enchants.getKeySet(); - Set<String> actualKeys = new TreeSet<String>(new Comparator<String>() { - public int compare(String o1, String o2) { - String id2 = id + "::" + o1 + "-" + enchants.getInteger(o1); - AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2); - long price1 = (auctionData == null) ? 0 : auctionData.lowestBin; - String id3 = id + "::" + o2 + "-" + enchants.getInteger(o2); - AhUtils.AuctionData auctionData2 = AhUtils.auctions.get(id3); - long price2 = (auctionData2 == null) ? 0 : auctionData2.lowestBin; - return (compare2(price1, price2) == 0) ? o1.compareTo(o2) : compare2(price1, price2); - } - - public int compare2(long y, long x) { - return (x < y) ? -1 : ((x == y) ? 0 : 1); - } - }); - actualKeys.addAll(keys); - int totalLowestPrice = 0; - int iterations = 0; - for (String key : actualKeys) { - iterations++; - String id2 = id + "::" + key + "-" + enchants.getInteger(key); - AhUtils.AuctionData auctionData = AhUtils.auctions.get(id2); - if (auctionData == null) { - if (iterations < 10) - event.toolTip.add("§f"+ key + " " + enchants.getInteger(key) + "§7: §cn/a"); - continue; - } - if (iterations < 10) - event.toolTip.add("§f"+ key + " " + enchants.getInteger(key) + "§7: §e"+ TextUtils.format( auctionData.lowestBin)); - totalLowestPrice += auctionData.lowestBin; - } - if (iterations >= 10) - event.toolTip.add("§7"+ (iterations - 10) + " more enchants... "); - event.toolTip.add("§fTotal Lowest§7: §e"+ TextUtils.format(totalLowestPrice)); - } else { - AhUtils.AuctionData auctionData = AhUtils.auctions.get(id); - event.toolTip.add(""); - if (auctionData == null) { - event.toolTip.add("§fLowest ah §7: §cn/a"); - event.toolTip.add("§fBazaar sell price §7: §cn/a"); - event.toolTip.add("§fBazaar buy price §7: §cn/a"); - } else { - event.toolTip.add("§fLowest ah §7: " + ((auctionData.lowestBin != -1) ? ("§e"+ TextUtils.format(auctionData.lowestBin)) : "§cn/a")); - event.toolTip.add("§fBazaar sell price §7: " + ((auctionData.sellPrice == -1) ? "§cn/a": ("§e"+ TextUtils.format(auctionData.sellPrice)))); - event.toolTip.add("§fBazaar buy price §7: " + ((auctionData.buyPrice == -1) ? "§cn/a": ("§e"+ TextUtils.format(auctionData.buyPrice)))); - } - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureUpdateAlarm.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureUpdateAlarm.java deleted file mode 100644 index eec4b40b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/FeatureUpdateAlarm.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.etc; - -import kr.syeyoung.dungeonsguide.features.listener.StompConnectedListener; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.events.StompConnectedEvent; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.stomp.StompInterface; -import kr.syeyoung.dungeonsguide.stomp.StompMessageHandler; -import kr.syeyoung.dungeonsguide.stomp.StompPayload; -import kr.syeyoung.dungeonsguide.stomp.StompSubscription; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ChatComponentText; - -public class FeatureUpdateAlarm extends SimpleFeature implements StompConnectedListener, StompMessageHandler, TickListener { - public FeatureUpdateAlarm() { - super("Misc", "Update Alarm","Show a warning in chat when a version has been released.", "etc.updatealarm", true); - } - - private StompPayload stompPayload; - @Override - public void handle(StompInterface stompInterface, StompPayload stompPayload) { - this.stompPayload = stompPayload; - } - - @Override - public void onTick() { - if (stompPayload != null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(stompPayload.payload())); - stompPayload = null; - Minecraft.getMinecraft().thePlayer.playSound("random.successful_hit", 1f,1f); - } - } - - @Override - public void onStompConnected(StompConnectedEvent event) { - event.getStompInterface().subscribe(StompSubscription.builder() - .destination("/topic/updates") - .ackMode(StompSubscription.AckMode.AUTO) - .stompMessageHandler(this).build()); - event.getStompInterface().subscribe(StompSubscription.builder() - .destination("/user/queue/messages") - .ackMode(StompSubscription.AckMode.AUTO) - .stompMessageHandler(this).build()); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/FeatureAbilityCooldown.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/FeatureAbilityCooldown.java deleted file mode 100644 index 667b1cd4..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/FeatureAbilityCooldown.java +++ /dev/null @@ -1,402 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.etc.ability; - -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class FeatureAbilityCooldown extends TextHUDFeature implements ChatListener, TickListener { - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - public FeatureAbilityCooldown() { - super("Misc", "View Ability Cooldowns", "A handy hud for viewing cooldown abilities", "etc.abilitycd2", false, 100, getFontRenderer().FONT_HEIGHT * 5); - getStyles().add(new TextStyle("abilityname", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("number", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("unit",new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("ready",new AColor(0xDF, 0x00,0x67,255), new AColor(0, 0,0,0), false)); - this.parameters.put("disable", new FeatureParameter<Boolean>("disable", "Disable outside of dungeon", "Disable the feature when out of dungeon", false, "boolean")); - this.parameters.put("decimal", new FeatureParameter<Integer>("decimal", "Decimal places", "ex) 2 -> Cooldown: 3.21 3-> Cooldown: 3.210", 0, "integer")); - } - - @Override - public boolean isHUDViewable() { - return skyblockStatus.isOnSkyblock() && (!this.<Boolean>getParameter("disable").getValue() || (this.<Boolean>getParameter("disable").getValue() && skyblockStatus.isOnDungeon())); - } - - @Override - public boolean doesScaleWithHeight() { - return false; - } - - @Override - public List<String> getUsedTextStyle() { - return Arrays.asList("abilityname", "separator", "number", "unit", "ready"); - } - - private static final List<StyledText> dummy = new ArrayList<>(); - - static { - dummy.add(new StyledText("Random Ability", "abilityname")); - dummy.add(new StyledText(": ", "separator")); - dummy.add(new StyledText("10", "number")); - dummy.add(new StyledText("s\n", "unit")); - dummy.add(new StyledText("Random Ability2", "abilityname")); - dummy.add(new StyledText(": ", "separator")); - dummy.add(new StyledText("10", "number")); - dummy.add(new StyledText("m ", "unit")); - dummy.add(new StyledText("9", "number")); - dummy.add(new StyledText("s\n", "unit")); - dummy.add(new StyledText("Random Ability", "abilityname")); - dummy.add(new StyledText(": ", "separator")); - dummy.add(new StyledText("READY", "ready")); - } - - @Override - public List<StyledText> getDummyText() { - return dummy; - } - - private static final Map<String, SkyblockAbility> skyblockAbilities = new HashMap<>(); - private static final Map<String, List<SkyblockAbility>> skyblockAbilitiesByItemID = new HashMap<>(); - - static { - register(new SkyblockAbility("Disgusting Healing", -1, -1, "REAPER_MASK")); - register(new SkyblockAbility("Spirit Leap", -1, 5, "SPIRIT_LEAP")); - register(new SkyblockAbility("Farmer's Grace", -1, -1, "RANCHERS_BOOTS")); - register(new SkyblockAbility("Raise Souls", -1, 1, "SUMMONING_RING")); - register(new SkyblockAbility("Instant Heal", 70, -1, "FLORID_ZOMBIE_SWORD")); - register(new SkyblockAbility("Phantom Impel", -1, -1, "PHANTOM_ROD")); - register(new SkyblockAbility("Implosion", 300, 10, "IMPLOSION_SCROLL")); - register(new SkyblockAbility("Parley", -1, 5, "ASPECT_OF_THE_JERRY")); - register(new SkyblockAbility("Guided Bat", 250, -1, "BAT_WAND")); - register(new SkyblockAbility("Bat Swarm", -1, -1, "WITCH_MASK")); - register(new SkyblockAbility("Flay", -1, -1, "SOUL_WHIP")); - register(new SkyblockAbility("Instant Heal", 70, -1, "ZOMBIE_SWORD")); - register(new SkyblockAbility("Mithril's Protection", -1, -1, "MITHRIL_COAT")); - register(new SkyblockAbility("Second Wind", -1, 30, "SPIRIT_MASK")); - register(new SkyblockAbility("Love Tap", -1, -1, "ZOMBIE_SOLDIER_CUTLASS")); - register(new SkyblockAbility("Spiky", -1, -1, "PUFFERFISH_HAT")); - register(new SkyblockAbility("Jingle Bells", -1, 1, "JINGLE_BELLS")); - register(new SkyblockAbility("Wither Shield", 150, 10, "WITHER_SHIELD_SCROLL")); - register(new SkyblockAbility("Wither Impact", 150, 5, "WITHER_SHIELD_SCROLL")); - register(new SkyblockAbility("Brute Force", -1, -1, "WARDEN_HELMET")); - register(new SkyblockAbility("Growth", -1, 4, "GROWTH_LEGGINGS")); - register(new SkyblockAbility("Shadowstep", -1, 60, "SILENT_DEATH")); - register(new SkyblockAbility("Creeper Veil", -1, -1, "WITHER_CLOAK")); - register(new SkyblockAbility("Ice Bolt", 50, -1, "FROZEN_SCYTHE")); - register(new SkyblockAbility("Rapid-fire", 10, -1, "JERRY_STAFF")); - register(new SkyblockAbility("Water Burst", 20, -1, "SALMON_HELMET_NEW")); - register(new SkyblockAbility("Mist Aura", -1, -1, "SORROW_BOOTS")); - register(new SkyblockAbility("Deploy", -1, -1, "RADIANT_POWER_ORB")); - register(new SkyblockAbility("Ice Spray", 50, 5, "ICE_SPRAY_WAND")); - register(new SkyblockAbility("Grand... Zapper?", -1, -1, "BLOCK_ZAPPER")); - register(new SkyblockAbility("Seek the King", -1, 5, "ROYAL_PIGEON")); - register(new SkyblockAbility("Mist Aura", -1, -1, "SORROW_CHESTPLATE")); - register(new SkyblockAbility("Healing Boost", -1, -1, "REVIVED_HEART")); - register(new SkyblockAbility("Deploy", -1, -1, "OVERFLUX_POWER_ORB")); - register(new SkyblockAbility("Swing", -1, -1, "BONE_BOOMERANG")); - register(new SkyblockAbility("Growth", -1, 4, "GROWTH_CHESTPLATE")); - register(new SkyblockAbility("Squash 'em", -1, -1, "RECLUSE_FANG")); - register(new SkyblockAbility("Roll em'", -1, -1, "PUMPKIN_DICER")); - register(new SkyblockAbility("Cleave", -1, -1, "SUPER_CLEAVER")); - register(new SkyblockAbility("Water Burst", 20, -1, "SALMON_BOOTS_NEW")); - register(new SkyblockAbility("Farmer's Delight", -1, -1, "BASKET_OF_SEEDS")); - register(new SkyblockAbility("Block Damage", -1, 60, "GUARDIAN_CHESTPLATE")); - register(new SkyblockAbility("Water Burst", 20, -1, "SALMON_LEGGINGS")); - register(new SkyblockAbility("Bone Shield", -1, -1, "SKELETON_HELMET")); - register(new SkyblockAbility("Iron Punch", 70, 3, "GOLEM_SWORD")); - register(new SkyblockAbility("Built-in Storage", -1, -1, "BUILDERS_WAND")); - register(new SkyblockAbility("Nasty Bite", -1, -1, "MOSQUITO_BOW")); - register(new SkyblockAbility("Ender Warp", 50, 45, "ENDER_BOW")); - register(new SkyblockAbility("Cleave", -1, -1, "CLEAVER")); - register(new SkyblockAbility("Party Time!", -1, -1, "PARTY_HAT_CRAB")); - register(new SkyblockAbility("Giant's Slam", 100, 30, "GIANTS_SWORD")); - register(new SkyblockAbility("Snow Placer", -1, -1, "SNOW_SHOVEL")); - register(new SkyblockAbility("Greed", -1, -1, "MIDAS_SWORD")); - register(new SkyblockAbility("Clownin' Around", -1, 316, "STARRED_BONZO_MASK")); - register(new SkyblockAbility("Weather", -1, 5, "WEATHER_STICK")); - register(new SkyblockAbility("ME SMASH HEAD", 100, -1, "EDIBLE_MACE")); - register(new SkyblockAbility("Splash", 10, 1, "FISH_HAT")); - register(new SkyblockAbility("Deploy", -1, -1, "PLASMAFLUX_POWER_ORB")); - register(new SkyblockAbility("Dragon Rage", 100, -1, "ASPECT_OF_THE_DRAGON")); - register(new SkyblockAbility("Burning Souls", 400, -1, "PIGMAN_SWORD")); - register(new SkyblockAbility("Water Burst", 20, -1, "SALMON_CHESTPLATE_NEW")); - register(new SkyblockAbility("Fire Blast", 150, 30, "EMBER_ROD")); - register(new SkyblockAbility("Commander Whip", -1, -1, "ZOMBIE_COMMANDER_WHIP")); - register(new SkyblockAbility("Spooktacular", -1, -1, "GHOUL_BUSTER")); - register(new SkyblockAbility("Cleave", -1, -1, "HYPER_CLEAVER")); - register(new SkyblockAbility("Leap", 50, 1, "SILK_EDGE_SWORD")); - register(new SkyblockAbility("Throw", 150, 5, "LIVID_DAGGER")); - register(new SkyblockAbility("Raise Souls", -1, 1, "NECROMANCER_SWORD")); - register(new SkyblockAbility("Double Jump", 50, -1, "SPIDER_BOOTS")); - register(new SkyblockAbility("Speed Boost", 50, -1, "ROGUE_SWORD")); - register(new SkyblockAbility("Spirit Glide", 250, 60, "THORNS_BOOTS")); - register(new SkyblockAbility("Sting", 100, -1, "STINGER_BOW")); - register(new SkyblockAbility("Roll em'", -1, -1, "MELON_DICER")); - register(new SkyblockAbility("Explosive Shot", -1, -1, "EXPLOSIVE_BOW")); - register(new SkyblockAbility("Heat-Seeking Rose", 35, 1, "FLOWER_OF_TRUTH")); - register(new SkyblockAbility("Small Heal", 60, 1, "WAND_OF_HEALING")); - register(new SkyblockAbility("Dreadlord", 40, -1, "CRYPT_DREADLORD_SWORD")); - register(new SkyblockAbility("Shadow Fury", -1, 15, "STARRED_SHADOW_FURY")); - register(new SkyblockAbility("Double Jump", 40, -1, "TARANTULA_BOOTS")); - register(new SkyblockAbility("Acupuncture", 200, 5, "VOODOO_DOLL")); - register(new SkyblockAbility("Showtime", 100, -1, "STARRED_BONZO_STAFF")); - register(new SkyblockAbility("Heartstopper", -1, -1, "SCORPION_FOIL")); - register(new SkyblockAbility("Rapid Fire", -1, 100, "MACHINE_GUN_BOW")); - register(new SkyblockAbility("Water Burst", 20, -1, "SALMON_HELMET")); - register(new SkyblockAbility("Alchemist's Bliss", -1, -1, "NETHER_WART_POUCH")); - register(new SkyblockAbility("Water Burst", 20, -1, "SALMON_CHESTPLATE")); - register(new SkyblockAbility("Instant Heal", 70, -1, "ORNATE_ZOMBIE_SWORD")); - register(new SkyblockAbility("Shadow Fury", -1, 15, "SHADOW_FURY")); - register(new SkyblockAbility("Healing Boost", -1, -1, "ZOMBIE_HEART")); - register(new SkyblockAbility("Witherlord", 40, 3, "CRYPT_WITHERLORD_SWORD")); - register(new SkyblockAbility("Revive", -1, -1, "REVIVE_STONE")); - register(new SkyblockAbility("Raise Souls", -1, 1, "REAPER_SCYTHE")); - register(new SkyblockAbility("Rejuvenate", -1, -1, "VAMPIRE_MASK")); - register(new SkyblockAbility("Mist Aura", -1, -1, "SORROW_HELMET")); - register(new SkyblockAbility("Place Dirt", -1, -1, "INFINIDIRT_WAND")); - register(new SkyblockAbility("Clownin' Around", -1, 360, "BONZO_MASK")); - register(new SkyblockAbility("Shadow Warp", 300, 10, "SHADOW_WARP_SCROLL")); - register(new SkyblockAbility("Molten Wave", 500, 1, "MIDAS_STAFF")); - register(new SkyblockAbility("Growth", -1, 4, "GROWTH_HELMET")); - register(new SkyblockAbility("Howl", 150, 20, "WEIRD_TUBA")); - register(new SkyblockAbility("Medium Heal", 80, 1, "WAND_OF_MENDING")); - register(new SkyblockAbility("Throw", 20, -1, "AXE_OF_THE_SHREDDED")); - register(new SkyblockAbility("Ink Bomb", 60, 30, "INK_WAND")); - register(new SkyblockAbility("Whassup?", -1, -1, "AATROX_BATPHONE")); - register(new SkyblockAbility("Deploy", -1, -1, "MANA_FLUX_POWER_ORB")); - register(new SkyblockAbility("Extreme Focus", -1, -1, "END_STONE_BOW")); - register(new SkyblockAbility("Healing Boost", -1, -1, "CRYSTALLIZED_HEART")); - register(new SkyblockAbility("Mist Aura", -1, -1, "SORROW_LEGGINGS")); - register(new SkyblockAbility("Showtime", 100, -1, "BONZO_STAFF")); - register(new SkyblockAbility("Triple Shot", -1, -1, "RUNAANS_BOW")); - register(new SkyblockAbility("Water Burst", 20, -1, "SALMON_LEGGINGS_NEW")); - register(new SkyblockAbility("Rejuvenate", -1, -1, "VAMPIRE_WITCH_MASK")); - register(new SkyblockAbility("Terrain Toss", 250, 1, "YETI_SWORD")); - register(new SkyblockAbility("Instant Transmission", 50, -1, "ASPECT_OF_THE_END")); - register(new SkyblockAbility("Detonate", -1, 60, "CREEPER_LEGGINGS")); - register(new SkyblockAbility("Extreme Focus", -1, -1, "END_STONE_SWORD")); - register(new SkyblockAbility("Leap", 50, 1, "LEAPING_SWORD")); - register(new SkyblockAbility("Fun Guy Bonus", -1, -1, "FUNGI_CUTTER")); - register(new SkyblockAbility("Cleave", -1, -1, "GIANT_CLEAVER")); - register(new SkyblockAbility("Tempest", -1, -1, "HURRICANE_BOW")); - register(new SkyblockAbility("Big Heal", 100, 1, "WAND_OF_RESTORATION")); - register(new SkyblockAbility("Growth", -1, 4, "GROWTH_BOOTS")); - register(new SkyblockAbility("Stinger", 150, -1, "SCORPION_BOW")); - register(new SkyblockAbility("Eye Beam", -1, -1, "PRECURSOR_EYE")); - register(new SkyblockAbility("Water Burst", 20, -1, "SALMON_BOOTS")); - register(new SkyblockAbility("Mining Speed Boost", -1, 120, null)); - register(new SkyblockAbility("Pikobulus", -1, 110, null)); - // abilities - - register(new SkyblockAbility("Healing Circle", -1, 2, "DUNGEON_STONE")); - register(new SkyblockAbility("Wish", -1, 120, "DUNGEON_STONE")); - register(new SkyblockAbility("Guided Sheep", -1, 30, "DUNGEON_STONE")); - register(new SkyblockAbility("Thunderstorm", -1, 500, "DUNGEON_STONE")); - register(new SkyblockAbility("Throwing Axe", -1, 10, "DUNGEON_STONE")); - register(new SkyblockAbility("Ragnarok", -1, 60, "DUNGEON_STONE")); - register(new SkyblockAbility("Explosive Shot", -1, 40, "DUNGEON_STONE")); - register(new SkyblockAbility("Rapid Fire", -1, 100, "DUNGEON_STONE")); - register(new SkyblockAbility("Seismic Wave", -1, 15, "DUNGEON_STONE")); - register(new SkyblockAbility("Castle of Stone", -1, 150, "DUNGEON_STONE")); - } - - static void register(SkyblockAbility skyblockAbility) { - if (!skyblockAbilities.containsKey(skyblockAbility.getName())) - skyblockAbilities.put(skyblockAbility.getName(), skyblockAbility); - if (skyblockAbility.getItemId() != null && skyblockAbility.getCooldown() != -1) { - List<SkyblockAbility> skyblockAbility1 = skyblockAbilitiesByItemID.computeIfAbsent(skyblockAbility.getItemId(), (a) -> new ArrayList<>()); - skyblockAbility1.add(skyblockAbilities.get(skyblockAbility.getName())); - skyblockAbilitiesByItemID.put(skyblockAbility.getItemId(), skyblockAbility1); - } - } - - private final TreeSet<UsedAbility> usedAbilities = new TreeSet<UsedAbility>((c1, c2) -> { - int a = Comparator.comparingLong(UsedAbility::getCooldownEnd).compare(c1,c2); - return c1.getAbility().getName().equals(c2.getAbility().getName()) ? 0 : a; - }); - - @Override - public List<StyledText> getText() { - List<StyledText> cooldowns = new ArrayList<>(); - - for (UsedAbility usedAbility : usedAbilities) { - long end = usedAbility.getCooldownEnd(); - if (System.currentTimeMillis() >= end) { - if (System.currentTimeMillis() <= end + 20000) { - cooldowns.add(new StyledText(usedAbility.getAbility().getName(), "abilityname")); - cooldowns.add(new StyledText(": ", "separator")); - cooldowns.add(new StyledText("READY\n", "ready")); - } - } else { - cooldowns.add(new StyledText(usedAbility.getAbility().getName(), "abilityname")); - cooldowns.add(new StyledText(": ", "separator")); - long millies = end-System.currentTimeMillis(); - double decimalPlaces = (double ) Math.pow(10, 3- this.<Integer>getParameter("decimal").getValue()); - if (decimalPlaces == 0) { - cooldowns.add(new StyledText( this.<Integer>getParameter("decimal").getValue()+" decimal places? You'd be joking\n", "unit")); - continue; - } - millies = (long) (((millies-1) / decimalPlaces + 1) * decimalPlaces); - long hr = (long) (millies / (1000 * 60 * 60)); - long min = (long) (( millies / (1000*60)) % 60); - double seconds = (millies/1000.0 ) % 60; - String secondStr = String.format("%."+(this.<Integer>getParameter("decimal").getValue())+"f", seconds); - - if (hr > 0) { - cooldowns.add(new StyledText(String.valueOf(hr), "number")); - cooldowns.add(new StyledText("h ", "unit")); - } - if (hr > 0 || min > 0) { - cooldowns.add(new StyledText(String.valueOf(min), "number")); - cooldowns.add(new StyledText("m ", "unit")); - } - if (hr > 0 || min > 0 || seconds > 0) { - cooldowns.add(new StyledText(secondStr, "number")); - cooldowns.add(new StyledText("s ", "unit")); - } - cooldowns.add(new StyledText("\n", "unit")); - } - } - return cooldowns; - } - - Pattern thePattern = Pattern.compile("§b-(\\d+) Mana \\(§6(.+)§b\\)"); - Pattern thePattern2 = Pattern.compile("§r§aUsed (.+)§r§a! §r§b\\((1194) Mana\\)§r"); - Pattern thePattern3 = Pattern.compile("§r§aUsed (.+)§r§a!§r"); - - private String lastActionbarAbility; - @Override - public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { - if (clientChatReceivedEvent.type == 2) { - Matcher m = thePattern.matcher(clientChatReceivedEvent.message.getFormattedText()); - if (m.find()) { - String name = m.group(2); - if (!name.equalsIgnoreCase(lastActionbarAbility)) { - used(name); - } - lastActionbarAbility = name; - } else { - lastActionbarAbility = null; - } - } else { - String message = clientChatReceivedEvent.message.getFormattedText(); - if (message.equals("§r§aYour §r§9Bonzo's Mask §r§asaved your life!§r")) { - used("Clownin' Around"); - } else { - Matcher m = thePattern2.matcher(message); - if (m.matches()) { - String abilityName = TextUtils.stripColor(m.group(1)); - used(abilityName); - } else { - Matcher m2 = thePattern3.matcher(message); - if (m2.matches()) { - String abilityName = TextUtils.stripColor(m2.group(1)); - used(abilityName); - } else if (message.startsWith("§r§aYou used your ") || message.endsWith("§r§aPickaxe Ability!§r")) { - String nocolor = TextUtils.stripColor(message); - String abilityName = nocolor.substring(nocolor.indexOf("your") + 5, nocolor.indexOf("Pickaxe") - 1); - used(abilityName); - } - } - } - } - } - - private void used(String ability) { - if (skyblockAbilities.containsKey(ability)) { - SkyblockAbility skyblockAbility = skyblockAbilities.get(ability); - if (skyblockAbility.getCooldown() > 0) { - UsedAbility usedAbility = new UsedAbility(skyblockAbility, System.currentTimeMillis() + skyblockAbility.getCooldown() * 1000); - for (int i = 0; i < 3; i++) usedAbilities.remove(usedAbility); - usedAbilities.add(usedAbility); - } - } else { - System.out.println("Unknown ability: "+ability); - } - } - - public void checkForCooldown(ItemStack itemStack) { - if (itemStack == null) return; - NBTTagCompound nbt = itemStack.getTagCompound(); - if (nbt == null) return; - NBTTagCompound extra = nbt.getCompoundTag("ExtraAttributes"); - if (extra == null) return; - String id = extra.getString("id"); - if (!skyblockAbilitiesByItemID.containsKey(id)) return; - List<SkyblockAbility> skyblockAbility = skyblockAbilitiesByItemID.get(id); - - NBTTagCompound display = nbt.getCompoundTag("display"); - if (display == null) return; - NBTTagList lore = display.getTagList("Lore", 8); - int thecd = -1; - SkyblockAbility currentAbility = null; - for (int i = 0; i < lore.tagCount(); i++) { - String specific = lore.getStringTagAt(i); - if (specific.startsWith("§8Cooldown: §a") && currentAbility != null) { - String thecdstr = TextUtils.stripColor(specific).substring(10).trim(); - thecdstr = thecdstr.substring(0, thecdstr.length() - 1); - thecd = Integer.parseInt(thecdstr); - currentAbility.setCooldown(thecd); - currentAbility = null; - } else if (specific.startsWith("§6Item Ability: ")) { - String ability = TextUtils.stripColor(specific).substring(14).trim(); - - for (SkyblockAbility skyblockAbility1 : skyblockAbility) { - if (skyblockAbility1.getName().equals(ability)) { - currentAbility = skyblockAbility1; - break; - } - } - } - } - } - - @Override - public void onTick() { - EntityPlayerSP sp = Minecraft.getMinecraft().thePlayer; - if (sp == null) return; - if (sp.inventory == null || sp.inventory.armorInventory == null) return; - for (ItemStack itemStack : sp.inventory.armorInventory) { - checkForCooldown(itemStack); - } - for (ItemStack itemStack : sp.inventory.mainInventory) { - checkForCooldown(itemStack); - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/SkyblockAbility.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/SkyblockAbility.java deleted file mode 100644 index 6869e8f7..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/SkyblockAbility.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.etc.ability; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class SkyblockAbility { - private String name; - private int manaCost; - private int cooldown; - - private String itemId; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/UsedAbility.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/UsedAbility.java deleted file mode 100644 index 9bd998d8..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/etc/ability/UsedAbility.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.etc.ability; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@AllArgsConstructor -public class UsedAbility { - private SkyblockAbility ability; - @EqualsAndHashCode.Exclude - private long cooldownEnd; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/APIKey.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/APIKey.java deleted file mode 100644 index 829010dc..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/APIKey.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party; - -import kr.syeyoung.dungeonsguide.features.listener.ChatListenerGlobal; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ChatComponentText; -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -public class APIKey extends SimpleFeature implements ChatListenerGlobal { - - public APIKey() { - super("Misc.API Features", "API KEY", "Sets api key","partykicker.apikey"); - parameters.put("apikey", new FeatureParameter<String>("apikey", "API Key", "API key", "","string")); - } - - public String getAPIKey() { - return this.<String>getParameter("apikey").getValue(); - } - - - @Override - public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { - if (clientChatReceivedEvent.type == 2) return; - String str = clientChatReceivedEvent.message.getFormattedText(); - if (str.startsWith("§aYour new API key is §r§b")) { - String apiKeys = TextUtils.stripColor(str.split(" ")[5]); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fAutomatically Configured Hypixel API Key")); - this.<String>getParameter("apikey").setValue(apiKeys); - } - } - - @Override - public boolean isDisyllable() { - return false; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeatureGoodParties.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeatureGoodParties.java deleted file mode 100644 index dbdcdd3f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeatureGoodParties.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party; - -import kr.syeyoung.dungeonsguide.features.listener.GuiPostRenderListener; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.init.Items; -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.Slot; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.client.event.GuiScreenEvent; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -public class FeatureGoodParties extends SimpleFeature implements GuiPostRenderListener { - public FeatureGoodParties() { - super("Party Kicker", "Highlight parties in party viewer", "Highlight parties you can't join with red", "partykicker.goodparty",true); - } - - @Override - public void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered) { - if (!isEnabled()) return; - if (!(Minecraft.getMinecraft().currentScreen instanceof GuiChest)) return; - GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; - ContainerChest cont = (ContainerChest) chest.inventorySlots; - String name = cont.getLowerChestInventory().getName(); - if (!"Party Finder".equals(name)) return; - - - int i = 222; - int j = i - 108; - int ySize = j + (((ContainerChest)(((GuiChest) Minecraft.getMinecraft().currentScreen).inventorySlots)).getLowerChestInventory().getSizeInventory() / 9) * 18; - int left = (rendered.gui.width - 176) / 2; - int top = (rendered.gui.height - ySize ) / 2; - GlStateManager.pushMatrix(); - GlStateManager.disableDepth(); - GlStateManager.disableLighting(); - GlStateManager.colorMask(true, true, true, false); - GlStateManager.translate(left, top, 0); - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - try { - - for (int i1 = 0; i1 < Integer.min(54, cont.inventorySlots.size()); i1++) { - Slot s = cont.inventorySlots.get(i1); - if (s.getStack() == null) continue; - if (s.getStack().getItem() != Items.skull) continue; - NBTTagCompound nbt = s.getStack().getTagCompound(); - if (nbt == null || nbt.hasNoTags()) continue; - NBTTagCompound display = nbt.getCompoundTag("display"); - if (display.hasNoTags()) return; - NBTTagList lore = display.getTagList("Lore", 8); - int classLvReq = 0; - int cataLvReq = 0; - boolean Req = false; - String note = ""; - for (int n = 0; n < lore.tagCount(); n++) { - String str = lore.getStringTagAt(n); - if (str.startsWith("§7Dungeon Level Required: §b")) cataLvReq = Integer.parseInt(str.substring(28)); - if (str.startsWith("§7Class Level Required: §b")) classLvReq = Integer.parseInt(str.substring(26)); - if (str.startsWith("§7§7Note:")) note = TextUtils.stripColor(str.substring(10)); - if (str.startsWith("§cRequires")) Req = true; - } - - int x = s.xDisplayPosition; - int y = s.yDisplayPosition; - if (Req) { - Gui.drawRect(x, y, x + 16, y + 16, 0x77AA0000); - } else { - - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - if (note.toLowerCase().contains("car")) { - fr.drawStringWithShadow("C", x + 1, y + 1, 0xFFFF0000); - } else if (note.toLowerCase().replace(" ", "").contains("s/s+")) { - fr.drawStringWithShadow("S+", x + 1, y + 1, 0xFFFFFF00); - } else if (note.toLowerCase().contains("s+")) { - fr.drawStringWithShadow("S+", x + 1, y + 1, 0xFF00FF00); - } else if (note.toLowerCase().contains(" s") || note.toLowerCase().contains(" s ")) { - fr.drawStringWithShadow("S", x + 1, y + 1, 0xFFFFFF00); - } else if (note.toLowerCase().contains("rush")) { - fr.drawStringWithShadow("R", x + 1, y + 1, 0xFFFF0000); - } - fr.drawStringWithShadow("§e"+Integer.max(classLvReq, cataLvReq), x + 1, y + fr.FONT_HEIGHT, 0xFFFFFFFF); - } - - - } - } catch (Throwable e) { - e.printStackTrace(); - } - GlStateManager.colorMask(true, true, true, true); - GlStateManager.popMatrix(); - GlStateManager.enableBlend(); - GlStateManager.enableLighting(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyList.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyList.java deleted file mode 100644 index 55ea699c..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyList.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.chat.PartyContext; -import kr.syeyoung.dungeonsguide.chat.PartyManager; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class FeaturePartyList extends TextHUDFeature { - public FeaturePartyList() { - super("Party","Party List", "Party List as GUI", "party.list", false, getFontRenderer().getStringWidth("Watcher finished spawning all mobs!"), getFontRenderer().FONT_HEIGHT*4); - getStyles().add(new TextStyle("name", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("player", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("allinvite", new AColor(0xAA,0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - setEnabled(false); - } - - @Override - public boolean isHUDViewable() { - return PartyManager.INSTANCE.getPartyContext() != null; - } - - @Override - public java.util.List<String> getUsedTextStyle() { - return Arrays.asList("name" ,"separator", "player", "allinvite"); - } - - private static final List<StyledText> dummyText = new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("Leader","name")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("syeyoung","player")); - dummyText.add(new StyledText("\nModerator","name")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("rioho, RaidShadowLegends, Tricked","player")); - dummyText.add(new StyledText("\nMember","name")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("Everyone","player")); - dummyText.add(new StyledText("\nAll invite Off","allinvite")); - } - - @Override - public List<StyledText> getDummyText() { - return dummyText; - } - - @Override - public boolean doesScaleWithHeight() { - return false; - } - - @Override - public List<StyledText> getText() { - PartyContext pc = PartyManager.INSTANCE.getPartyContext(); - List<StyledText> text= new ArrayList<>(); - text.add(new StyledText("Leader","name")); - text.add(new StyledText(": ","separator")); - text.add(new StyledText(pc.getPartyOwner()+"","player")); - text.add(new StyledText("\nModerator","name")); - text.add(new StyledText(": ","separator")); - text.add(new StyledText(pc.getPartyModerator() == null ? "????" : String.join(", ", pc.getPartyModerator()) + (pc.isModeratorComplete() ? "" : " ?"),"player")); - text.add(new StyledText("\nMember","name")); - text.add(new StyledText(": ","separator")); - text.add(new StyledText(pc.getPartyMember() == null ? "????" : String.join(", ", pc.getPartyMember()) + (pc.isMemberComplete() ? "" : " ?"),"player")); - if (pc.getAllInvite() != null && !pc.getAllInvite()) - text.add(new StyledText("\nAll invite Off","allinvite")); - else if (pc.getAllInvite() != null) - text.add(new StyledText("\nAll invite On","allinvite")); - else - text.add(new StyledText("\nAll invite Unknown","allinvite")); - return text; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyReady.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyReady.java deleted file mode 100644 index f7d16167..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/FeaturePartyReady.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.chat.PartyContext; -import kr.syeyoung.dungeonsguide.chat.PartyManager; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -import java.util.*; - -public class FeaturePartyReady extends TextHUDFeature implements ChatListener, DungeonStartListener { - public FeaturePartyReady() { - super("Party","Party Ready List", "Check if your party member have said r or not", "party.readylist", false, getFontRenderer().getStringWidth("Watcher finished spawning all mobs!"), getFontRenderer().FONT_HEIGHT*4); - getStyles().add(new TextStyle("player", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("ready", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("notready", new AColor(0xFF, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("terminal", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - setEnabled(true); - } - - @Override - public boolean isHUDViewable() { - return PartyManager.INSTANCE.getPartyContext() != null && PartyManager.INSTANCE.getPartyContext().isPartyExistHypixel() && "Dungeon Hub".equals(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getDungeonName()); - } - - @Override - public List<String> getUsedTextStyle() { - return Arrays.asList("separator", "player", "ready", "notready", "terminal"); - } - - private static final List<StyledText> dummyText = new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("syeyoung","player")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("Ready","ready")); - dummyText.add(new StyledText(" 4","terminal")); - dummyText.add(new StyledText("\nrioho","player")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("Ready","ready")); - dummyText.add(new StyledText(" 3","terminal")); - dummyText.add(new StyledText("\nRaidShadowLegends","player")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("Not Ready","notready")); - dummyText.add(new StyledText(" 2t","terminal")); - dummyText.add(new StyledText("\nTricked","player")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("Ready","ready")); - dummyText.add(new StyledText(" ss","terminal")); - dummyText.add(new StyledText("\nMr. Penguin","player")); - dummyText.add(new StyledText(": ","separator")); - dummyText.add(new StyledText("Not Ready","notready")); - dummyText.add(new StyledText(" 2b","terminal")); - } - - @Override - public List<StyledText> getDummyText() { - return dummyText; - } - - @Override - public boolean doesScaleWithHeight() { - return false; - } - - private Set<String> ready = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); - private Map<String, String> terminal = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); - - @Override - public List<StyledText> getText() { - PartyContext pc = PartyManager.INSTANCE.getPartyContext(); - List<StyledText> text= new ArrayList<>(); - boolean first = true; - for (String partyRawMember : pc.getPartyRawMembers()) { - text.add(new StyledText((first ? "":"\n") + partyRawMember, "player")); - text.add(new StyledText(": ","separator")); - if (ready.contains(partyRawMember)) - text.add(new StyledText("Ready","ready")); - else - text.add(new StyledText("Not Ready","notready")); - if (terminal.get(partyRawMember) != null) { - text.add(new StyledText(" "+ terminal.get(partyRawMember), "terminal")); - } - first =false; - } - return text; - } - - private static final List<String> readyPhrase = Arrays.asList("r", "rdy", "ready"); - private static final List<String> negator = Arrays.asList("not ", "not", "n", "n "); - private static final List<String> terminalPhrase = Arrays.asList("ss", "s1", "1", "2b", "2t", "3", "4", "s3", "s4", "s2", "2"); - private static final Map<String, Boolean> readynessIndicator = new HashMap<>(); - static { - readyPhrase.forEach(val -> readynessIndicator.put(val, true)); - for (String s : negator) { - readyPhrase.forEach(val -> readynessIndicator.put(s+val, false)); - } - readynessIndicator.put("dont start", false); - readynessIndicator.put("don't start", false); - readynessIndicator.put("dont go", false); - readynessIndicator.put("don't go", false); - readynessIndicator.put("start", true); - readynessIndicator.put("go", true); - } - - - @Override - public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { - String txt = clientChatReceivedEvent.message.getFormattedText(); - if (!txt.startsWith("§r§9Party §8>")) return; - - String chat = TextUtils.stripColor(txt.substring(txt.indexOf(":")+1)).trim().toLowerCase(); - - - - String usernamearea = TextUtils.stripColor(txt.substring(13, txt.indexOf(":"))); - String username = null; - for (String s : usernamearea.split(" ")) { - if (s.isEmpty()) continue; - if (s.startsWith("[")) continue; - username = s; - break; - } - - - Boolean status = null; - String longestMatch = ""; - for (Map.Entry<String, Boolean> stringBooleanEntry : readynessIndicator.entrySet()) { - if (chat.startsWith(stringBooleanEntry.getKey()) || chat.endsWith(stringBooleanEntry.getKey()) || (stringBooleanEntry.getKey().length()>=3 && chat.contains(stringBooleanEntry.getKey()))) { - if (stringBooleanEntry.getKey().length() > longestMatch.length()) { - longestMatch = stringBooleanEntry.getKey(); - status = stringBooleanEntry.getValue(); - } - } - } - if (status == null); - else if (status) ready.add(username); - else ready.remove(username); - - - String term = ""; - for (String s : terminalPhrase) { - if (chat.equals(s) || chat.startsWith(s+" ") || chat.endsWith(" "+s) || chat.contains(" "+s+" ")) { - term += s+" "; - } - } - if (!term.isEmpty()) - terminal.put(username, term); - } - - @Override - public void onDungeonStart() { - ready.clear(); - terminal.clear(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/ApiFetchur.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/ApiFetchur.java deleted file mode 100644 index 3e991c59..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/ApiFetchur.java +++ /dev/null @@ -1,694 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import com.google.gson.*; -import com.mojang.authlib.GameProfile; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.XPUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLConnection; -import java.util.*; -import java.util.concurrent.*; -import java.util.function.BiFunction; -import java.util.stream.Collectors; - -public class ApiFetchur { - private static final Gson gson = new Gson(); - - private static final Map<String, CachedData<PlayerProfile>> playerProfileCache = new ConcurrentHashMap<>(); - private static final Map<String, CachedData<String>> nicknameToUID = new ConcurrentHashMap<>(); - private static final Map<String, CachedData<String>> UIDtoNickname = new ConcurrentHashMap<>(); - private static final Map<String, CachedData<GameProfile>> UIDtoGameProfile = new ConcurrentHashMap<>(); - - private static final ExecutorService ex = Executors.newFixedThreadPool(4); - - private static final Set<String> invalidKeys = new HashSet<>(); - public static void purgeCache() { - playerProfileCache.clear(); - nicknameToUID.clear(); - UIDtoNickname.clear(); - UIDtoGameProfile.clear(); - - completableFutureMap.clear(); - completableFutureMap2.clear(); - completableFutureMap3.clear(); - completableFutureMap4.clear(); - invalidKeys.clear(); - constants = null; - - ex.submit(ApiFetchur::getLilyWeightConstants); - } - static { - ex.submit(ApiFetchur::getLilyWeightConstants); - } - - public static JsonObject getJson(String url) throws IOException { - URLConnection connection = new URL(url).openConnection(); - connection.setConnectTimeout(10000); - connection.setReadTimeout(10000); - return gson.fromJson(new InputStreamReader(connection.getInputStream()), JsonObject.class); - } - public static JsonArray getJsonArr(String url) throws IOException { - URLConnection connection = new URL(url).openConnection(); - connection.setConnectTimeout(10000); - connection.setReadTimeout(10000); - return gson.fromJson(new InputStreamReader(connection.getInputStream()), JsonArray.class); - } - - private static volatile JsonObject constants; - public static JsonObject getLilyWeightConstants() { - if (constants != null) return constants; - try { - JsonObject jsonObject = getJson("https://raw.githubusercontent.com/Antonio32A/lilyweight/master/lib/constants.json"); - constants = jsonObject; - } catch (Exception e) { - throw new RuntimeException(e); - } - return constants; - } - - private static final Map<String, CompletableFuture<Optional<GameProfile>>> completableFutureMap4 = new ConcurrentHashMap<>(); - public static CompletableFuture<Optional<GameProfile>> getSkinGameProfileByUUIDAsync(String uid) { - if (UIDtoGameProfile.containsKey(uid)) { - CachedData<GameProfile> cachedData = UIDtoGameProfile.get(uid); - if (cachedData.getExpire() > System.currentTimeMillis()) { - return CompletableFuture.completedFuture(Optional.ofNullable(cachedData.getData())); - } - UIDtoGameProfile.remove(uid); - } - if (completableFutureMap4.containsKey(uid)) return completableFutureMap4.get(uid); - - CompletableFuture<Optional<GameProfile>> completableFuture = new CompletableFuture<>(); - fetchNicknameAsync(uid).thenAccept(nick -> { - if (!nick.isPresent()) { - completableFuture.complete(Optional.empty()); - return; - } - ex.submit(() -> { - try { - Optional<GameProfile> playerProfile = getSkinGameProfileByUUID(uid,nick.get()); - UIDtoGameProfile.put(uid, new CachedData<GameProfile>(System.currentTimeMillis()+1000*60*30, playerProfile.orElse(null))); - completableFuture.complete(playerProfile); - completableFutureMap4.remove(uid); - return; - } catch (IOException e) { - e.printStackTrace(); - } - completableFuture.complete(Optional.empty()); - completableFutureMap4.remove(uid); - }); - }); - completableFutureMap4.put(uid, completableFuture); - return completableFuture; - } - - public static Optional<GameProfile> getSkinGameProfileByUUID(String uid, String nickname) throws IOException { - GameProfile gameProfile = new GameProfile(UUID.fromString(uid), nickname); - GameProfile newProf = Minecraft.getMinecraft().getSessionService().fillProfileProperties(gameProfile, true); - return newProf == gameProfile ? Optional.empty() : Optional.of(newProf); - } - - - private static final Map<String, CompletableFuture<Optional<PlayerProfile>>> completableFutureMap = new ConcurrentHashMap<>(); - public static CompletableFuture<Optional<PlayerProfile>> fetchMostRecentProfileAsync(String uid, String apiKey) { - if (playerProfileCache.containsKey(uid)) { - CachedData<PlayerProfile> cachedData = playerProfileCache.get(uid); - if (cachedData.getExpire() > System.currentTimeMillis()) { - return CompletableFuture.completedFuture(Optional.ofNullable(cachedData.getData())); - } - playerProfileCache.remove(uid); - } - if (completableFutureMap.containsKey(uid)) return completableFutureMap.get(uid); - if (invalidKeys.contains(apiKey)) { - CompletableFuture cf = new CompletableFuture(); - cf.completeExceptionally(new IOException("403 for url")); - return cf; - } - - CompletableFuture<Optional<PlayerProfile>> completableFuture = new CompletableFuture<>(); - ex.submit(() -> { - try { - Optional<PlayerProfile> playerProfile = fetchMostRecentProfile(uid, apiKey); - playerProfileCache.put(uid, new CachedData<PlayerProfile>(System.currentTimeMillis()+1000*60*30, playerProfile.orElse(null))); - completableFuture.complete(playerProfile); - completableFutureMap.remove(uid); - return; - } catch (IOException e) { - if (e.getMessage().contains("403 for URL")) { - completableFuture.completeExceptionally(e); - completableFutureMap.remove(uid); - invalidKeys.add(apiKey); - } else { - completableFuture.completeExceptionally(e); - completableFutureMap.remove(uid); - } - e.printStackTrace(); - } - }); - completableFutureMap.put(uid, completableFuture); - return completableFuture; - } - - private static final Map<String, CompletableFuture<Optional<String>>> completableFutureMap3 = new ConcurrentHashMap<>(); - public static CompletableFuture<Optional<String>> fetchNicknameAsync(String uid) { - if (UIDtoNickname.containsKey(uid)) { - CachedData<String> cachedData = UIDtoNickname.get(uid); - if (cachedData.getExpire() > System.currentTimeMillis()) { - return CompletableFuture.completedFuture(Optional.ofNullable(cachedData.getData())); - } - UIDtoNickname.remove(uid); - } - if (completableFutureMap3.containsKey(uid)) return completableFutureMap3.get(uid); - - - CompletableFuture<Optional<String>> completableFuture = new CompletableFuture<>(); - - ex.submit(() -> { - try { - Optional<String> playerProfile = fetchNickname(uid); - UIDtoNickname.put(uid, new CachedData<String>(System.currentTimeMillis()+1000*60*60*12,playerProfile.orElse(null))); - if (playerProfile.isPresent()) - nicknameToUID.put(playerProfile.orElse(null), new CachedData<>(System.currentTimeMillis()+1000*60*60*12, uid)); - completableFuture.complete(playerProfile); - completableFutureMap3.remove(uid); - return; - } catch (IOException e) { - e.printStackTrace(); - } - completableFuture.complete(Optional.empty()); - completableFutureMap3.remove(uid); - }); - completableFutureMap3.put(uid, completableFuture); - - return completableFuture; - } - - private static final Map<String, CompletableFuture<Optional<String>>> completableFutureMap2 = new ConcurrentHashMap<>(); - public static CompletableFuture<Optional<String>> fetchUUIDAsync(String nickname) { - if (nicknameToUID.containsKey(nickname)) { - CachedData<String> cachedData = nicknameToUID.get(nickname); - if (cachedData.getExpire() > System.currentTimeMillis()) { - return CompletableFuture.completedFuture(Optional.ofNullable(cachedData.getData())); - } - nicknameToUID.remove(nickname); - } - if (completableFutureMap2.containsKey(nickname)) return completableFutureMap2.get(nickname); - - - CompletableFuture<Optional<String>> completableFuture = new CompletableFuture<>(); - - ex.submit(() -> { - try { - Optional<String> playerProfile = fetchUUID(nickname); - nicknameToUID.put(nickname, new CachedData<String>(System.currentTimeMillis()+1000*60*60*12,playerProfile.orElse(null))); - if (playerProfile.isPresent()) - UIDtoNickname.put(playerProfile.orElse(null), new CachedData<>(System.currentTimeMillis()+1000*60*60*12, nickname)); - - completableFuture.complete(playerProfile); - completableFutureMap2.remove(nickname); - return; - } catch (IOException e) { - e.printStackTrace(); - } - completableFuture.complete(Optional.empty()); - completableFutureMap2.remove(nickname); - }); - completableFutureMap2.put(nickname, completableFuture); - - return completableFuture; - } - - public static Optional<String> fetchUUID(String nickname) throws IOException { - JsonObject json = getJson("https://api.mojang.com/users/profiles/minecraft/"+nickname); - if (json.has("error")) return Optional.empty(); - return Optional.of(TextUtils.insertDashUUID(json.get("id").getAsString())); - } - public static Optional<String> fetchNickname(String uuid) throws IOException { - try { - JsonArray json = getJsonArr("https://api.mojang.com/user/profiles/" + uuid.replace("-", "") + "/names"); - return Optional.of(json.get(json.size()-1).getAsJsonObject().get("name").getAsString()); - } catch (Exception e) {return Optional.empty();} - } - - public static List<PlayerProfile> fetchPlayerProfiles(String uid, String apiKey) throws IOException { - JsonObject json = getJson("https://api.hypixel.net/skyblock/profiles?uuid="+uid+"&key="+apiKey); - if (!json.get("success").getAsBoolean()) return new ArrayList<>(); - JsonArray profiles = json.getAsJsonArray("profiles"); - String dashTrimmed = uid.replace("-", ""); - - ArrayList<PlayerProfile> playerProfiles = new ArrayList<>(); - for (JsonElement jsonElement : profiles) { - JsonObject semiProfile = jsonElement.getAsJsonObject(); - if (!semiProfile.has(dashTrimmed)) continue; - playerProfiles.add(parseProfile(semiProfile, dashTrimmed)); - } - return playerProfiles; - } - - public static Optional<PlayerProfile> fetchMostRecentProfile(String uid, String apiKey) throws IOException { - JsonObject json = getJson("https://api.hypixel.net/skyblock/profiles?uuid="+uid+"&key="+apiKey); - if (!json.get("success").getAsBoolean()) return Optional.empty(); - JsonArray profiles = json.getAsJsonArray("profiles"); - String dashTrimmed = uid.replace("-", ""); - - JsonObject profile = null; - long lastSave = Long.MIN_VALUE; - for (JsonElement jsonElement : profiles) { - JsonObject semiProfile = jsonElement.getAsJsonObject(); - if (!semiProfile.getAsJsonObject("members").has(dashTrimmed)) continue; - long lastSave2 = semiProfile.getAsJsonObject("members").getAsJsonObject(dashTrimmed).get("last_save").getAsLong(); - if (lastSave2 > lastSave) { - profile = semiProfile; - lastSave = lastSave2; - } - } - - if (profile == null) return Optional.empty(); - PlayerProfile pp = parseProfile(profile, dashTrimmed); - json = getJson("https://api.hypixel.net/player?uuid="+uid+"&key="+apiKey); - if (json.has("player")) { - JsonObject treasures = json.getAsJsonObject("player"); - if (treasures.has("achievements")) { - treasures = treasures.getAsJsonObject("achievements"); - if (treasures.has("skyblock_treasure_hunter")) { - pp.setTotalSecrets(treasures.get("skyblock_treasure_hunter").getAsInt()); - } - } - } - - return Optional.of(pp); - } - - public static int getOrDefault(JsonObject jsonObject, String key, int value) { - if (jsonObject == null || !jsonObject.has(key) || jsonObject.get(key) instanceof JsonNull) return value; - return jsonObject.get(key).getAsInt(); - } - public static long getOrDefault(JsonObject jsonObject, String key, long value) { - if (jsonObject == null || !jsonObject.has(key) || jsonObject.get(key) instanceof JsonNull) return value; - return jsonObject.get(key).getAsLong(); - } - public static double getOrDefault(JsonObject jsonObject, String key, double value) { - if (jsonObject == null || !jsonObject.has(key) || jsonObject.get(key) instanceof JsonNull) return value; - return jsonObject.get(key).getAsDouble(); - } - public static String getOrDefault(JsonObject jsonObject, String key, String value) { - if (jsonObject == null || !jsonObject.has(key) || jsonObject.get(key) instanceof JsonNull) return value; - return jsonObject.get(key).getAsString(); - } - public static Double getOrDefaultNullable(JsonObject jsonObject, String key, Double value) { - if (jsonObject == null || !jsonObject.has(key) || jsonObject.get(key) instanceof JsonNull) return value; - return jsonObject.get(key).getAsDouble(); - } - public static NBTTagCompound parseBase64NBT(String nbt) throws IOException { - return CompressedStreamTools.readCompressed(new ByteArrayInputStream(Base64.getDecoder().decode(nbt))); - } - - public static ItemStack deserializeNBT(NBTTagCompound nbtTagCompound) { - if (nbtTagCompound.hasNoTags()) return null; - ItemStack itemStack = new ItemStack(Blocks.stone); - itemStack.deserializeNBT(nbtTagCompound); - return itemStack; - } - - public static PlayerProfile parseProfile(JsonObject profile, String dashTrimmed) throws IOException { - PlayerProfile playerProfile = new PlayerProfile(); - playerProfile.setProfileUID(getOrDefault(profile, "profile_id", "")); - playerProfile.setMemberUID(dashTrimmed); - playerProfile.setProfileName(getOrDefault(profile, "cute_name", "")); - - JsonObject playerData = profile.getAsJsonObject("members").getAsJsonObject(dashTrimmed); - playerProfile.setLastSave(getOrDefault(playerData, "last_save", 0L)); - playerProfile.setFairySouls(getOrDefault(playerData, "fairy_souls_collected", 0)); - playerProfile.setFairyExchanges(getOrDefault(playerData, "fairy_exchanges", 0)); - - if (playerData.has("inv_armor")) { - playerProfile.setCurrentArmor(new PlayerProfile.Armor()); - NBTTagCompound armor = parseBase64NBT(playerData.getAsJsonObject("inv_armor") - .get("data") - .getAsString()); - NBTTagList array = armor.getTagList("i", 10); - for (int i = 0; i < 4; i++) { - NBTTagCompound item = array.getCompoundTagAt(i); - playerProfile.getCurrentArmor().getArmorSlots()[i] = deserializeNBT(item); - } - } - - if (playerData.has("wardrobe_contents")) { - NBTTagCompound armor = parseBase64NBT(playerData.getAsJsonObject("wardrobe_contents").get("data").getAsString()); - NBTTagList array = armor.getTagList("i", 10); - for (int i = 0; i < array.tagCount(); i++) { - if (i % 4 == 0) playerProfile.getWardrobe().add(new PlayerProfile.Armor()); - NBTTagCompound item = array.getCompoundTagAt(i); - playerProfile.getWardrobe().get(i/4).getArmorSlots()[i%4] = deserializeNBT(item); - } - - } - playerProfile.setSelectedWardrobe(getOrDefault(playerData, "wardrobe_equipped_slot", -1)); - - if (playerData.has("inv_contents")) { - NBTTagCompound armor = parseBase64NBT(playerData.getAsJsonObject("inv_contents").get("data").getAsString()); - NBTTagList array = armor.getTagList("i", 10); - playerProfile.setInventory(new ItemStack[array.tagCount()]); - for (int i = 0; i < array.tagCount(); i++) { - NBTTagCompound item = array.getCompoundTagAt(i); - playerProfile.getInventory()[i] = deserializeNBT(item); - } - } - if (playerData.has("ender_chest_contents")) { - NBTTagCompound armor = parseBase64NBT(playerData.getAsJsonObject("ender_chest_contents").get("data").getAsString()); - NBTTagList array = armor.getTagList("i", 10); - playerProfile.setEnderchest(new ItemStack[array.tagCount()]); - for (int i = 0; i < array.tagCount(); i++) { - NBTTagCompound item = array.getCompoundTagAt(i); - playerProfile.getEnderchest()[i] = deserializeNBT(item); - } - } - if (playerData.has("talisman_bag")) { - NBTTagCompound armor = parseBase64NBT(playerData.getAsJsonObject("talisman_bag").get("data").getAsString()); - NBTTagList array = armor.getTagList("i", 10); - playerProfile.setTalismans(new ItemStack[array.tagCount()]); - for (int i = 0; i < array.tagCount(); i++) { - NBTTagCompound item = array.getCompoundTagAt(i); - playerProfile.getTalismans()[i] = deserializeNBT(item); - } - } - - playerProfile.setSkillXp(new HashMap<>()); - for (Skill value : Skill.values()) { - playerProfile.getSkillXp().put(value, getOrDefaultNullable(playerData, "experience_skill_"+value.getJsonName(), null)); - } - - if (playerData.has("pets")) { - for (JsonElement pets : playerData.getAsJsonArray("pets")) { - JsonObject pet = pets.getAsJsonObject(); - Pet petObj = new Pet(); - petObj.setActive(pet.get("active").getAsBoolean()); - petObj.setExp(getOrDefault(pet, "exp", 0.0)); - petObj.setHeldItem(getOrDefault(pet, "heldItem", null)); - petObj.setSkin(getOrDefault(pet, "skin", null)); - petObj.setType(getOrDefault(pet, "type", null)); - petObj.setUuid(getOrDefault(pet, "uuid", null)); - - playerProfile.getPets().add(petObj); - } - } - - if (playerData.has("dungeons") && playerData.getAsJsonObject("dungeons").has("dungeon_types")) { - JsonObject types = playerData.getAsJsonObject("dungeons") - .getAsJsonObject("dungeon_types"); - for (DungeonType value : DungeonType.values()) { - DungeonStat dungeonStat = new DungeonStat(); - DungeonSpecificData<DungeonStat> dungeonSpecificData = new DungeonSpecificData<>(value, dungeonStat); - playerProfile.getDungeonStats().put(value, dungeonSpecificData); - - if (!types.has(value.getJsonName())) continue; - - JsonObject dungeonObj = types.getAsJsonObject(value.getJsonName()); - - dungeonStat.setHighestCompleted(getOrDefault(dungeonObj, "highest_tier_completed", -1)); - - for (Integer validFloor : value.getValidFloors()) { - DungeonStat.PlayedFloor playedFloor = new DungeonStat.PlayedFloor(); - playedFloor.setBestScore(getOrDefault(dungeonObj.getAsJsonObject("best_score"), ""+validFloor, 0)); - playedFloor.setCompletions(getOrDefault(dungeonObj.getAsJsonObject("tier_completions"), ""+validFloor, 0)); - playedFloor.setFastestTime(getOrDefault(dungeonObj.getAsJsonObject("fastest_time"), ""+validFloor, -1)); - playedFloor.setFastestTimeS(getOrDefault(dungeonObj.getAsJsonObject("fastest_time_s"), ""+validFloor, -1)); - playedFloor.setFastestTimeSPlus(getOrDefault(dungeonObj.getAsJsonObject("fastest_time_s_plus"), ""+validFloor, -1)); - playedFloor.setMobsKilled(getOrDefault(dungeonObj.getAsJsonObject("mobs_killed"), ""+validFloor, 0)); - playedFloor.setMostMobsKilled(getOrDefault(dungeonObj.getAsJsonObject("most_mobs_killed"), ""+validFloor, 0)); - playedFloor.setMostHealing(getOrDefault(dungeonObj.getAsJsonObject("most_healing"), ""+validFloor, 0)); - playedFloor.setTimes_played(getOrDefault(dungeonObj.getAsJsonObject("times_played"), ""+validFloor, 0)); - playedFloor.setWatcherKills(getOrDefault(dungeonObj.getAsJsonObject("watcher_kills"), ""+validFloor, 0)); - - for (DungeonClass dungeonClass : DungeonClass.values()) { - DungeonStat.PlayedFloor.ClassStatistics classStatistics = new DungeonStat.PlayedFloor.ClassStatistics(); - classStatistics.setMostDamage(getOrDefault(dungeonObj.getAsJsonObject("most_damage_"+dungeonClass.getJsonName()), ""+validFloor, 0)); - ClassSpecificData<DungeonStat.PlayedFloor.ClassStatistics> classStatisticsClassSpecificData = new ClassSpecificData<>(dungeonClass, classStatistics); - - playedFloor.getClassStatistics().put(dungeonClass, classStatisticsClassSpecificData); - } - - FloorSpecificData<DungeonStat.PlayedFloor> playedFloorFloorSpecificData = new FloorSpecificData<>(validFloor, playedFloor); - dungeonStat.getPlays().put(validFloor, playedFloorFloorSpecificData); - } - - dungeonStat.setExperience(getOrDefault(dungeonObj, "experience", 0)); - - - } - } - if (playerData.has("dungeons") && playerData.getAsJsonObject("dungeons").has("player_classes")) { - JsonObject classes = playerData.getAsJsonObject("dungeons") - .getAsJsonObject("player_classes"); - for (DungeonClass dungeonClass : DungeonClass.values()) { - PlayerProfile.PlayerClassData classStatistics = new PlayerProfile.PlayerClassData(); - classStatistics.setExperience(getOrDefault(classes.getAsJsonObject(dungeonClass.getJsonName()), "experience", 0)); - ClassSpecificData<PlayerProfile.PlayerClassData> classStatisticsClassSpecificData = new ClassSpecificData<>(dungeonClass, classStatistics); - - playerProfile.getPlayerClassData().put(dungeonClass, classStatisticsClassSpecificData); - } - } - if (playerData.has("dungeons")) { - String id = getOrDefault(playerData.getAsJsonObject("dungeons"), "selected_dungeon_class", null); - DungeonClass dungeonClass = DungeonClass.getClassByJsonName(id); - playerProfile.setSelectedClass(dungeonClass); - } - try { - calculateLilyWeight(playerProfile, playerData); - } catch (Exception e) { - e.printStackTrace(); - } - return playerProfile; - } - - private static void calculateLilyWeight(PlayerProfile playerProfile, JsonObject playerData) throws ExecutionException, InterruptedException { - JsonObject constants = getLilyWeightConstants(); - double[] slayerXP = new double[4]; - if (playerData.has("slayer_bosses")) { - slayerXP[0] = getOrDefault(playerData.getAsJsonObject("slayer_bosses").getAsJsonObject("zombie"), "xp", 0); - slayerXP[1] = getOrDefault(playerData.getAsJsonObject("slayer_bosses").getAsJsonObject("spider"), "xp", 0); - slayerXP[2] = getOrDefault(playerData.getAsJsonObject("slayer_bosses").getAsJsonObject("wolf"), "xp", 0); - slayerXP[3] = getOrDefault(playerData.getAsJsonObject("slayer_bosses").getAsJsonObject("enderman"), "xp", 0); - } - double skillWeight = 0; - double overflowWeight = 0; - { - JsonObject srw = constants.getAsJsonObject("skillRatioWeight"); - int skillMaxXP = constants.get("skillMaxXP").getAsInt(); - JsonArray overflowMultiplier = constants.getAsJsonArray("skillOverflowMultipliers"); - JsonArray skillFactor = constants.getAsJsonArray("skillFactors"); - - double skillAvg = playerProfile.getSkillXp().entrySet().stream() - .filter(a -> a.getValue() != null) - .filter(a -> srw.has(a.getKey().getJsonName())) - .map(a -> XPUtils.getSkillXp(a.getKey(), a.getValue()).getLevel()).collect(Collectors.averagingInt(a -> a)); - - double n = 12 * (skillAvg/60)*(skillAvg/60); - double r2 = Math.sqrt(2); - - for (Map.Entry<Skill, Double> skillDoubleEntry : playerProfile.getSkillXp().entrySet()) { - String jsonName = skillDoubleEntry.getKey().getJsonName(); - JsonArray temp_srw = srw.getAsJsonArray(jsonName); - if (temp_srw == null) continue; - int lv = XPUtils.getSkillXp(skillDoubleEntry.getKey(), skillDoubleEntry.getValue()).getLevel(); - skillWeight += n * temp_srw.get(lv).getAsDouble() - * temp_srw.get(temp_srw.size() - 1).getAsDouble(); - skillWeight += temp_srw.get(temp_srw.size() - 1).getAsDouble() * Math.pow(lv/60.0, r2); - } - - int cnt = 0; - for (Map.Entry<String, JsonElement> skillNames : constants.getAsJsonObject("skillNames").entrySet()) { - Skill s = getSkillByLilyName(skillNames.getKey()); - double factor = skillFactor.get(cnt).getAsDouble(); - double effectiveOver; - Double xp = playerProfile.getSkillXp().get(s); - if (xp == null) continue; xp -= skillMaxXP; - { - if (xp < skillMaxXP) effectiveOver = xp; - else { - double remainingXP = xp; - double z = 0; - for (int i = 0; i<= xp/skillMaxXP; i++) { - if (remainingXP >= skillMaxXP) { - remainingXP -= skillMaxXP; - z += Math.pow(factor, i); - } - } - effectiveOver = z * skillMaxXP; - } - } - double rating = effectiveOver / skillMaxXP; - double overflowMult = overflowMultiplier.get(cnt).getAsDouble(); - double t = rating * overflowMult; - if (t > 0) overflowWeight += t; - cnt++; - } - } - double cataCompWeight, masterCompWeight; - { - JsonArray completionFactor = constants.getAsJsonArray("dungeonCompletionWorth"); - JsonObject dungeonCompletionBuffs = constants.getAsJsonObject("dungeonCompletionBuffs"); - double max1000 = 0; - double mMax1000 = 0; - for (int i = 0; i < completionFactor.size(); i++) { - if (i < 8) max1000 += completionFactor.get(i).getAsDouble(); - else mMax1000 += completionFactor.get(i).getAsDouble(); - } - - max1000 *= 1000; - mMax1000 *= 1000; - - double upperBound = 1500; double score = 0; - - DungeonStat dStat = playerProfile.getDungeonStats().get(DungeonType.CATACOMBS).getData(); - for (FloorSpecificData<DungeonStat.PlayedFloor> value : dStat.getPlays().values()) { - int runs = value.getData().getCompletions(); - int excess = 0; if (runs > 1000) { - excess = runs - 1000; runs = 1000; - } - - double floorScore = runs * completionFactor.get(value.getFloor()).getAsDouble(); - if (excess > 0) - floorScore *= Math.log10(excess / 1000.0 + 1) / Math.log10(7.5) + 1; - score += floorScore; - } - cataCompWeight = (score / max1000 * upperBound); - - dStat = playerProfile.getDungeonStats().get(DungeonType.MASTER_CATACOMBS).getData(); - for (FloorSpecificData<DungeonStat.PlayedFloor> value : dStat.getPlays().values()) { - if (dungeonCompletionBuffs.has(value.getFloor()+"")) { - double threshold = 20; - if (value.getData().getCompletions() >= threshold) upperBound += dungeonCompletionBuffs.get(value.getFloor()+"").getAsDouble(); - else upperBound += dungeonCompletionBuffs.get(value.getFloor()+"").getAsDouble() * Math.pow(value.getData().getCompletions()/threshold, 1.840896416); - } - } - score = 0; - for (FloorSpecificData<DungeonStat.PlayedFloor> value : dStat.getPlays().values()) { - int runs = value.getData().getCompletions(); - int excess = 0; if (runs > 1000) { - excess = runs - 1000; runs = 1000; - } - - double floorScore = runs * completionFactor.get(value.getFloor()+7).getAsDouble(); - if (excess > 0) - floorScore *= Math.log10(excess / 1000.0 + 1) / Math.log10(5) + 1; - score += floorScore; - } - - masterCompWeight = score / mMax1000 * upperBound; - } - double dungeonXPWeight = 0; - { - double dungeonOverall = constants.get("dungeonOverall").getAsDouble(); - double dungeonMaxXP = constants.get("dungeonMaxXP").getAsDouble(); - - double cataXP = playerProfile.getDungeonStats().get(DungeonType.CATACOMBS).getData().getExperience(); - XPUtils.XPCalcResult xpCalcResult = XPUtils.getCataXp(cataXP); - double level = xpCalcResult.getLevel(); - if (xpCalcResult.getLevel() != 50) { - double progress = Math.floor(xpCalcResult.getRemainingXp() / xpCalcResult.getNextLvXp() * 1000) / 1000.0; - level += progress; - } - - double n; double tempLevel = 0; - if (cataXP < dungeonMaxXP) - n = 0.2 * Math.pow(level / 50.0, 2.967355422); - else { - double part = 142452410; - tempLevel = 50 + (cataXP - dungeonMaxXP) / part; - n = 0.2 * Math.pow(1 + ((tempLevel - 50) / 50), 2.967355422); - } - if (level != 0) { - if (cataXP < 569809640) dungeonXPWeight = dungeonOverall * (Math.pow(1.18340401286164044, (level + 1)) - 1.05994990217254) * (1 + n); - else dungeonXPWeight =4000 * (n / 0.15465244570598540); - } else dungeonXPWeight = 0; - } - double slayerWeight = 0; - { - JsonArray slayerDeprecationScaling = constants.getAsJsonArray("slayerDeprecationScaling"); - BiFunction<Double, Integer, Double> getSlayerWeight = (xp, type) -> { - double score = 0; - { - double d = xp / 100000; - if (xp >= 6416) { - double D = (d - Math.pow(3, (-5 / 2.0))) * (d + Math.pow(3, -5 / 2.0)); - double u = Math.cbrt(3 * (d + Math.sqrt(D))); - double v = Math.cbrt(3 * (d - Math.sqrt(D))); - score = u + v - 1; - } else { - score = Math.sqrt(4 / 3.0) * Math.cos(Math.acos(d * Math.pow(3, 5 / 2.0)) / 3) - 1; - } - } - score = Math.floor(score); - double scaling = slayerDeprecationScaling.get(type).getAsDouble(); - double effectiveXP = 0; - for (int i = 1; i <= score; i++) - effectiveXP += (i * i + i) * Math.pow(scaling, i); - effectiveXP = Math.round((1000000 * effectiveXP * (0.05 / scaling)) * 100) / 100.0; - double actualXP = ((score*score*score / 6) + (score*score / 2) + (score / 3)) * 100000; - double distance = xp - actualXP; - double effectiveDistance = distance * Math.pow(scaling, score); - return effectiveXP + effectiveDistance; - }; - - double zombie = getSlayerWeight.apply(slayerXP[0], 0); - double spider = getSlayerWeight.apply(slayerXP[1], 1); - double wolf = getSlayerWeight.apply(slayerXP[2], 2); - double enderman = getSlayerWeight.apply(slayerXP[3], 3); - double individual = zombie / 7000 + spider / 4800 + wolf / 2200 + enderman / 1000; - double extra = (slayerXP[0] + 1.6 * slayerXP[1] + 3.6 * slayerXP[2] + 10 * slayerXP[3]) / 900000; - slayerWeight = (individual + extra); - } - - PlayerProfile.LilyWeight lilyWeight = new PlayerProfile.LilyWeight(); - lilyWeight.setCatacombs_base(cataCompWeight); - lilyWeight.setCatacombs_master(masterCompWeight); - lilyWeight.setCatacombs_exp(dungeonXPWeight); - lilyWeight.setSkill_base(skillWeight); - lilyWeight.setSkill_overflow(overflowWeight); - lilyWeight.setSlayer(slayerWeight); - - playerProfile.setLilyWeight(lilyWeight); - } - - private static Skill getSkillByLilyName(String lilyName) { - switch(lilyName) { - case "experience_skill_enchanting": return Skill.ENCHANTING; - case "experience_skill_taming": return Skill.TAMING; - case "experience_skill_alchemy": return Skill.ALCHEMY; - case "experience_skill_mining": return Skill.MINING; - case "experience_skill_farming": return Skill.FARMING; - case "experience_skill_foraging": return Skill.FORAGING; - case "experience_skill_combat": return Skill.COMBAT; - case "experience_skill_fishing": return Skill.FISHING; - default: return null; - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/CachedData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/CachedData.java deleted file mode 100644 index 9213e2e5..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/CachedData.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class CachedData<T> { - private final long expire; - private final T data; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/ClassSpecificData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/ClassSpecificData.java deleted file mode 100644 index d1df192b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/ClassSpecificData.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -@Getter -public class ClassSpecificData<T> { - private final DungeonClass dungeonClass; - private final T data; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonClass.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonClass.java deleted file mode 100644 index a840d29e..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonClass.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.util.HashMap; -import java.util.Map; - -@Getter -@AllArgsConstructor -public enum DungeonClass { - MAGE("mage", "Mage"), ARCHER("archer","Archer"), HEALER("healer", "Healer"), TANK("tank", "Tank"), BERSERK("berserk", "Berserk"); - - - private final String jsonName; - private final String familarName; - private static final Map<String, DungeonClass> jsonNameToClazz = new HashMap<>(); - static { - for (DungeonClass value : values()) { - jsonNameToClazz.put(value.getJsonName(), value); - } - } - - public static DungeonClass getClassByJsonName(String name) { - return jsonNameToClazz.get(name); - } - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonSpecificData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonSpecificData.java deleted file mode 100644 index 56230e1f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonSpecificData.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor -public class DungeonSpecificData<T> { - private final DungeonType type; - private final T data; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonStat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonStat.java deleted file mode 100644 index 7fbe02df..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonStat.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import lombok.Data; - -import java.util.HashMap; -import java.util.Map; - -@Data -public class DungeonStat { - private int highestCompleted; - private double experience; - - private Map<Integer, FloorSpecificData<PlayedFloor>> plays = new HashMap<>(); - @Data - public static class PlayedFloor { - private int times_played; - private int completions; - private int watcherKills; - - private int fastestTime; - private int fastestTimeS; - private int fastestTimeSPlus; - private int bestScore; - - private int mostMobsKilled; - private int mobsKilled; - - private Map<DungeonClass, ClassSpecificData<ClassStatistics>> classStatistics = new HashMap<>(); - @Data - public static class ClassStatistics { - private double mostDamage; - } - - private double mostHealing; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonType.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonType.java deleted file mode 100644 index f1c443e4..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/DungeonType.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import com.google.common.collect.Sets; -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.util.Set; - -@Getter -@AllArgsConstructor -public enum DungeonType { - CATACOMBS("catacombs", "The Catacombs", - Sets.newHashSet(0,1,2,3,4,5,6,7)), - MASTER_CATACOMBS("master_catacombs", "MasterMode Catacombs", Sets.newHashSet( - 1,2,3,4,5,6 - )); - - private final String jsonName; - private final String familiarName; - private final Set<Integer> validFloors ; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/FloorSpecificData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/FloorSpecificData.java deleted file mode 100644 index 18641c79..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/FloorSpecificData.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor -public class FloorSpecificData<T> { - private final int floor; - private final T data; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/Pet.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/Pet.java deleted file mode 100644 index 99004cc1..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/Pet.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import lombok.Data; - -@Data -public class Pet { - private String uuid; - private String type; - private double exp; - private boolean active; - private String heldItem; - private String skin; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/PlayerProfile.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/PlayerProfile.java deleted file mode 100644 index 68de8b86..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/PlayerProfile.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import lombok.Data; -import net.minecraft.item.ItemStack; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Data -public class PlayerProfile { - private String profileUID; - private String memberUID; - private String profileName; - - private long lastSave; - - private int fairySouls; - private int fairyExchanges; - - private Armor currentArmor; - private List<Armor> wardrobe = new ArrayList<>(); - private int selectedWardrobe = -1; - - private ItemStack[] inventory; - private ItemStack[] enderchest; - private ItemStack[] talismans; - - private int totalSecrets; - - @Data - public static class Armor { - private final ItemStack[] armorSlots = new ItemStack[4]; - - public ItemStack getHelmet() { return armorSlots[3]; } - public ItemStack getChestPlate() { return armorSlots[2]; } - public ItemStack getLeggings() { return armorSlots[1]; } - public ItemStack getBoots() { return armorSlots[0]; } - } - - private Map<DungeonType, DungeonSpecificData<DungeonStat>> dungeonStats = new HashMap<>(); - - private Map<DungeonClass, ClassSpecificData<PlayerClassData>> playerClassData = new HashMap<>(); - private DungeonClass selectedClass; - @Data - public static class PlayerClassData { - private double experience; - } - - private Map<Skill, Double> skillXp; - - private List<Pet> pets = new ArrayList<>(); - - - private Map<String, Object> additionalProperties = new HashMap<>(); - - private LilyWeight lilyWeight; - - @Data - public static class LilyWeight { - private double skill_base; - private double skill_overflow; - private double catacombs_base; - private double catacombs_master; - private double catacombs_exp; - private double slayer; - - public double getTotal() { - return skill_base + skill_overflow + catacombs_base + catacombs_exp + catacombs_master + slayer; - } - } -}
\ No newline at end of file diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/Skill.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/Skill.java deleted file mode 100644 index f0d8e88b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/Skill.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor -public enum Skill { - RUNECRAFTING("runecrafting", "Runecrafting"), COMBAT("combat", "Combat"), MINING("mining", "Mining"), ALCHEMY("alchemy", "Alchemy"), FARMING("farming", "Farming"), TAMING("taming", "Taming"), ENCHANTING("enchanting", "Enchanting"), FISHING("fishing", "Fishing"), FORAGING("foraging", "Foraging"), CARPENTRY("carpentry", "Carpentry"); - - private final String jsonName; - private final String friendlyName; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/SkinFetchur.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/SkinFetchur.java deleted file mode 100644 index 29850132..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/SkinFetchur.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.api; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.minecraft.MinecraftProfileTexture; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.DefaultPlayerSkin; -import net.minecraft.client.resources.SkinManager; -import net.minecraft.util.ResourceLocation; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ConcurrentHashMap; - -public class SkinFetchur { - - private static final Map<String, CachedData<SkinSet>> skinSetMap = new ConcurrentHashMap<>(); - - private static final Map<String, CompletableFuture<SkinSet>> currentReq = new HashMap<>(); - - public static CompletableFuture<SkinSet> getSkinSet(GameProfile gameProfile) { - if (gameProfile == null) { - return CompletableFuture.completedFuture(new SkinSet(DefaultPlayerSkin.getDefaultSkinLegacy(), null, "default")); - } - if (skinSetMap.containsKey(gameProfile.getId().toString())) { - CachedData<SkinSet> ss = skinSetMap.get(gameProfile.getId().toString()); - if (ss.getExpire() > System.currentTimeMillis()) - CompletableFuture.completedFuture(skinSetMap.get(gameProfile.getId().toString()).getData()); - skinSetMap.remove(gameProfile.getId().toString()); - } - if (currentReq.containsKey(gameProfile.getId().toString())) - return currentReq.get(gameProfile.getId().toString()); - - SkinSet skinSet = new SkinSet(); - CompletableFuture<SkinSet> skinSet2 = new CompletableFuture<>(); - currentReq.put(gameProfile.getId().toString(), skinSet2); - Minecraft.getMinecraft().getSkinManager().loadProfileTextures(gameProfile, new SkinManager.SkinAvailableCallback() { - public void skinAvailable(MinecraftProfileTexture.Type p_180521_1_, ResourceLocation location, MinecraftProfileTexture profileTexture) { - switch (p_180521_1_) { - case SKIN: - skinSet.setSkinLoc(location); - skinSet.setSkinType(profileTexture.getMetadata("model")); - if (skinSet.getSkinType() == null) { - skinSet.setSkinType("default"); - } - skinSet2.complete(skinSet); - skinSetMap.put(gameProfile.getId().toString(), new CachedData<>(System.currentTimeMillis() + 1000*60*60*3, skinSet)); - currentReq.get(gameProfile.getId().toString()); - break; - case CAPE: - skinSet.setCapeLoc(location); - } - } - }, true); - - return skinSet2; - } - - @Data - @NoArgsConstructor - @AllArgsConstructor - public static class SkinSet { - private ResourceLocation skinLoc; - private ResourceLocation capeLoc; - private String skinType; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java deleted file mode 100644 index 98605169..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.customgui; - -import kr.syeyoung.dungeonsguide.events.WindowUpdateEvent; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.listener.GuiOpenListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiUpdateListener; -import kr.syeyoung.dungeonsguide.features.listener.*; -import lombok.Getter; -import lombok.Setter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.inventory.ContainerChest; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.client.event.GuiOpenEvent; - -public class FeatureCustomPartyFinder extends SimpleFeature implements GuiOpenListener, GuiUpdateListener { - public FeatureCustomPartyFinder() { - super("Party","Custom Party Finder","Custom Party Finder", "party.customfinder", true); - } - - @Getter - @Setter - private String whitelist = "", blacklist = "", highlight ="", blacklistClass = ""; - @Getter - @Setter - private int minimumCata; - - @Getter @Setter - private String lastClass = ""; - - GuiCustomPartyFinder guiCustomPartyFinder; - @Override - public void onGuiOpen(GuiOpenEvent event) { - if (event.gui == null) guiCustomPartyFinder = null; - if (!isEnabled()) return; - if (!(event.gui instanceof GuiChest)) return; - GuiChest chest = (GuiChest) event.gui; - if (!(chest.inventorySlots instanceof ContainerChest)) return; - ContainerChest containerChest = (ContainerChest) chest.inventorySlots; - IInventory lower = containerChest.getLowerChestInventory(); - if (lower == null || !lower.getName().equals("Party Finder")) return; - - if (guiCustomPartyFinder == null) { - guiCustomPartyFinder = new GuiCustomPartyFinder(); - } - guiCustomPartyFinder.setGuiChest(chest); - - event.gui = guiCustomPartyFinder; - } - - @Override - public void onGuiUpdate(WindowUpdateEvent windowUpdateEvent) { - if (guiCustomPartyFinder != null) { - guiCustomPartyFinder.onChestUpdate(windowUpdateEvent); - } - - if (Minecraft.getMinecraft().currentScreen instanceof GuiChest) { - GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; - - if (!(chest.inventorySlots instanceof ContainerChest)) return; - ContainerChest containerChest = (ContainerChest) chest.inventorySlots; - IInventory lower = containerChest.getLowerChestInventory(); - if (lower == null || !lower.getName().equals("Catacombs Gate")) return; - - ItemStack item = null; - if (windowUpdateEvent.getWindowItems() != null) { - item = windowUpdateEvent.getWindowItems().getItemStacks()[47]; - } else if (windowUpdateEvent.getPacketSetSlot() != null) { - if (windowUpdateEvent.getPacketSetSlot().func_149173_d() != 47) return; - item = windowUpdateEvent.getPacketSetSlot().func_149174_e(); - } - if (item == null) return; - - NBTTagCompound stackTagCompound = item.getTagCompound(); - if (stackTagCompound.hasKey("display", 10)) { - NBTTagCompound nbttagcompound = stackTagCompound.getCompoundTag("display"); - - if (nbttagcompound.getTagId("Lore") == 9) { - NBTTagList nbttaglist1 = nbttagcompound.getTagList("Lore", 8); - - for (int i = 0; i < nbttaglist1.tagCount(); i++) { - String str = nbttaglist1.getStringTagAt(i); - if (str.startsWith("§aCurrently Selected")) { - lastClass = str.substring(24); - } - } - } - } - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/GuiCustomPartyFinder.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/GuiCustomPartyFinder.java deleted file mode 100644 index a42b946f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/GuiCustomPartyFinder.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.customgui; - -import kr.syeyoung.dungeonsguide.events.WindowUpdateEvent; -import kr.syeyoung.dungeonsguide.gui.MGui; -import lombok.Getter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiChest; - -import java.awt.*; - -public class GuiCustomPartyFinder extends MGui { - @Getter - private GuiChest guiChest; - - public void setGuiChest(GuiChest guiChest) { - if (this.guiChest != null) this.guiChest.onGuiClosed(); - this.guiChest = guiChest; - panelPartyFinder.onChestUpdate(null); - guiChest.setWorldAndResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); - guiChest.initGui(); - } - - public void onChestUpdate(WindowUpdateEvent windowUpdateEvent) { - panelPartyFinder.onChestUpdate(windowUpdateEvent); - } - - private PanelPartyFinder panelPartyFinder; - public GuiCustomPartyFinder() { - panelPartyFinder = new PanelPartyFinder(this); - getMainPanel().add(panelPartyFinder); - } - - @Override - public void initGui() { - super.initGui(); - int width = 3*Minecraft.getMinecraft().displayWidth/5; - width = Math.max(width, 1000); - int height = 3*Minecraft.getMinecraft().displayHeight/5; - height = Math.max(height, 600); - - panelPartyFinder.setBounds(new Rectangle((Minecraft.getMinecraft().displayWidth-width)/2, (Minecraft.getMinecraft().displayHeight-height)/2, width, height)); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawDefaultBackground(); - super.drawScreen(mouseX, mouseY, partialTicks); - - } - - @Override - public void onGuiClosed() { - guiChest.onGuiClosed(); - guiChest = null; - super.onGuiClosed(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinder.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinder.java deleted file mode 100644 index 7a07ba2e..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinder.java +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.customgui; - -import kr.syeyoung.dungeonsguide.chat.PartyManager; -import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfigV2; -import kr.syeyoung.dungeonsguide.events.WindowUpdateEvent; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.impl.discord.invteTooltip.MTooltipInvite; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.rpc.RichPresenceManager; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import lombok.Getter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.inventory.Slot; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; - -import java.awt.*; -import java.util.HashMap; -import java.util.Map; - -public class PanelPartyFinder extends MPanel { - @Getter - private GuiCustomPartyFinder guiCustomPartyFinder; - - private PanelPartyFinderSettings panelPartyFinderSettings; - - private MScrollablePanel scrollablePanel; - private MList list; - - private MButton goBack; - - private MPanelScaledGUI navigation; - - private MButton previous; - private MButton next; - private MButton settings, discordInvite; - private int page = 1; - - private Map<Integer, PanelPartyListElement> panelPartyListElementMap = new HashMap<>(); - - public PanelPartyFinder(GuiCustomPartyFinder guiCustomPartyFinder) { - this.guiCustomPartyFinder = guiCustomPartyFinder; - - scrollablePanel = new MScrollablePanel(1); - panelPartyFinderSettings = new PanelPartyFinderSettings(this); - - - list = new MList() { - @Override - public void resize(int parentWidth, int parentHeight) { - setSize(new Dimension(parentWidth, 9999)); - realignChildren(); - } - }; - list.setGap(1); - - scrollablePanel.add(list); - - add(scrollablePanel); - add(panelPartyFinderSettings); - - previous = new MButton(); next = new MButton(); - previous.setText("Prev"); next.setText("Next"); - previous.setEnabled(false); next.setEnabled(false); - next.setOnActionPerformed(() -> { - GuiChest chest = getGuiCustomPartyFinder().getGuiChest(); - Minecraft.getMinecraft().playerController.windowClick(chest.inventorySlots.windowId, 9*2+8, 0, 0, Minecraft.getMinecraft().thePlayer); - }); - previous.setOnActionPerformed(() -> { - GuiChest chest = getGuiCustomPartyFinder().getGuiChest(); - Minecraft.getMinecraft().playerController.windowClick(chest.inventorySlots.windowId, 9*2, 0, 0, Minecraft.getMinecraft().thePlayer); - }); - goBack = new MButton(); - goBack.setBackground(RenderUtils.blendAlpha(0xFF141414, 0.05f)); - goBack.setText("<"); - goBack.setOnActionPerformed(() -> { - GuiChest chest = getGuiCustomPartyFinder().getGuiChest(); - Minecraft.getMinecraft().playerController.windowClick(chest.inventorySlots.windowId, 9*5+3, 0, 0, Minecraft.getMinecraft().thePlayer); - }); - add(goBack); - settings = new MButton(); - settings.setBackground(RenderUtils.blendAlpha(0xFF141414, 0.05f)); - settings.setText("Settings"); - settings.setOnActionPerformed(() -> { - GuiConfigV2 guiConfigV2 = new GuiConfigV2(); - guiConfigV2.getRootConfigPanel().setCurrentPageAndPushHistory("ROOT."+ FeatureRegistry.PARTYKICKER_CUSTOM.getCategory()); - Minecraft.getMinecraft().displayGuiScreen(guiConfigV2); - }); - discordInvite = new MButton(); - discordInvite.setText("Invite Discord Friends"); - discordInvite.setOnActionPerformed(() -> { - if (RichPresenceManager.INSTANCE.getLastSetupCode() == -9999) { - MModalMessage mTooltipInvite = new MModalMessage("Error", "Discord GameSDK has been disabled, or it failed to load", () -> {}); - mTooltipInvite.setScale( new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor()); - mTooltipInvite.open(this); - } else if (PartyManager.INSTANCE.getAskToJoinSecret() != null) { - MTooltipInvite mTooltipInvite = new MTooltipInvite(); - mTooltipInvite.setScale( new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor()); - mTooltipInvite.open(this); - } else { - MModalMessage mTooltipInvite = new MModalMessage("Error", "You need to have Ask To Join Enabled to use this feature. Run /dg atj to enable ask to join", () -> {}); - mTooltipInvite.setScale( new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor()); - mTooltipInvite.open(this); - } - }); - discordInvite.setBackground(RenderUtils.blendAlpha(0xFF141414, 0.05f)); - add(discordInvite); - add(settings); - navigation = new MPanelScaledGUI() { - @Override - public void onBoundsUpdate() { - super.onBoundsUpdate(); - Dimension dimension = getEffectiveDimension(); - previous.setBounds(new Rectangle(0,0,50,dimension.height)); - next.setBounds(new Rectangle(dimension.width-50,0,50,dimension.height)); - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - super.render(absMousex, absMousey, relMousex0, relMousey0, partialTicks, scissor); - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - Gui.drawRect(0,0,getEffectiveDimension().width, getEffectiveDimension().height, RenderUtils.blendAlpha(0xFF141414, 0.08f)); - fr.drawString("Page "+page, (getEffectiveDimension().width-fr.getStringWidth("Page "+page))/2, (getEffectiveDimension().height-fr.FONT_HEIGHT)/2, -1); - } - }; - navigation.add(next); navigation.add(previous); - add(navigation); - } - - public String getHighlightNote() { - return panelPartyFinderSettings.getHighlightText(); - } - - @Override - public void setBounds(Rectangle bounds) { - super.setBounds(bounds); - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - panelPartyFinderSettings.setBounds(new Rectangle(3*bounds.width/5+1, fr.FONT_HEIGHT*2+21, 2*bounds.width/5 -1, (bounds.height-fr.FONT_HEIGHT*2-21))); - panelPartyFinderSettings.setScale(scaledResolution.getScaleFactor()); - - navigation.setBounds(new Rectangle(0,fr.FONT_HEIGHT*2 + 21, 3*bounds.width/5, 20*scaledResolution.getScaleFactor())); - navigation.setScale(scaledResolution.getScaleFactor()); - scrollablePanel.setBounds(new Rectangle(0, navigation.getBounds().y+navigation.getBounds().height, 3*bounds.width/5, bounds.height - (navigation.getBounds().y+navigation.getBounds().height))); - goBack.setBounds(new Rectangle(0,0, fr.FONT_HEIGHT*2+20, fr.FONT_HEIGHT*2+20)); - settings.setBounds(new Rectangle(bounds.width - 75, 0, 75, fr.FONT_HEIGHT*2+20)); - discordInvite.setBounds(new Rectangle(bounds.width-275, 0, 200, fr.FONT_HEIGHT*2+20)); - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - // background - Gui.drawRect(0,0,getBounds().width, getBounds().height, RenderUtils.blendAlpha(0xFF141414, 0.0f)); - // top bar - Gui.drawRect(0,0,getBounds().width, fr.FONT_HEIGHT*2+21, RenderUtils.blendAlpha(0xFF141414, 0.05f)); - // lines - Gui.drawRect(0,fr.FONT_HEIGHT*2+20,getBounds().width, fr.FONT_HEIGHT*2+21, -1); - Gui.drawRect(panelPartyFinderSettings.getBounds().x-1,fr.FONT_HEIGHT*2+20,panelPartyFinderSettings.getBounds().x, getBounds().height, -1); - // prev next bar - - GlStateManager.pushMatrix(); - GlStateManager.translate(fr.FONT_HEIGHT*2+21, 0,0); - GlStateManager.scale(2,2,1); - fr.drawString("Party Finder", 5,5,-1); - GlStateManager.popMatrix(); - } - - public synchronized void onChestUpdate(WindowUpdateEvent windowUpdateEvent) { - if (windowUpdateEvent == null) { - GuiChest guiChest = guiCustomPartyFinder.getGuiChest(); - if (guiChest == null) { - panelPartyListElementMap.clear(); - } else { - for (int x = 1; x<=7; x++) { - for (int y = 1; y <= 3; y++) { - int i = y * 9 + x; - Slot s = guiChest.inventorySlots.getSlot(i); - PanelPartyListElement prev = panelPartyListElementMap.remove(i); - if (s == null || !s.getHasStack()) { continue; } - if (!filter(s.getStack())) continue; - - if (prev == null) prev = new PanelPartyListElement(this, i); - panelPartyListElementMap.put(i, prev); - } - } - - { - Slot next = guiChest.inventorySlots.getSlot(9 * 2 + 8); - if (next.getStack() != null && next.getStack().getItem() == Items.arrow) { - this.next.setEnabled(true); - extractPage(next.getStack()); - } else { - this.next.setEnabled(false); - } - - Slot prev = guiChest.inventorySlots.getSlot(9 * 2 + 0); - if (prev.getStack() != null && prev.getStack().getItem() == Items.arrow) { - this.previous.setEnabled(true); - extractPage(prev.getStack()); - } else { - this.previous.setEnabled(false); - } - - Slot delist = guiChest.inventorySlots.getSlot(9 * 5 + 7); - panelPartyFinderSettings.setDelistable(delist.getStack() != null && delist.getStack().getItem() == Item.getItemFromBlock(Blocks.bookshelf)); - } - } - } else { - if (windowUpdateEvent.getPacketSetSlot() != null) { - int i = windowUpdateEvent.getPacketSetSlot().func_149173_d(); - - ItemStack stack = windowUpdateEvent.getPacketSetSlot().func_149174_e(); - if (i == 9*2+8) { - if (stack != null && stack.getItem() == Items.arrow) { - this.next.setEnabled(true); - extractPage(stack); - } else { - this.next.setEnabled(false); - } - } else if (i == 9*2) { - if (stack != null && stack.getItem() == Items.arrow) { - this.previous.setEnabled(true); - extractPage(stack); - } else { - this.previous.setEnabled(false); - } - } else if (i == 9*5+7) { - panelPartyFinderSettings.setDelistable(stack != null && stack.getItem() == Item.getItemFromBlock(Blocks.bookshelf)); - } - - if (i%9 == 0 || i%9 == 8 || i/9 == 0 || i/9 >= 4) { - return; - } - - PanelPartyListElement prev = panelPartyListElementMap.remove(i); - if (filter(stack)) { - if (prev == null) prev = new PanelPartyListElement(this, i); - panelPartyListElementMap.put(i, prev); - } - } else if (windowUpdateEvent.getWindowItems() != null) { - for (int x = 1; x<=7; x++) { - for (int y = 1; y <= 3; y++) { - int i = y * 9 + x; - ItemStack item = windowUpdateEvent.getWindowItems().getItemStacks()[i]; - PanelPartyListElement prev = panelPartyListElementMap.remove(i); - if (!filter(item)) continue; - - if (prev == null) prev = new PanelPartyListElement(this, i); - panelPartyListElementMap.put(i, prev); - } - } - - { - ItemStack next = windowUpdateEvent.getWindowItems().getItemStacks()[9 * 2 + 8]; - if (next != null && next.getItem() == Items.arrow) { - this.next.setEnabled(true); - extractPage(next); - } else { - this.next.setEnabled(false); - } - - ItemStack prev = windowUpdateEvent.getWindowItems().getItemStacks()[9 * 2]; - if (prev != null && prev.getItem() == Items.arrow) { - this.previous.setEnabled(true); - extractPage(prev); - } else { - this.previous.setEnabled(false); - } - - ItemStack delist = windowUpdateEvent.getWindowItems().getItemStacks()[9*5+7]; - panelPartyFinderSettings.setDelistable(delist != null && delist.getItem() == Item.getItemFromBlock(Blocks.bookshelf)); - } - } - } - - addItems(); - } - - public boolean filter(ItemStack item) { - return !(item == null || item.getItem() == null || item.getItem() == Item.getItemFromBlock(Blocks.air)) && panelPartyFinderSettings.filter(item); - } - - public void extractPage(ItemStack itemStack) { - NBTTagCompound stackTagCompound = itemStack.getTagCompound(); - if (stackTagCompound.hasKey("display", 10)) { - NBTTagCompound nbttagcompound = stackTagCompound.getCompoundTag("display"); - - if (nbttagcompound.getTagId("Lore") == 9) { - NBTTagList nbttaglist1 = nbttagcompound.getTagList("Lore", 8); - - for (int i = 0; i < nbttaglist1.tagCount(); i++) { - String str = nbttaglist1.getStringTagAt(i); - if (str.startsWith("§ePage ")) { - int pg = Integer.parseInt(str.substring(7)); - if (itemStack.getDisplayName().equals("§aPrevious Page")) page = pg+1; - else page = pg-1; - } - } - } - } - } - - public void addItems() { - for (MPanel childComponent : list.getChildComponents()) { - list.remove(childComponent); - } - for (Map.Entry<Integer, PanelPartyListElement> value : panelPartyListElementMap.entrySet()) { - list.add(value.getValue()); - } - scrollablePanel.evalulateContentArea(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinderSettings.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinderSettings.java deleted file mode 100644 index d59d1640..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyFinderSettings.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.customgui; - -import kr.syeyoung.dungeonsguide.chat.ChatProcessor; -import kr.syeyoung.dungeonsguide.chat.PartyManager; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.gui.elements.*; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import lombok.Getter; -import lombok.Setter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.init.Items; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.EnumChatFormatting; - -import java.awt.*; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class PanelPartyFinderSettings extends MPanelScaledGUI { - private PanelPartyFinder panelPartyFinder; - - private MButton refresh = new MButton(), createNew = new MButton(), settings = new MButton(); - private MPassiveLabelAndElement filterCantjoin, filterWhitelistNote, filterBlacklistNote, plaeHighlightNote, cataLv,blacklistClass; private MToggleButton filterCantjoinButton; - private MTextField filterWhitelist, filterBlacklist, highlightNote, blacklistClassTxt; - private MIntegerSelectionButton integerSelection; - - @Getter @Setter - boolean delistable = false; - - public void setDelistable(boolean delistable) { - this.delistable = delistable; - updateCreateNew(); - } - - public void updateCreateNew() { - createNew.setText((PartyManager.INSTANCE.getPartyContext() != null && !PartyManager.INSTANCE.isLeader()) ? "Leave Party" : (delistable ? "De-list" : "Create New")); - } - - public PanelPartyFinderSettings(PanelPartyFinder panelPartyFinder) { - this.panelPartyFinder = panelPartyFinder; - - createNew.setOnActionPerformed(this::createNew); - createNew.setBackground(0xFF00838F); - createNew.setHover(0xFF00ACC1); - createNew.setClicked(0xFF0097A7); - add(createNew); - updateCreateNew(); - refresh.setText("Refresh"); - refresh.setOnActionPerformed(this::refresh); - add(refresh); - - settings.setText("Search Settings"); - settings.setOnActionPerformed(this::settings); - add(settings); - - { - filterCantjoinButton = new MToggleButton(); - filterCantjoin = new MPassiveLabelAndElement("Filter Unjoinable", filterCantjoinButton); - filterCantjoin.setDivideRatio(0.7); - filterCantjoinButton.setOnToggle(() -> panelPartyFinder.onChestUpdate(null)); - add(filterCantjoin); - } - { - filterWhitelist = new MTextField() { - @Override - public void edit(String str) { - panelPartyFinder.onChestUpdate(null); - FeatureRegistry.PARTYKICKER_CUSTOM.setWhitelist(str); - } - }; - filterBlacklist = new MTextField() { - @Override - public void edit(String str) { - FeatureRegistry.PARTYKICKER_CUSTOM.setBlacklist(str); - panelPartyFinder.onChestUpdate(null); - } - }; - highlightNote = new MTextField() { - @Override - public void edit(String str) { - super.edit(str); - FeatureRegistry.PARTYKICKER_CUSTOM.setHighlight(str); - } - }; - blacklistClassTxt = new MTextField() { - @Override - public void edit(String str) { - super.edit(str); - FeatureRegistry.PARTYKICKER_CUSTOM.setBlacklistClass(str); - panelPartyFinder.onChestUpdate(null); - } - }; - - filterWhitelist.setText(FeatureRegistry.PARTYKICKER_CUSTOM.getWhitelist()); - filterBlacklist.setText(FeatureRegistry.PARTYKICKER_CUSTOM.getBlacklist()); - highlightNote.setText(FeatureRegistry.PARTYKICKER_CUSTOM.getHighlight()); - blacklistClassTxt.setText(FeatureRegistry.PARTYKICKER_CUSTOM.getBlacklistClass()); - - filterWhitelistNote = new MPassiveLabelAndElement("Whitelist Note", filterWhitelist); - filterBlacklistNote = new MPassiveLabelAndElement("Blacklist Note", filterBlacklist); - plaeHighlightNote = new MPassiveLabelAndElement("Highlight Note", highlightNote); - blacklistClass = new MPassiveLabelAndElement("Blacklist Class", blacklistClassTxt); - - filterWhitelistNote.setDivideRatio(0.5); - filterBlacklistNote.setDivideRatio(0.5); - plaeHighlightNote.setDivideRatio(0.5); - blacklistClass.setDivideRatio(0.5); - add(filterWhitelistNote); - add(filterBlacklistNote); - add(plaeHighlightNote); - add(blacklistClass); - } - { - integerSelection = new MIntegerSelectionButton(FeatureRegistry.PARTYKICKER_CUSTOM.getMinimumCata()); - integerSelection.setOnUpdate(() -> { - FeatureRegistry.PARTYKICKER_CUSTOM.setMinimumCata(integerSelection.getData()); - panelPartyFinder.onChestUpdate(null); - }); - cataLv = new MPassiveLabelAndElement("Minimum Cata Lv", integerSelection); - cataLv.setDivideRatio(0.5); add(cataLv); - } - } - - private void createNew() { - if (PartyManager.INSTANCE.getPartyContext() != null && !PartyManager.INSTANCE.isLeader()) { - ChatProcessor.INSTANCE.addToChatQueue("/p leave ", () -> {}, true); - return; - } - GuiChest chest = panelPartyFinder.getGuiCustomPartyFinder().getGuiChest(); - if (delistable) - Minecraft.getMinecraft().playerController.windowClick(chest.inventorySlots.windowId, 9*5+7, 0, 0, Minecraft.getMinecraft().thePlayer); - else - Minecraft.getMinecraft().playerController.windowClick(chest.inventorySlots.windowId, 9*5+0, 0, 0, Minecraft.getMinecraft().thePlayer); - - } - - public String getHighlightText() { - return highlightNote.getText(); - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; - - - GuiCustomPartyFinder guiCustomPartyFinder = panelPartyFinder.getGuiCustomPartyFinder(); - if (guiCustomPartyFinder.getGuiChest() == null) return; - Slot s = guiCustomPartyFinder.getGuiChest().inventorySlots.getSlot(9*5+5); - ItemStack itemStack = s.getStack(); - if (itemStack == null) return; - - String dungeon="", floor="", text=""; - { - NBTTagCompound stackTagCompound = itemStack.getTagCompound(); - if (stackTagCompound.hasKey("display", 10)) { - NBTTagCompound nbttagcompound = stackTagCompound.getCompoundTag("display"); - - if (nbttagcompound.getTagId("Lore") == 9) { - NBTTagList nbttaglist1 = nbttagcompound.getTagList("Lore", 8); - - for (int i = 0; i < nbttaglist1.tagCount(); i++) { - String str = nbttaglist1.getStringTagAt(i); - if (str.startsWith("§aDungeon: ")) { - dungeon = str.substring(11); - } else if (str.startsWith("§aFloor: ")) { - floor = str.substring(9); - } else if (str.startsWith("§aSearch text: ")) { - text = str.substring(15); - } - } - } - } - } - fontRenderer.drawString("§aSearching: "+dungeon+" §7- "+floor, 5,155,-1); - fontRenderer.drawString("§aSearch text: "+text, 5,155+fontRenderer.FONT_HEIGHT,-1); - - Gui.drawRect(0,160+fontRenderer.FONT_HEIGHT*2,getBounds().width, 161+fontRenderer.FONT_HEIGHT*2, -1); - GlStateManager.translate(5,165+fontRenderer.FONT_HEIGHT*2,0); - - s = guiCustomPartyFinder.getGuiChest().inventorySlots.getSlot(9*5+8); - itemStack = s.getStack(); - if (itemStack == null || itemStack.getItem() != Items.skull) return; - - List<String> list = itemStack.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips); - for (int i = 0; i < list.size(); ++i) { - if (i == 0) { - list.set(i, itemStack.getRarity().rarityColor + list.get(i)); - } else { - list.set(i, EnumChatFormatting.GRAY + list.get(i)); - } - } - for (int i = 0; i < list.size(); i++) { - fontRenderer.drawString(list.get(i), 0, (i)*fontRenderer.FONT_HEIGHT, -1); - } - } - - public void refresh() { - GuiChest chest = panelPartyFinder.getGuiCustomPartyFinder().getGuiChest(); - Minecraft.getMinecraft().playerController.windowClick(chest.inventorySlots.windowId, 9*5+1, 0, 0, Minecraft.getMinecraft().thePlayer); - } - public void settings() { - GuiChest chest = panelPartyFinder.getGuiCustomPartyFinder().getGuiChest(); - Minecraft.getMinecraft().playerController.windowClick(chest.inventorySlots.windowId, 9*5+5, 0, 0, Minecraft.getMinecraft().thePlayer); - } - - @Override - public void onBoundsUpdate() { - Dimension bounds = getEffectiveDimension(); - refresh.setBounds(new Rectangle(5,5,(bounds.width-10)/2,15)); - createNew.setBounds(new Rectangle(bounds.width/2,5,(bounds.width-10)/2,15)); - filterCantjoin.setBounds(new Rectangle(5,22,bounds.width-10,15)); - filterWhitelistNote.setBounds(new Rectangle(5,39,bounds.width-10,15)); - filterBlacklistNote.setBounds(new Rectangle(5,56,bounds.width-10,15)); - plaeHighlightNote.setBounds(new Rectangle(5,73,bounds.width-10,15)); - cataLv.setBounds(new Rectangle(5,90,bounds.width-10,15)); - blacklistClass.setBounds(new Rectangle(5,107,bounds.width-10,15)); - settings.setBounds(new Rectangle(5,124,bounds.width-10,15)); - } - - public boolean filter(ItemStack itemStack) { - NBTTagCompound stackTagCompound = itemStack.getTagCompound(); - String note = ""; - int dLV = 0; - Set<String> invalidClasses = new HashSet<>(); - for (String s : blacklistClassTxt.getText().split(",")) { - invalidClasses.add(s.toLowerCase()); - } - if (stackTagCompound.hasKey("display", 10)) { - NBTTagCompound nbttagcompound = stackTagCompound.getCompoundTag("display"); - - if (nbttagcompound.getTagId("Lore") == 9) { - NBTTagList nbttaglist1 = nbttagcompound.getTagList("Lore", 8); - - for (int i = 0; i < nbttaglist1.tagCount(); i++) { - String str = nbttaglist1.getStringTagAt(i); - if (str.startsWith("§cRequires ") && filterCantjoinButton.isEnabled()) return false; - if (str.startsWith("§7§7Note:")) { - note = str.substring(12); - } - if (str.startsWith("§7Dungeon Level Required: §b")) { - dLV = Integer.parseInt(str.substring(28)); - } - if (str.startsWith(" ") && str.contains(":")) { - String clazz = TextUtils.stripColor(str).trim().split(" ")[1]; - if (invalidClasses.contains(clazz.toLowerCase())) return false; - } - } - } - } - if (integerSelection.getData() >dLV) return false; - - if (!filterBlacklist.getText().isEmpty()) { - for (String s1 : filterBlacklist.getText().split(",")) { - if (note.toLowerCase().contains(s1.toLowerCase())) return false; - } - } - if (!filterWhitelist.getText().isEmpty()) { - boolean s = false; - for (String s1 : filterWhitelist.getText().split(",")) { - if (note.toLowerCase().contains(s1.toLowerCase())) { - s = true; break; - } - } - if (!s) return false; - } - return true; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java deleted file mode 100644 index 67771f46..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.customgui; - -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MTooltip; -import kr.syeyoung.dungeonsguide.gui.elements.MTooltipText; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.init.Blocks; -import net.minecraft.inventory.Slot; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.EnumChatFormatting; - -import java.awt.*; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class PanelPartyListElement extends MPanel { - private PanelPartyFinder panelPartyFinder; - private int slot; - - public PanelPartyListElement(PanelPartyFinder panelPartyFinder, int slot) { - this.panelPartyFinder = panelPartyFinder; - this.slot = slot; - } - - @Override - public Dimension getPreferredSize() { - return new Dimension(-1, 32); - } - - private MTooltip mTooltip; - - private ItemStack lastStack; - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - GuiCustomPartyFinder guiCustomPartyFinder = panelPartyFinder.getGuiCustomPartyFinder(); - if (guiCustomPartyFinder.getGuiChest() == null) return; - Slot s = guiCustomPartyFinder.getGuiChest().inventorySlots.getSlot(slot); - ItemStack itemStack = s.getStack(); - if (itemStack == null && lastStack == null) return; - if (itemStack != null) - lastStack = itemStack; - else - itemStack = lastStack; - int color = RenderUtils.blendAlpha(0x141414, 0.0f); - - String note = ""; - boolean notfound = false; - boolean cantjoin = false; - if (itemStack.getItem() == Item.getItemFromBlock(Blocks.bedrock)) { - cantjoin = true; - notfound = true; - } - int minClass = -1, minDungeon = -1; - int pplIn = 0; - Set<String> dungeonClasses = new HashSet<>(); - { - NBTTagCompound stackTagCompound = itemStack.getTagCompound(); - if (stackTagCompound.hasKey("display", 10)) { - NBTTagCompound nbttagcompound = stackTagCompound.getCompoundTag("display"); - - if (nbttagcompound.getTagId("Lore") == 9) { - NBTTagList nbttaglist1 = nbttagcompound.getTagList("Lore", 8); - - for (int i = 0; i < nbttaglist1.tagCount(); i++) { - String str = nbttaglist1.getStringTagAt(i); - if (str.startsWith("§7§7Note:")) { - note = str.substring(12); - } else if (str.startsWith("§7Class Level Required: §b")) { - minClass = Integer.parseInt(str.substring(26)); - } else if (str.startsWith("§7Dungeon Level Required: §b")) { - minDungeon = Integer.parseInt(str.substring(28)); - } else if (str.startsWith("§cRequires ")) cantjoin = true; - if (str.endsWith("§b)")) pplIn ++; - - if (str.startsWith(" ") && str.contains(":")) { - String clazz = TextUtils.stripColor(str).trim().split(" ")[1]; - dungeonClasses.add(clazz); - } - } - } - } - } - - boolean nodupe = note.toLowerCase().contains("nodupe") || note.toLowerCase().contains("no dupe") || (note.toLowerCase().contains("nd") && (note.toLowerCase().indexOf("nd") == 0 || note.charAt(note.toLowerCase().indexOf("nd")-1) == ' ')); - - note = note.replaceAll("(?i)(S\\+)", "§6$1§r"); - note = note.replaceAll("(?i)(carry)", "§4$1§r"); - - try { - if (!panelPartyFinder.getHighlightNote().isEmpty()) { - for (String s1 : panelPartyFinder.getHighlightNote().split(",")) { - note = note.replaceAll("(?i)(" + s1 + ")", "§e§l$1§r"); - } - } - } catch (Exception e) {} - - if (cantjoin) {} - else if (clicked) { - color = RenderUtils.blendAlpha(0x141414, 0.10f); - } else if (lastAbsClip.contains(absMousex, absMousey) && (getTooltipsOpen() == 0 || (mTooltip != null && mTooltip.isOpen()))) { - color = RenderUtils.blendAlpha(0x141414, 0.12f); - } - if (cantjoin) {} - else if (note.contains("§e")) { - color = RenderUtils.blendTwoColors(color, 0x44FFFF00); - } else if (note.contains("§6")){ - color = RenderUtils.blendTwoColors(color, 0x44FFAA00); - } - - if (nodupe && dungeonClasses.contains(FeatureRegistry.PARTYKICKER_CUSTOM.getLastClass())) { - color = RenderUtils.blendTwoColors(color, 0x44FF0000); - note = note.replace("nodupe", "§cnodupe§r").replace("no dupe", "§cno dupe§r").replace("nd", "§cnd§r"); - } - Gui.drawRect(0,0,getBounds().width,getBounds().height,color); - - RenderItem renderItem= Minecraft.getMinecraft().getRenderItem(); - GlStateManager.pushMatrix(); - RenderHelper.disableStandardItemLighting(); - RenderHelper.enableGUIStandardItemLighting(); - GlStateManager.scale(2,2,1); - GlStateManager.enableDepth(); - renderItem.renderItemAndEffectIntoGUI(itemStack, 0,0); - GlStateManager.popMatrix(); - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - GlStateManager.pushMatrix(); - GlStateManager.translate(37,(32 - 2*fr.FONT_HEIGHT)/2,0); - GlStateManager.scale(2,2,1); - String name = itemStack.getDisplayName(); - if (name.contains("'")) - name = name.substring(0, name.indexOf("'")); - fr.drawString(name, 0,0,-1); - - if (!notfound) - note = "§7("+pplIn+") §f"+note; - fr.drawString(note, fr.getStringWidth("AAAAAAAAAAAAAAAA")+5, 0,-1); - GlStateManager.popMatrix(); - GlStateManager.pushMatrix(); - String sideNote = ""; - if (minClass != -1) sideNote += "§7CLv ≥§b"+minClass+" "; - if (minDungeon != -1) sideNote += "§7DLv ≥§b"+minDungeon+" "; - if (cantjoin && !notfound) sideNote = "§cCan't join"; - sideNote = sideNote.trim(); - - GlStateManager.translate(getBounds().width,(32 - 2*fr.FONT_HEIGHT)/2,0); - GlStateManager.scale(2,2,0); - GlStateManager.translate(-fr.getStringWidth(sideNote), 0,0); - fr.drawString(sideNote, 0,0,-1); - - GlStateManager.popMatrix(); - if (lastAbsClip.contains(absMousex, absMousey) && (mTooltip == null || !mTooltip.isOpen()) && getTooltipsOpen() == 0) { - if (mTooltip != null) mTooltip.close(); - List<String> list = itemStack.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips); - for (int i = 0; i < list.size(); ++i) { - if (i == 0) { - list.set(i, itemStack.getRarity().rarityColor + list.get(i)); - } else { - list.set(i, EnumChatFormatting.GRAY + list.get(i)); - } - } - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - mTooltip = new MTooltipText(list); - mTooltip.setScale(scaledResolution.getScaleFactor()); - mTooltip.open(this); - } else if (!lastAbsClip.contains(absMousex, absMousey)){ - if (mTooltip != null) - mTooltip.close(); - mTooltip = null; - } - } - - @Override - public void setParent(MPanel parent) { - super.setParent(parent); - if (parent == null && mTooltip != null) { - mTooltip.close(); - mTooltip = null; - } - } - - boolean clicked = false; - @Override - public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - if (lastAbsClip.contains(absMouseX, absMouseY)&& (getTooltipsOpen() == 0 || (mTooltip != null && mTooltip.isOpen()))) { - clicked = true; - - GuiChest chest = panelPartyFinder.getGuiCustomPartyFinder().getGuiChest(); - Minecraft.getMinecraft().playerController.windowClick(chest.inventorySlots.windowId, slot, 0, 0, Minecraft.getMinecraft().thePlayer); - } - } - - @Override - public void mouseReleased(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int state) { - clicked = false; - } - - @Override - public void mouseMoved(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0) { - if (lastAbsClip.contains(absMouseX, absMouseY) && (getTooltipsOpen() == 0 || (mTooltip != null && mTooltip.isOpen()))) { - setCursor(EnumCursor.POINTING_HAND); - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonFloorStat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonFloorStat.java deleted file mode 100644 index a1b1d36b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonFloorStat.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import kr.syeyoung.dungeonsguide.features.impl.party.api.*; -import kr.syeyoung.dungeonsguide.features.impl.party.api.*; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraftforge.fml.client.config.GuiUtils; - -import java.awt.*; -import java.util.Arrays; - -public class DataRenderDungeonFloorStat implements DataRenderer { - private final DungeonType dungeonType; - private final int floor; - public DataRenderDungeonFloorStat(DungeonType dungeonType, int floor) { - this.dungeonType = dungeonType; - this.floor = floor; - } - - @Override - public Dimension renderData(PlayerProfile playerProfile) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - String floorName = (dungeonType == DungeonType.CATACOMBS ? "F" : "M") + floor; - - boolean flag = false; - DungeonSpecificData<DungeonStat> dungeonStatDungeonSpecificData = playerProfile.getDungeonStats().get(dungeonType); - if (dungeonStatDungeonSpecificData != null) { - FloorSpecificData<DungeonStat.PlayedFloor> playedFloorFloorSpecificData = dungeonStatDungeonSpecificData.getData().getPlays().get(floor); - if (playedFloorFloorSpecificData != null) { - flag = true; - fr.drawString("§b" + floorName + " §a" + playedFloorFloorSpecificData.getData().getBestScore() + " §f" + playedFloorFloorSpecificData.getData().getCompletions() + "§7/§f" + playedFloorFloorSpecificData.getData().getWatcherKills() + "§7/§f" + playedFloorFloorSpecificData.getData().getTimes_played() + " §7(" + (int) (playedFloorFloorSpecificData.getData().getCompletions()*100 / (double) playedFloorFloorSpecificData.getData().getWatcherKills()) + "%)", 0, 0, -1); - fr.drawString("§6S+ §e" + (playedFloorFloorSpecificData.getData().getFastestTimeSPlus() != -1 ? TextUtils.formatTime(playedFloorFloorSpecificData.getData().getFastestTimeSPlus()) : "§7N/A") + " §6S §e" + (playedFloorFloorSpecificData.getData().getFastestTimeS() != -1 ? TextUtils.formatTime(playedFloorFloorSpecificData.getData().getFastestTimeS()) : "§7N/A"), 0, fr.FONT_HEIGHT, -1); - } - } - if (!flag) { - fr.drawString("§cNo Stat for "+floorName, 0,0,-1); - } - - return getDimension(); - } - - @Override - public Dimension renderDummy() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - String floorName = (dungeonType == DungeonType.CATACOMBS ? "F" : "M") + floor; - - - fr.drawString("§b"+floorName+" §a305 §f10§7/§f35§7/§f50 §7("+(int)(1000.0/35.0)+"%)", 0,0,-1); - fr.drawString("§6S+ §e10m 53s §6S §e15m 13s", 0, fr.FONT_HEIGHT, -1); - return getDimension(); - } - - @Override - public Dimension getDimension() { - return new Dimension(100, Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT*2); - } - - @Override - public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) { - - DungeonSpecificData<DungeonStat> dungeonStatDungeonSpecificData = playerProfile.getDungeonStats().get(dungeonType); - if (dungeonStatDungeonSpecificData == null) return; - FloorSpecificData<DungeonStat.PlayedFloor> playedFloorFloorSpecificData = dungeonStatDungeonSpecificData.getData().getPlays().get(floor); - if (playedFloorFloorSpecificData == null) return; - String floorName = (dungeonType == DungeonType.CATACOMBS ? "F" : "M") + floor; - - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GuiUtils.drawHoveringText(Arrays.asList( - "§bFloor "+floorName, - "§bBest Score§7: §f"+playedFloorFloorSpecificData.getData().getBestScore(), - "§bTotal Completions§7: §f"+playedFloorFloorSpecificData.getData().getCompletions(), - "§bTotal Watcher kills§7: §f"+playedFloorFloorSpecificData.getData().getWatcherKills(), - "§bTotal Runs§7: §f"+playedFloorFloorSpecificData.getData().getTimes_played(), - "§bFastest S+§7: §f"+(playedFloorFloorSpecificData.getData().getFastestTimeSPlus() != -1? TextUtils.formatTime(playedFloorFloorSpecificData.getData().getFastestTimeSPlus()) : "§7N/A"), - "§bFastest S§7: §f"+(playedFloorFloorSpecificData.getData().getFastestTimeS() != -1? TextUtils.formatTime(playedFloorFloorSpecificData.getData().getFastestTimeS()) : "§7N/A"), - "§bFastest Run§7: §f"+(playedFloorFloorSpecificData.getData().getFastestTime() != -1? TextUtils.formatTime(playedFloorFloorSpecificData.getData().getFastestTime()) : "§7N/A"), - "§bMost Mobs Killed§7: §f"+playedFloorFloorSpecificData.getData().getMostMobsKilled(), - "§bTotal Mobs Killed§7: §f"+playedFloorFloorSpecificData.getData().getMobsKilled() - ), mouseX, mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, Minecraft.getMinecraft().fontRendererObj); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonHighestFloorStat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonHighestFloorStat.java deleted file mode 100644 index 7ab9a396..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonHighestFloorStat.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import kr.syeyoung.dungeonsguide.features.impl.party.api.*; -import kr.syeyoung.dungeonsguide.features.impl.party.api.*; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraftforge.fml.client.config.GuiUtils; - -import java.awt.*; -import java.util.Arrays; - -public class DataRenderDungeonHighestFloorStat implements DataRenderer { - private final DungeonType dungeonType; - public DataRenderDungeonHighestFloorStat(DungeonType dungeonType) { - this.dungeonType = dungeonType; - } - - @Override - public Dimension renderData(PlayerProfile playerProfile) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - - boolean flag = false; - DungeonSpecificData<DungeonStat> dungeonStatDungeonSpecificData = playerProfile.getDungeonStats().get(dungeonType); - if (dungeonStatDungeonSpecificData != null) { - if (dungeonStatDungeonSpecificData.getData().getHighestCompleted() != -1) { - FloorSpecificData<DungeonStat.PlayedFloor> playedFloorFloorSpecificData = dungeonStatDungeonSpecificData.getData().getPlays().get(dungeonStatDungeonSpecificData.getData().getHighestCompleted()); - String floorName = (dungeonType == DungeonType.CATACOMBS ? "F" : "M") + dungeonStatDungeonSpecificData.getData().getHighestCompleted(); - if (playedFloorFloorSpecificData != null) { - flag = true; - fr.drawString("§bH: " + floorName + " §a" + playedFloorFloorSpecificData.getData().getBestScore() + " §f" + playedFloorFloorSpecificData.getData().getCompletions() + "§7/§f" + playedFloorFloorSpecificData.getData().getWatcherKills() + "§7/§f" + playedFloorFloorSpecificData.getData().getTimes_played() + " §7(" + (int) (playedFloorFloorSpecificData.getData().getCompletions() *100/ (double) playedFloorFloorSpecificData.getData().getWatcherKills()) + "%)", 0, 0, -1); - fr.drawString("§6S+ §e" + (playedFloorFloorSpecificData.getData().getFastestTimeSPlus() != -1 ? TextUtils.formatTime(playedFloorFloorSpecificData.getData().getFastestTimeSPlus()) : "§7N/A") + " §6S §e" + (playedFloorFloorSpecificData.getData().getFastestTimeS() != -1 ? TextUtils.formatTime(playedFloorFloorSpecificData.getData().getFastestTimeS()) : "§7N/A"), 0, fr.FONT_HEIGHT, -1); - } - } - } - if (!flag) { - fr.drawString("§cNo Highest Floor for ", 0,0,-1); - fr.drawString("§c"+dungeonType.getFamiliarName(), 0,fr.FONT_HEIGHT,-1); - } - - return getDimension(); - } - - @Override - public Dimension renderDummy() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - String floorName = (dungeonType == DungeonType.CATACOMBS ? "F" : "M") + "9"; - - - fr.drawString("§bH: "+floorName+" §a305 §f10§7/§f35§7/§f50 §7("+(int)(1000.0/35.0)+"%)", 0,0,-1); - fr.drawString("§6S+ §e10m 53s §6S §e15m 13s", 0, fr.FONT_HEIGHT, -1); - return getDimension(); - } - - @Override - public Dimension getDimension() { - return new Dimension(100, Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT*2); - } - - @Override - public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) { - - DungeonSpecificData<DungeonStat> dungeonStatDungeonSpecificData = playerProfile.getDungeonStats().get(dungeonType); - if (dungeonStatDungeonSpecificData == null) return; - if (dungeonStatDungeonSpecificData.getData().getHighestCompleted() == -1) return; - FloorSpecificData<DungeonStat.PlayedFloor> playedFloorFloorSpecificData = dungeonStatDungeonSpecificData.getData().getPlays().get( dungeonStatDungeonSpecificData.getData().getHighestCompleted()); - if (playedFloorFloorSpecificData == null) return; - String floorName = (dungeonType == DungeonType.CATACOMBS ? "F" : "M") + dungeonStatDungeonSpecificData.getData().getHighestCompleted(); - - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GuiUtils.drawHoveringText(Arrays.asList( - "§bFloor "+floorName, - "§bBest Score§7: §f"+playedFloorFloorSpecificData.getData().getBestScore(), - "§bTotal Completions§7: §f"+playedFloorFloorSpecificData.getData().getCompletions(), - "§bTotal Watcher kills§7: §f"+playedFloorFloorSpecificData.getData().getWatcherKills(), - "§bTotal Runs§7: §f"+playedFloorFloorSpecificData.getData().getTimes_played(), - "§bFastest S+§7: §f"+(playedFloorFloorSpecificData.getData().getFastestTimeSPlus() != -1? TextUtils.formatTime(playedFloorFloorSpecificData.getData().getFastestTimeSPlus()) : "§7N/A"), - "§bFastest S§7: §f"+(playedFloorFloorSpecificData.getData().getFastestTimeS() != -1? TextUtils.formatTime(playedFloorFloorSpecificData.getData().getFastestTimeS()) : "§7N/A"), - "§bFastest Run§7: §f"+(playedFloorFloorSpecificData.getData().getFastestTime() != -1? TextUtils.formatTime(playedFloorFloorSpecificData.getData().getFastestTime()) : "§7N/A"), - "§bMost Mobs Killed§7: §f"+playedFloorFloorSpecificData.getData().getMostMobsKilled(), - "§bTotal Mobs Killed§7: §f"+playedFloorFloorSpecificData.getData().getMobsKilled() - ), mouseX, mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, Minecraft.getMinecraft().fontRendererObj); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderer.java deleted file mode 100644 index 406963e6..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderer.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; - -import java.awt.*; - -public interface DataRenderer { - Dimension renderData(PlayerProfile playerProfile); - void onHover(PlayerProfile playerProfile, int mouseX, int mouseY); - - - Dimension renderDummy(); - - Dimension getDimension(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererClassLv.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererClassLv.java deleted file mode 100644 index a2a468d1..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererClassLv.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import kr.syeyoung.dungeonsguide.features.impl.party.api.ClassSpecificData; -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonClass; -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import kr.syeyoung.dungeonsguide.features.impl.party.api.*; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.XPUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraftforge.fml.client.config.GuiUtils; - -import java.awt.*; -import java.util.Arrays; - -public class DataRendererClassLv implements DataRenderer { - private final DungeonClass dungeonClass; - public DataRendererClassLv(DungeonClass dungeonClass) { - this.dungeonClass = dungeonClass; - } - @Override - public Dimension renderData(PlayerProfile playerProfile) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - ClassSpecificData<PlayerProfile.PlayerClassData> dungeonStatDungeonSpecificData = playerProfile.getPlayerClassData().get(dungeonClass); - boolean selected = playerProfile.getSelectedClass() == dungeonClass; - if (dungeonStatDungeonSpecificData == null) { - fr.drawString(dungeonClass.getFamilarName(), 0,0, 0xFF55ffff); - fr.drawString("Unknown", fr.getStringWidth(dungeonClass.getFamilarName()+" "),0,0xFFFFFFFF); - if (selected) - fr.drawString("★", fr.getStringWidth(dungeonClass.getFamilarName()+" Unknown "),0,0xFFAAAAAA); - } else { - XPUtils.XPCalcResult xpCalcResult = XPUtils.getCataXp(dungeonStatDungeonSpecificData.getData().getExperience()); - fr.drawString(dungeonClass.getFamilarName(), 0,0, 0xFF55ffff); - fr.drawString(xpCalcResult.getLevel()+"", fr.getStringWidth(dungeonClass.getFamilarName()+" "),0,0xFFFFFFFF); - if (selected) - fr.drawString("★", fr.getStringWidth(dungeonClass.getFamilarName()+" "+xpCalcResult.getLevel()+" "),0,0xFFAAAAAA); - - RenderUtils.renderBar(0, fr.FONT_HEIGHT, 100,xpCalcResult.getRemainingXp() == 0 ? 1 : (float) (xpCalcResult.getRemainingXp() / xpCalcResult.getNextLvXp())); - } - - return new Dimension(100, fr.FONT_HEIGHT*2); - } - - @Override - public Dimension renderDummy() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString(dungeonClass.getFamilarName(), 0,0, 0xFF55ffff); - fr.drawString("99", fr.getStringWidth(dungeonClass.getFamilarName()+" "),0,0xFFFFFFFF); - fr.drawString("★", fr.getStringWidth(dungeonClass.getFamilarName()+" 99 "),0,0xFFAAAAAA); - RenderUtils.renderBar(0, fr.FONT_HEIGHT, 100,1.0f); - return new Dimension(100, fr.FONT_HEIGHT*2); - } - @Override - public Dimension getDimension() { - return new Dimension(100, Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT*2); - } - - @Override - public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) { - ClassSpecificData<PlayerProfile.PlayerClassData> dungeonStatDungeonSpecificData = playerProfile.getPlayerClassData().get(dungeonClass); - if (dungeonStatDungeonSpecificData == null) return; - XPUtils.XPCalcResult xpCalcResult = XPUtils.getCataXp(dungeonStatDungeonSpecificData.getData().getExperience()); - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - - GuiUtils.drawHoveringText(Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+ TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format((long)dungeonStatDungeonSpecificData.getData().getExperience())),mouseX, mouseY, - scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, Minecraft.getMinecraft().fontRendererObj); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererDungeonLv.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererDungeonLv.java deleted file mode 100644 index cabbdc02..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererDungeonLv.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonSpecificData; -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonStat; -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonType; -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.XPUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraftforge.fml.client.config.GuiUtils; - -import java.awt.*; -import java.util.Arrays; - -public class DataRendererDungeonLv implements DataRenderer { - private final DungeonType dungeonType; - public DataRendererDungeonLv(DungeonType dungeonType) { - this.dungeonType = dungeonType; - } - @Override - public Dimension renderData(PlayerProfile playerProfile) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - DungeonSpecificData<DungeonStat> dungeonStatDungeonSpecificData = playerProfile.getDungeonStats().get(dungeonType); - if (dungeonStatDungeonSpecificData == null) { - fr.drawString(dungeonType.getFamiliarName(), 0,0, 0xFFFF5555); - fr.drawString("Unknown", fr.getStringWidth(dungeonType.getFamiliarName()+" "),0,0xFFFFFFFF); - } else { - XPUtils.XPCalcResult xpCalcResult = XPUtils.getCataXp(dungeonStatDungeonSpecificData.getData().getExperience()); - fr.drawString(dungeonType.getFamiliarName(), 0,0, 0xFFFF5555); - fr.drawString(xpCalcResult.getLevel()+"", fr.getStringWidth(dungeonType.getFamiliarName()+" "),0,0xFFFFFFFF); - - RenderUtils.renderBar(0, fr.FONT_HEIGHT, 100,xpCalcResult.getRemainingXp() == 0 ? 1 : (float) (xpCalcResult.getRemainingXp() / xpCalcResult.getNextLvXp())); - } - - return new Dimension(100, fr.FONT_HEIGHT*2); - } - - @Override - public Dimension renderDummy() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString(dungeonType.getFamiliarName(), 0,0, 0xFFFF5555); - fr.drawString("99", fr.getStringWidth(dungeonType.getFamiliarName()+" "),0,0xFFFFFFFF); - RenderUtils.renderBar(0, fr.FONT_HEIGHT, 100,1.0f); - return new Dimension(100, fr.FONT_HEIGHT*2); - } - @Override - public Dimension getDimension() { - return new Dimension(100, Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT*2); - } - - @Override - public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) { - DungeonSpecificData<DungeonStat> dungeonStatDungeonSpecificData = playerProfile.getDungeonStats().get(dungeonType); - if (dungeonStatDungeonSpecificData == null) return; - XPUtils.XPCalcResult xpCalcResult = XPUtils.getCataXp(dungeonStatDungeonSpecificData.getData().getExperience()); - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GuiUtils.drawHoveringText(Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format((long)dungeonStatDungeonSpecificData.getData().getExperience())),mouseX, mouseY, - scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, Minecraft.getMinecraft().fontRendererObj); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererEditor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererEditor.java deleted file mode 100644 index fd3261c1..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererEditor.java +++ /dev/null @@ -1,356 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.awt.*; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class DataRendererEditor extends MPanel { - private final FeatureViewPlayerOnJoin feature; - - public DataRendererEditor(FeatureViewPlayerOnJoin featureViewPlayerOnJoin) { - this.feature = featureViewPlayerOnJoin; - } - - @Override - public void resize(int parentWidth, int parentHeight) { - this.setBounds(new Rectangle(5,5,parentWidth-10, 260)); - } - - private String currentlySelected; - private int selectedX; - private int selectedY; - private int lastX; - private int lastY; - private int scrollY; - private final int baseWidth = 120; - private final int hamburgerWidth = Minecraft.getMinecraft().fontRendererObj.getStringWidth("=="); - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - Gui.drawRect(0,0,getBounds().width, getBounds().height, RenderUtils.blendAlpha(0x141414, 0.12f)); - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Available", (310 + baseWidth + hamburgerWidth -fr.getStringWidth("Available")) / 2, 4, 0xFFFFFFFF); - fr.drawString("Current", (baseWidth + hamburgerWidth+10 -fr.getStringWidth("Current")) /2 , 4, 0xFFFFFFFF); - Gui.drawRect(4,4 + fr.FONT_HEIGHT + 3,baseWidth + hamburgerWidth+6 + 1, 236+ fr.FONT_HEIGHT + 3, 0xFF222222); - Gui.drawRect(5,5+ fr.FONT_HEIGHT + 3,baseWidth + hamburgerWidth + 5 + 1, 235+ fr.FONT_HEIGHT + 3, RenderUtils.blendAlpha(0x141414, 0.15f)); - Gui.drawRect(5 + hamburgerWidth,4+ fr.FONT_HEIGHT + 3,6 + hamburgerWidth, 236+ fr.FONT_HEIGHT + 3, 0xFF222222); - - Gui.drawRect(154,4 + fr.FONT_HEIGHT + 3,150 + baseWidth + hamburgerWidth + 6+1, 236+ fr.FONT_HEIGHT + 3, 0xFF222222); - Gui.drawRect(155,5+ fr.FONT_HEIGHT + 3,150 + baseWidth + hamburgerWidth + 5+1, 235+ fr.FONT_HEIGHT + 3, RenderUtils.blendAlpha(0x141414, 0.15f)); - Gui.drawRect(155 + hamburgerWidth,4 + fr.FONT_HEIGHT + 3,156 + hamburgerWidth, 236+ fr.FONT_HEIGHT + 3, 0xFF222222); - - GlStateManager.pushMatrix(); - clip(scissor.x + 6+hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); - GlStateManager.translate(6+hamburgerWidth, 5+fr.FONT_HEIGHT+3, 0); - int culmutativeY = 0; - int relSelectedY = selectedY - (5+ fr.FONT_HEIGHT + 3); - boolean drewit = false; - for (String datarenderers : feature.<List<String>>getParameter("datarenderers").getValue()) { - - if (0 <= selectedX && selectedX <= hamburgerWidth+11 && currentlySelected != null) { - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(currentlySelected); - Dimension dim; - if (dataRenderer == null) dim = new Dimension(0,fr.FONT_HEIGHT*2); - else dim = dataRenderer.getDimension(); - - if (culmutativeY + dim.height > relSelectedY && relSelectedY >= culmutativeY && !drewit) { - clip(scissor.x + 6 + hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - if (dataRenderer == null) { - fr.drawString("Couldn't find Datarenderer", 0,0, 0xFFFF0000); - fr.drawString(currentlySelected, 0,fr.FONT_HEIGHT, 0xFFFF0000); - dim = new Dimension(0, fr.FONT_HEIGHT * 2); - } else { - GlStateManager.pushMatrix(); - dim = dataRenderer.renderDummy(); - GlStateManager.popMatrix(); - } - clip(scissor.x, scissor.y, scissor.width, scissor.height); - GlStateManager.translate(-hamburgerWidth-1, 0, 0); - Gui.drawRect(0,0, hamburgerWidth, dim.height-1, 0xFF777777); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("=",fr.getStringWidth("=")/2,(dim.height - fr.FONT_HEIGHT) / 2, 0xFFFFFFFF); - GlStateManager.translate(hamburgerWidth+1,dim.height,0); - drewit = true; - } - } - - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); - clip(scissor.x + 6 + hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); - Dimension dim; - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - if (dataRenderer == null) { - fr.drawString("Couldn't find Datarenderer", 0,0, 0xFFFF0000); - fr.drawString(datarenderers, 0,fr.FONT_HEIGHT, 0xFFFF0000); - dim = new Dimension(0, fr.FONT_HEIGHT * 2); - } else { - GlStateManager.pushMatrix(); - dim = dataRenderer.renderDummy(); - GlStateManager.popMatrix(); - } - clip(scissor.x, scissor.y, scissor.width, scissor.height); - GlStateManager.translate(-hamburgerWidth-1, 0, 0); - Gui.drawRect(0,0, hamburgerWidth, dim.height-1, 0xFFAAAAAA); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("=",fr.getStringWidth("=")/2,(dim.height - fr.FONT_HEIGHT) / 2, 0xFFFFFFFF); - GlStateManager.translate(hamburgerWidth+1,dim.height,0); - - culmutativeY += dim.height; - } - - if (currentlySelected != null && new Rectangle(0,5+fr.FONT_HEIGHT + 3, hamburgerWidth+11, 232).contains(selectedX, selectedY) && !drewit) { - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(currentlySelected); - Dimension dim; - clip(scissor.x + 6 + hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - if (dataRenderer == null) { - fr.drawString("Couldn't find Datarenderer", 0,0, 0xFFFF0000); - fr.drawString(currentlySelected, 0,fr.FONT_HEIGHT, 0xFFFF0000); - dim = new Dimension(0, fr.FONT_HEIGHT * 2); - } else { - GlStateManager.pushMatrix(); - dim = dataRenderer.renderDummy(); - GlStateManager.popMatrix(); - } - clip(scissor.x, scissor.y, scissor.width, scissor.height); - GlStateManager.translate(-hamburgerWidth-1, 0, 0); - Gui.drawRect(0,0, hamburgerWidth, dim.height-1, 0xFF777777); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("=",fr.getStringWidth("=")/2,(dim.height - fr.FONT_HEIGHT) / 2, 0xFFFFFFFF); - GlStateManager.translate(hamburgerWidth+1,dim.height,0); - } - GlStateManager.popMatrix(); - - - GlStateManager.pushMatrix(); - GlStateManager.translate(156+hamburgerWidth, 5+fr.FONT_HEIGHT+3 - scrollY, 0); - - Set<String> rest = new HashSet<>(DataRendererRegistry.getValidDataRenderer()); - rest.removeAll( feature.<List<String>>getParameter("datarenderers").getValue()); - rest.remove(currentlySelected); - for (String datarenderers : rest) { - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); - clip(scissor.x + 156 + hamburgerWidth, scissor.y + 5+fr.FONT_HEIGHT+3, baseWidth, 230); - Dimension dim; - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - if (dataRenderer == null) { - fr.drawString("Couldn't find Datarenderer", 0,0, 0xFFFF0000); - fr.drawString(datarenderers, 0,fr.FONT_HEIGHT, 0xFFFF0000); - dim = new Dimension(0, fr.FONT_HEIGHT * 2); - } else { - GlStateManager.pushMatrix(); - dim = dataRenderer.renderDummy(); - GlStateManager.popMatrix(); - } - clip(scissor.x + 155, scissor.y + 5+fr.FONT_HEIGHT+3, hamburgerWidth, 230); - GlStateManager.translate(-hamburgerWidth-1, 0, 0); - Gui.drawRect(0,0, hamburgerWidth, dim.height-1, 0xFFAAAAAA); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("=",fr.getStringWidth("=")/2,(dim.height - fr.FONT_HEIGHT) / 2, 0xFFFFFFFF); - GlStateManager.translate(hamburgerWidth+1,dim.height,0); - } - GlStateManager.popMatrix(); - clip(0,0,sr.getScaledWidth(), sr.getScaledHeight()); - { - if (currentlySelected != null) { - GlStateManager.pushMatrix(); - GlStateManager.translate(selectedX+hamburgerWidth+1, selectedY, 0); - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(currentlySelected); - Dimension dim; - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - if (dataRenderer == null) { - fr.drawString("Couldn't find Datarenderer", 0, 0, 0xFFFF0000); - fr.drawString(currentlySelected, 0, fr.FONT_HEIGHT, 0xFFFF0000); - dim = new Dimension(0, fr.FONT_HEIGHT * 2); - } else { - GlStateManager.pushMatrix(); - dim = dataRenderer.renderDummy(); - GlStateManager.popMatrix(); - } - GlStateManager.translate(-hamburgerWidth-1, 0, 0); - Gui.drawRect(0,0, hamburgerWidth, dim.height-1, 0xFFAAAAAA); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("=",fr.getStringWidth("=")/2,(dim.height - fr.FONT_HEIGHT) / 2, 0xFFFFFFFF); - GlStateManager.popMatrix(); - } - } - clip(scissor.x, scissor.y, scissor.width, scissor.height); - } - - @Override - public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - super.mouseClicked(absMouseX, absMouseY, relMouseX, relMouseY, mouseButton); - lastX = relMouseX; - lastY = relMouseY; - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - int legitRelY = relMouseY - (5+fr.FONT_HEIGHT+3); - if (new Rectangle(155,5+fr.FONT_HEIGHT + 3, hamburgerWidth, 230).contains(relMouseX, relMouseY)) { - Set<String> rest = new HashSet<>(DataRendererRegistry.getValidDataRenderer()); - rest.removeAll( feature.<List<String>>getParameter("datarenderers").getValue()); - rest.remove(currentlySelected); - int culmutativeY = -scrollY; - for (String datarenderers : rest) { - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); - Dimension dim; - if (dataRenderer == null) { - dim = new Dimension(0, fr.FONT_HEIGHT * 2); - } else { - GlStateManager.pushMatrix(); - dim = dataRenderer.getDimension(); - GlStateManager.popMatrix(); - } - culmutativeY += dim.height; - - if (legitRelY < culmutativeY) { - currentlySelected = datarenderers; - selectedX = 155; - selectedY = culmutativeY - dim.height + 5+fr.FONT_HEIGHT + 3; - break; - } - } - } - if (new Rectangle(5,5+fr.FONT_HEIGHT + 3, hamburgerWidth, 230).contains(relMouseX, relMouseY)) { - List<String> rest = feature.<List<String>>getParameter("datarenderers").getValue(); - int culmutativeY = 0; - for (String datarenderers : rest) { - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); - Dimension dim; - if (dataRenderer == null) { - dim = new Dimension(0, fr.FONT_HEIGHT * 2); - } else { - GlStateManager.pushMatrix(); - dim = dataRenderer.getDimension(); - GlStateManager.popMatrix(); - } - culmutativeY += dim.height; - - if (legitRelY < culmutativeY) { - currentlySelected = datarenderers; - selectedX = 5; - selectedY = culmutativeY - dim.height + 5+fr.FONT_HEIGHT + 3; - rest.remove(datarenderers); - break; - } - } - } - } - - @Override - public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) { - super.mouseClickMove(absMouseX, absMouseY, relMouseX, relMouseY, clickedMouseButton, timeSinceLastClick); - if (currentlySelected != null) { - int dx = relMouseX - lastX; - int dy = relMouseY - lastY; - selectedX += dx; - selectedY += dy; - } - lastX = relMouseX; - lastY = relMouseY; - } - - @Override - public void mouseReleased(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int state) { - super.mouseReleased(absMouseX, absMouseY, relMouseX, relMouseY, state); - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - int legitRelY = selectedY - (5+fr.FONT_HEIGHT+3); - if (currentlySelected != null && new Rectangle(0,5+fr.FONT_HEIGHT + 3, hamburgerWidth+11, 232).contains(selectedX, selectedY)) { - Set<String> rest = new HashSet<>(DataRendererRegistry.getValidDataRenderer()); - int culmutativeY = 0; - List<String > asdasdkasd = feature.<List<String>>getParameter("datarenderers").getValue(); - int index = asdasdkasd.size(); - for (int i = 0; i <asdasdkasd.size(); i++) { - String datarenderers = asdasdkasd.get(i); - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); - Dimension dim; - if (dataRenderer == null) { - dim = new Dimension(0, fr.FONT_HEIGHT * 2); - } else { - GlStateManager.pushMatrix(); - dim = dataRenderer.getDimension(); - GlStateManager.popMatrix(); - } - culmutativeY += dim.height; - - if (legitRelY < culmutativeY) { - index = i; - break; - } - } - - asdasdkasd.add(index, currentlySelected); - } - - currentlySelected = null; - } - - @Override - public void mouseScrolled(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) { - super.mouseScrolled(absMouseX, absMouseY, relMouseX0, relMouseY0, scrollAmount); - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - if (!new Rectangle(155,5+fr.FONT_HEIGHT + 3, hamburgerWidth+baseWidth+1, 230).contains(relMouseX0, relMouseY0)) return; - - if (scrollAmount < 0) scrollY += 20; - if (scrollAmount > 0) scrollY -= 20; - if (scrollY < 0) scrollY = 0; - - - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererFairySouls.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererFairySouls.java deleted file mode 100644 index d9fae9d6..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererFairySouls.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; - -import java.awt.*; - -public class DataRendererFairySouls implements DataRenderer { - @Override - public Dimension renderData(PlayerProfile playerProfile) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("§eFairy Souls §f"+playerProfile.getFairySouls(), 0,0,-1); - return new Dimension(100, fr.FONT_HEIGHT); - } - - @Override - public Dimension renderDummy() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("§eFairy Souls §f300", 0,0,-1); - return new Dimension(100, fr.FONT_HEIGHT); - } - @Override - public Dimension getDimension() { - return new Dimension(100, Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT); - } - - @Override - public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) { - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererLilyWeight.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererLilyWeight.java deleted file mode 100644 index bdbd782d..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererLilyWeight.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraftforge.fml.client.config.GuiUtils; - -import java.awt.*; -import java.util.Arrays; - -public class DataRendererLilyWeight implements DataRenderer { - @Override - public Dimension renderData(PlayerProfile playerProfile) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - if (playerProfile.getLilyWeight() == null) - fr.drawString("§eLily Weight §cAPI DISABLED", 0,0,-1); - else - fr.drawString("§eLily Weight §b"+String.format("%.3f", playerProfile.getLilyWeight().getTotal()), 0,0,-1); - return new Dimension(100, fr.FONT_HEIGHT); - } - - @Override - public Dimension renderDummy() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("§eLily Weight §b300", 0,0,-1); - return new Dimension(100, fr.FONT_HEIGHT); - } - @Override - public Dimension getDimension() { - return new Dimension(100, Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT); - } - - @Override - public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) { - PlayerProfile.LilyWeight lilyWeight= playerProfile.getLilyWeight(); - if (lilyWeight == null) return; - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GuiUtils.drawHoveringText(Arrays.asList( - "§bDungeon Weights§7: §e"+ String.format("%.3f",lilyWeight.getCatacombs_base()+lilyWeight.getCatacombs_master()+lilyWeight.getCatacombs_exp()), - " §bCatacomb Completion§7: §e"+String.format("%.3f",lilyWeight.getCatacombs_base()), - " §bMaster Completion§7: §e"+String.format("%.3f", lilyWeight.getCatacombs_master()), - " §bExperience§7: §e"+String.format("%.3f", lilyWeight.getCatacombs_exp()), - "§bSkill Weights§7: §e"+ String.format("%.3f", lilyWeight.getSkill_base() + lilyWeight.getSkill_overflow()), - " §bSkill Weight§7: §e"+String.format("%.3f", lilyWeight.getSkill_base()), - " §bOverflow Weight§7: §e"+String.format("%.3f", lilyWeight.getSkill_overflow()), - "§bSlayer Weight§7: §e"+String.format("%.3f", lilyWeight.getSlayer()), - "§bTotal§7: §e"+String.format("%.3f", lilyWeight.getTotal()) - ),mouseX, mouseY, - scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, Minecraft.getMinecraft().fontRendererObj); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererRegistry.java deleted file mode 100644 index bf1e68ac..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererRegistry.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonClass; -import kr.syeyoung.dungeonsguide.features.impl.party.api.DungeonType; -import kr.syeyoung.dungeonsguide.features.impl.party.api.Skill; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -public class DataRendererRegistry { - private static final Map<String, DataRenderer> dataRendererMap = new HashMap<>(); - - public static DataRenderer getDataRenderer(String id) { - return dataRendererMap.get(id); - } - - public static Set<String> getValidDataRenderer() { - return dataRendererMap.keySet(); - } - - static { - dataRendererMap.put("catalv", new DataRendererDungeonLv(DungeonType.CATACOMBS)); - for (DungeonClass value : DungeonClass.values()) { - dataRendererMap.put("class_"+value.getJsonName()+"_lv", new DataRendererClassLv(value)); - } - dataRendererMap.put("selected_class_lv", new DataRendererSelectedClassLv()); - for (Skill value : Skill.values()) { - dataRendererMap.put("skill_"+value.getJsonName()+"_lv", new DataRendererSkillLv(value)); - } - for (DungeonType value : DungeonType.values()) { - for (Integer validFloor : value.getValidFloors()) { - dataRendererMap.put("dungeon_"+value.getJsonName()+"_"+validFloor+"_stat", new DataRenderDungeonFloorStat(value, validFloor)); - } - dataRendererMap.put("dungeon_"+value.getJsonName()+"_higheststat", new DataRenderDungeonHighestFloorStat(value)); - } - dataRendererMap.put("fairysouls", new DataRendererFairySouls()); - dataRendererMap.put("secrets", new DataRendererSecrets()); - - dataRendererMap.put("dummy", new DataRendererSetUrOwn()); - - dataRendererMap.put("talismans", new DataRendererTalismans()); - dataRendererMap.put("weight", new DataRendererLilyWeight()); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSecrets.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSecrets.java deleted file mode 100644 index d06039cb..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSecrets.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; - -import java.awt.*; - -public class DataRendererSecrets implements DataRenderer { - @Override - public Dimension renderData(PlayerProfile playerProfile) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - double theint = playerProfile.getTotalSecrets()/ (double)playerProfile.getDungeonStats().values().stream().flatMap(s -> s.getData().getPlays().values().stream()) - .map(fs -> fs.getData().getWatcherKills()).reduce(0, Integer::sum); - fr.drawString("§eSecrets §b"+playerProfile.getTotalSecrets()+" §7("+ - String.format("%.2f", theint)+"/run)", 0,0,-1); - return new Dimension(100, fr.FONT_HEIGHT); - } - - @Override - public Dimension renderDummy() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("§eSecrets §b99999 §7(X/run)", 0,0,-1); - return new Dimension(100, fr.FONT_HEIGHT); - } - @Override - public Dimension getDimension() { - return new Dimension(100, Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT); - } - - @Override - public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) { - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSelectedClassLv.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSelectedClassLv.java deleted file mode 100644 index 013193e0..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSelectedClassLv.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import kr.syeyoung.dungeonsguide.features.impl.party.api.ClassSpecificData; -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.XPUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraftforge.fml.client.config.GuiUtils; - -import java.awt.*; -import java.util.Arrays; - -public class DataRendererSelectedClassLv implements DataRenderer { - @Override - public Dimension renderData(PlayerProfile playerProfile) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - ClassSpecificData<PlayerProfile.PlayerClassData> dungeonStatDungeonSpecificData = playerProfile.getPlayerClassData().get(playerProfile.getSelectedClass()); - if (dungeonStatDungeonSpecificData == null) { - fr.drawString("Unknown Selected", 0,0, 0xFF55ffff); - } else { - XPUtils.XPCalcResult xpCalcResult = XPUtils.getCataXp(dungeonStatDungeonSpecificData.getData().getExperience()); - fr.drawString(playerProfile.getSelectedClass().getFamilarName(), 0,0, 0xFF55ffff); - fr.drawString(xpCalcResult.getLevel()+"", fr.getStringWidth(playerProfile.getSelectedClass().getFamilarName()+" "),0,0xFFFFFFFF); - fr.drawString("★", fr.getStringWidth(playerProfile.getSelectedClass().getFamilarName()+" "+xpCalcResult.getLevel()+" "),0,0xFFAAAAAA); - - RenderUtils.renderBar(0, fr.FONT_HEIGHT, 100,xpCalcResult.getRemainingXp() == 0 ? 1 : (float) (xpCalcResult.getRemainingXp() / xpCalcResult.getNextLvXp())); - } - - return new Dimension(100, fr.FONT_HEIGHT*2); - } - - @Override - public Dimension renderDummy() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("SelectedClass", 0,0, 0xFF55ffff); - fr.drawString("99", fr.getStringWidth("SelectedClass "),0,0xFFFFFFFF); - fr.drawString("★", fr.getStringWidth("SelectedClass 99 "),0,0xFFAAAAAA); - RenderUtils.renderBar(0, fr.FONT_HEIGHT, 100,1.0f); - return new Dimension(100, fr.FONT_HEIGHT*2); - } - @Override - public Dimension getDimension() { - return new Dimension(100, Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT*2); - } - - @Override - public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) { - ClassSpecificData<PlayerProfile.PlayerClassData> dungeonStatDungeonSpecificData = playerProfile.getPlayerClassData().get(playerProfile.getSelectedClass()); - if (dungeonStatDungeonSpecificData == null) return; - XPUtils.XPCalcResult xpCalcResult = XPUtils.getCataXp(dungeonStatDungeonSpecificData.getData().getExperience()); - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GuiUtils.drawHoveringText(Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+ TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format((long)dungeonStatDungeonSpecificData.getData().getExperience())),mouseX, mouseY, - scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, Minecraft.getMinecraft().fontRendererObj); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSetUrOwn.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSetUrOwn.java deleted file mode 100644 index aaccb3ae..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSetUrOwn.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; - -import java.awt.*; - -public class DataRendererSetUrOwn implements DataRenderer { - @Override - public Dimension renderData(PlayerProfile playerProfile) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("§aCustomize at /dg", 0,0,-1); - fr.drawString("§a-> Party Kicker", 0,fr.FONT_HEIGHT,-1); - fr.drawString("§a-> View Player Stats", 0,fr.FONT_HEIGHT*2,-1); - fr.drawString("§a-> Edit", 0,fr.FONT_HEIGHT*3,-1); - return new Dimension(100, fr.FONT_HEIGHT*4); - } - - @Override - public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) { - - } - - @Override - public Dimension renderDummy() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("§aCustomize at /dg", 0,0,-1); - fr.drawString("§a-> Party Kicker", 0,fr.FONT_HEIGHT,-1); - fr.drawString("§a-> View Player Stats", 0,fr.FONT_HEIGHT*2,-1); - fr.drawString("§a-> Edit", 0,fr.FONT_HEIGHT*3,-1); - return new Dimension(100, fr.FONT_HEIGHT*4); - } - @Override - public Dimension getDimension() { - return new Dimension(100, Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT*4); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSkillLv.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSkillLv.java deleted file mode 100644 index 9620b883..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSkillLv.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import kr.syeyoung.dungeonsguide.features.impl.party.api.Skill; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import kr.syeyoung.dungeonsguide.utils.XPUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraftforge.fml.client.config.GuiUtils; - -import java.awt.*; -import java.util.Arrays; - -public class DataRendererSkillLv implements DataRenderer { - private final Skill skill; - public DataRendererSkillLv(Skill skill) { - this.skill = skill; - } - @Override - public Dimension renderData(PlayerProfile playerProfile) { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - Double xp = playerProfile.getSkillXp().get(skill); - if (xp == null) { - fr.drawString(skill.getFriendlyName(), 0,0, 0xFF55ffff); - fr.drawString("§cSkill API Disabled", 0, fr.FONT_HEIGHT,0xFFFFFFFF); - } else { - XPUtils.XPCalcResult xpCalcResult = XPUtils.getSkillXp(skill, xp); - fr.drawString(skill.getFriendlyName(), 0,0, 0xFF55ffff); - fr.drawString(xpCalcResult.getLevel()+"", fr.getStringWidth(skill.getFriendlyName()+" "),0,0xFFFFFFFF); - - RenderUtils.renderBar(0, fr.FONT_HEIGHT, 100,xpCalcResult.getRemainingXp() == 0 ? 1 : (float) (xpCalcResult.getRemainingXp() / xpCalcResult.getNextLvXp())); - } - - return new Dimension(100, fr.FONT_HEIGHT*2); - } - - @Override - public Dimension renderDummy() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString(skill.getFriendlyName(), 0,0, 0xFF55ffff); - fr.drawString("99", fr.getStringWidth(skill.getFriendlyName()+" "),0,0xFFFFFFFF); - RenderUtils.renderBar(0, fr.FONT_HEIGHT, 100,1.0f); - return new Dimension(100, fr.FONT_HEIGHT*2); - } - @Override - public Dimension getDimension() { - return new Dimension(100, Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT*2); - } - - @Override - public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) { - Double xp = playerProfile.getSkillXp().get(skill); - if (xp == null) return; - XPUtils.XPCalcResult xpCalcResult = XPUtils.getSkillXp(skill, xp); - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GuiUtils.drawHoveringText(Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+ TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format(xp.longValue())),mouseX, mouseY, - scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, Minecraft.getMinecraft().fontRendererObj); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererTalismans.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererTalismans.java deleted file mode 100644 index 5bd423ca..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererTalismans.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import lombok.AllArgsConstructor; -import lombok.Getter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraftforge.fml.client.config.GuiUtils; - -import java.awt.*; -import java.util.ArrayList; -import java.util.List; - -public class DataRendererTalismans implements DataRenderer { - @Override - public Dimension renderData(PlayerProfile playerProfile) { - boolean apiDisabled = playerProfile.getTalismans() == null || playerProfile.getInventory() == null; - if (!playerProfile.getAdditionalProperties().containsKey("talismanCnt") && !apiDisabled) { - int[] cnts = new int[Rarity.values().length]; - for (ItemStack talisman : playerProfile.getTalismans()) { - if (talisman == null) continue; - Rarity r = getRarity(talisman); - if (r != null) cnts[r.ordinal()]++; - } - for (ItemStack itemStack : playerProfile.getInventory()) { - if (itemStack == null) continue; - Rarity r = getRarity(itemStack); - if (r != null) cnts[r.ordinal()]++; - } - playerProfile.getAdditionalProperties().put("talismanCnt", cnts); - } - int[] rawData = (int[]) playerProfile.getAdditionalProperties().get("talismanCnt"); - - String str = ""; - if (rawData != null) - for (Rarity r : Rarity.values()) { - str = r.color+rawData[r.idx] +" "+ str; - } - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - if (apiDisabled) - fr.drawString("§eTalis §cAPI DISABLED", 0,0,-1); - else - fr.drawString("§eTalis §f"+str, 0,0,-1); - return new Dimension(100, fr.FONT_HEIGHT); - } - - private Rarity getRarity(ItemStack itemStack) { - NBTTagCompound display = itemStack.getTagCompound().getCompoundTag("display"); - if (display == null) return null; - NBTTagList lore = display.getTagList("Lore", 8); - if (lore == null) return null; - for (int i = 0; i < lore.tagCount(); i++) { - String line = lore.getStringTagAt(i); - for (Rarity value : Rarity.values()) { - if (line.startsWith(value.getColor()) && line.contains("CCESSORY")) return value; - } - } - return null; - } - - @Override - public Dimension renderDummy() { - String str = ""; - for (Rarity r : Rarity.values()) { - str = r.color+(r.idx+5)*2+" "+str; - } - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("§eTalis §f"+str, 0,0,-1); - return new Dimension(100, fr.FONT_HEIGHT); - } - @Override - public Dimension getDimension() { - return new Dimension(100, Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT); - } - - @Override - public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) { - int[] rawData = (int[]) playerProfile.getAdditionalProperties().get("talismanCnt"); - if (rawData == null) return; - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - List<String> list = new ArrayList<>(); - - for (Rarity r : Rarity.values()) { - list.add(r.getColor()+r.name()+"§7: §e"+rawData[r.idx]); - } - GuiUtils.drawHoveringText(list,mouseX, mouseY, - scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, Minecraft.getMinecraft().fontRendererObj); - } - - - @AllArgsConstructor @Getter - public static enum Rarity { - COMMON("§f", 0), UNCOMMON("§a",1), RARE("§9",2), EPIC("§5",3), LEGENDARY("§6",4), MYTHIC("§d",5); - - private String color; - private int idx; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java deleted file mode 100644 index 17df170c..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java +++ /dev/null @@ -1,623 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; - -import com.google.common.base.Supplier; -import com.mojang.authlib.GameProfile; -import io.github.moulberry.hychat.HyChat; -import io.github.moulberry.hychat.chat.ChatManager; -import io.github.moulberry.hychat.gui.GuiChatBox; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.features.impl.party.api.ApiFetchur; -import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; -import kr.syeyoung.dungeonsguide.features.impl.party.api.SkinFetchur; -import kr.syeyoung.dungeonsguide.features.listener.ChatListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiClickListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiPostRenderListener; -import kr.syeyoung.dungeonsguide.chat.ChatProcessor; -import kr.syeyoung.dungeonsguide.chat.PartyManager; -import kr.syeyoung.dungeonsguide.cosmetics.ActiveCosmetic; -import kr.syeyoung.dungeonsguide.cosmetics.CosmeticData; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.features.impl.party.api.*; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import lombok.Getter; -import lombok.Setter; -import lombok.SneakyThrows; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityOtherPlayerMP; -import net.minecraft.client.gui.*; -import net.minecraft.client.gui.inventory.GuiInventory; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.resources.DefaultPlayerSkin; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.event.HoverEvent; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.scoreboard.Team; -import net.minecraft.util.*; -import net.minecraft.world.World; -import net.minecraftforge.client.event.ClientChatReceivedEvent; -import net.minecraftforge.client.event.GuiScreenEvent; -import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.common.Loader; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.awt.*; -import java.util.*; -import java.util.List; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; - -public class FeatureViewPlayerOnJoin extends SimpleFeature implements GuiPostRenderListener, ChatListener, GuiClickListener { - - public FeatureViewPlayerOnJoin() { - super("Party", "View player stats when join", "view player rendering when joining/someone joins the party", "partykicker.viewstats", true); - this.parameters.put("datarenderers", new FeatureParameter<List<String>>("datarenderers", "DataRenderers","Datarenderssdasd", new ArrayList<>(Arrays.asList( - "catalv", "selected_class_lv", "dungeon_catacombs_higheststat", "dungeon_master_catacombs_higheststat", "skill_combat_lv", "skill_foraging_lv", "skill_mining_lv", "fairysouls", "dummy" - )), "stringlist")); - } - - private Rectangle popupRect; - private String lastuid; // actually current uid - private Future<Optional<PlayerProfile>> profileFuture; - private Future<Optional<GameProfile>> gfFuture; - private Future<SkinFetchur.SkinSet> skinFuture; - private FakePlayer fakePlayer; - private boolean drawInv = false; - @SneakyThrows - @Override - public void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered) { - if (!(Minecraft.getMinecraft().currentScreen instanceof GuiChat)) { - cancelRender(); - return; - } - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - IChatComponent ichatcomponent = getHoveredComponent(scaledResolution); - String uid = null; - if (ichatcomponent != null && ichatcomponent.getChatStyle().getChatHoverEvent() instanceof HoverEventRenderPlayer) { - uid = ((HoverEventRenderPlayer) ichatcomponent.getChatStyle().getChatHoverEvent()).getUuid(); - } - reqRender(uid); - } - - public void cancelRender() { - popupRect = null; - profileFuture = null; - lastuid = null; - gfFuture = null; - skinFuture= null; - fakePlayer= null; - drawInv = false; - } - - public void reqRender(String uid) { - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - int width = scaledResolution.getScaledWidth(); - int height = scaledResolution.getScaledHeight(); - int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth; - int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; - - - if (!((popupRect != null && (popupRect.contains(mouseX, mouseY) || drawInv)) || uid != null && uid.equals(lastuid))) { - cancelRender(); - } - - if (uid != null && !uid.equals(lastuid) && (popupRect==null || (!popupRect.contains(mouseX, mouseY) && !drawInv)) ) { - cancelRender(); - lastuid = uid; - } - if (lastuid == null) return; - - - if (popupRect == null) { - popupRect = new Rectangle(mouseX, mouseY, 220, 220); - if (popupRect.y + popupRect.height > scaledResolution.getScaledHeight()) { - popupRect.y -= popupRect.y + popupRect.height - scaledResolution.getScaledHeight(); - } - } - - if (profileFuture == null) { - profileFuture = ApiFetchur.fetchMostRecentProfileAsync(lastuid, FeatureRegistry.PARTYKICKER_APIKEY.getAPIKey()); - } - - if (gfFuture == null) { - gfFuture = ApiFetchur.getSkinGameProfileByUUIDAsync(lastuid); - } - boolean plsSetAPIKEY = false; - if (skinFuture == null && gfFuture.isDone()) { - try { - skinFuture = SkinFetchur.getSkinSet(gfFuture.get().orElse(null)); - } catch (InterruptedException | ExecutionException e) { - e.printStackTrace(); - } - } - - try { - if (fakePlayer == null && skinFuture != null && profileFuture != null && skinFuture.isDone() && profileFuture.isDone() && profileFuture.get().isPresent()) { - fakePlayer = new FakePlayer(gfFuture.get().orElse(null), skinFuture.get(), profileFuture.get().orElse(null)); - } - } catch (InterruptedException | ExecutionException e) { - plsSetAPIKEY = true; - } - - - try { - render(popupRect, scaledResolution, mouseX, mouseY, plsSetAPIKEY ? null : (profileFuture.isDone() ? profileFuture.get() : null), plsSetAPIKEY); - } catch (InterruptedException | ExecutionException e) { - } - - } - - public static void clip(ScaledResolution resolution, int x, int y, int width, int height) { - if (width < 0 || height < 0) return; - - int scale = resolution.getScaleFactor(); - GL11.glScissor((x ) * scale, Minecraft.getMinecraft().displayHeight - (y + height) * scale, (width) * scale, height * scale); - } - private void render(Rectangle popupRect, ScaledResolution scaledResolution, int mouseX, int mouseY, Optional<PlayerProfile> playerProfile, boolean apiKeyPlsSet) { - - GlStateManager.pushMatrix(); - GlStateManager.translate(popupRect.x, popupRect.y, 0); - Gui.drawRect(0,0, popupRect.width, popupRect.height, 0xFF23272a); - Gui.drawRect(2,2, popupRect.width-2, popupRect.height-2, 0XFF2c2f33); - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - if (apiKeyPlsSet) { - Minecraft.getMinecraft().fontRendererObj.drawString("Please set API KEY on /dg -> Party Kicker", 5,5, 0xFFFFFFFF); - GlStateManager.popMatrix(); - return; - } - if (playerProfile == null) { - Minecraft.getMinecraft().fontRendererObj.drawString("Fetching data...", 5,5, 0xFFFFFFFF); - GlStateManager.popMatrix(); - return; - } - if (!playerProfile.isPresent()) { - Minecraft.getMinecraft().fontRendererObj.drawString("User could not be found", 5,5, 0xFFFFFFFF); - GlStateManager.popMatrix(); - return; - } - int relX = mouseX - popupRect.x; - int relY = mouseY - popupRect.y; - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - - - GL11.glEnable(GL11.GL_SCISSOR_TEST); - clip(scaledResolution, popupRect.x, popupRect.y, popupRect.width, popupRect.height); - - Gui.drawRect(0,168, 90, 195, 0xFF23272a); - Gui.drawRect(2,170, 88, 193, new Rectangle(2,170,86,23).contains(relX, relY) ? 0xFFff7777 : 0xFFFF3333); - - Gui.drawRect(0,193, 90, 220, 0xFF23272a); - Gui.drawRect(2,195, 88, 218, new Rectangle(2,195,86,23).contains(relX, relY) ? 0xFF859DF0 : 0xFF7289da); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Kick", (90 - fr.getStringWidth("Kick")) / 2,(364 - fr.FONT_HEIGHT) / 2, 0xFFFFFFFF); - fr.drawString("Invite", (90 - fr.getStringWidth("Invite")) / 2,(414 - fr.FONT_HEIGHT) / 2, 0xFFFFFFFF); - - GlStateManager.pushMatrix(); - - GlStateManager.translate(95, 5, 0); - int culmutativeY = 5; - DataRenderer dataRendererToHover = null; - for (String datarenderers : this.<List<String>>getParameter("datarenderers").getValue()) { - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); - Dimension dim; - if (dataRenderer == null) { - fr.drawString("Couldn't find Datarenderer", 0,0, 0xFFFF0000); - fr.drawString(datarenderers, 0,fr.FONT_HEIGHT, 0xFFFF0000); - dim = new Dimension(0, fr.FONT_HEIGHT * 2); - } else { - GlStateManager.pushMatrix(); - dim = dataRenderer.renderData(playerProfile.get()); - GlStateManager.popMatrix(); - } - if (relX >= 95 && relX <= popupRect.width && relY >= culmutativeY && relY < culmutativeY+dim.height && dataRenderer != null) { - dataRendererToHover = dataRenderer; - } - culmutativeY += dim.height; - GlStateManager.translate(0,dim.height,0); - } - - GlStateManager.popMatrix(); - - Gui.drawRect(0,0, 90, 170, 0xFF23272a); - Gui.drawRect(2,2, 88, 168, 0xFF444444); - Gui.drawRect(80,159, 90, 170, 0xFF23272a); - Gui.drawRect(82,161, 88, 168, 0xFF444444); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("§eI", 83,161,-1); - GlStateManager.color(1, 1, 1, 1.0F); - if (fakePlayer != null) { - clip(scaledResolution, popupRect.x+2, popupRect.y+2, 86, 166); - GuiInventory.drawEntityOnScreen(45, 150, 60, -(mouseX - popupRect.x - 75), 0, fakePlayer); - - String toDraw = fakePlayer.getName(); - List<ActiveCosmetic> activeCosmetics = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getActiveCosmeticByPlayer().get(UUID.fromString(TextUtils.insertDashUUID(playerProfile.get().getMemberUID()))); - CosmeticData prefix = null, color = null; - if (activeCosmetics != null) { - for (ActiveCosmetic activeCosmetic : activeCosmetics) { - CosmeticData cosmeticData = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getCosmeticDataMap().get(activeCosmetic.getCosmeticData()); - if (cosmeticData != null) { - if (cosmeticData.getCosmeticType().equals("prefix")) prefix = cosmeticData; - if (cosmeticData.getCosmeticType().equals("color")) color = cosmeticData; - } - } - } - toDraw = (color == null ? "§e" : color.getData().replace("&", "§"))+toDraw; - if (prefix != null) toDraw = prefix.getData().replace("&", "§") + " "+toDraw; - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString(toDraw, (90 - fr.getStringWidth(toDraw)) / 2, 15, -1); - - ItemStack toHover = null; - if (relX > 20 && relX < 70) { - if (33<=relY && relY <= 66) { - toHover = fakePlayer.getInventory()[3]; - } else if (66 <= relY && relY <= 108) { - toHover = fakePlayer.getInventory()[2]; - } else if (108 <= relY && relY <= 130) { - toHover = fakePlayer.getInventory()[1]; - } else if (130 <= relY && relY <= 154) { - toHover = fakePlayer.getInventory()[0]; - } - } else if (relX > 0 && relX <= 20) { - if (80 <= relY && relY <= 120) { - toHover = fakePlayer.inventory.mainInventory[fakePlayer.inventory.currentItem]; - } - } - - if (toHover != null) { - List<String> list = toHover.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips); - for (int i = 0; i < list.size(); ++i) { - if (i == 0) { - list.set(i, toHover.getRarity().rarityColor + list.get(i)); - } else { - list.set(i, EnumChatFormatting.GRAY + list.get(i)); - } - } - FontRenderer font = toHover.getItem().getFontRenderer(toHover); - GlStateManager.popMatrix(); - GL11.glDisable(GL11.GL_SCISSOR_TEST); - FontRenderer theRenderer = (font == null ? fr : font); - GuiUtils.drawHoveringText(list,mouseX, mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, theRenderer); - GL11.glEnable(GL11.GL_SCISSOR_TEST); - GlStateManager.pushMatrix(); - GlStateManager.translate(popupRect.x, popupRect.y, 0); - } - clip(scaledResolution, popupRect.x, popupRect.y, popupRect.width, popupRect.height); - } else { - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Loading", 5,35, 0xFFEFFF00); - } - - GlStateManager.popMatrix(); - GL11.glDisable(GL11.GL_SCISSOR_TEST); - if (dataRendererToHover != null && !drawInv) { - dataRendererToHover.onHover(playerProfile.get(), mouseX, mouseY); - } - GL11.glEnable(GL11.GL_SCISSOR_TEST); - GlStateManager.pushMatrix(); - GlStateManager.translate(popupRect.x, popupRect.y, 0); - - if (drawInv) { - int startX = 81; - int startY = 86; - clip(scaledResolution, popupRect.x+startX-1, popupRect.y+startY-1, 164, 74); - GlStateManager.translate(startX,startY,1); - Gui.drawRect(-1,-1,163,73, 0xFF000000); - GlStateManager.disableLighting(); - ItemStack toHover = null; - int rx = relX - startX; - int ry = relY - startY; - - if (playerProfile.get().getInventory() != null) { - GlStateManager.disableRescaleNormal(); - RenderHelper.enableGUIStandardItemLighting(); - GlStateManager.disableLighting(); - for (int i = 0; i < playerProfile.get().getInventory().length; i++) { - int x = (i%9) * 18; - int y = (i/9) * 18; - if (x <= rx && rx<x+18 && y<=ry&&ry<y+18) { - toHover = playerProfile.get().getInventory()[(i+9) % 36]; - } - Gui.drawRect(x,y,x+18,y+18, 0xFF000000); - Gui.drawRect(x+1,y+1,x+17,y+17, 0xFF666666); - GlStateManager.color(1, 1, 1, 1.0F); - - Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(playerProfile.get().getInventory()[(i+9) % 36], (i%9) * 18+1,(i/9) * 18+1); - } - - if (toHover != null) { - List<String> list = toHover.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips); - for (int i = 0; i < list.size(); ++i) { - if (i == 0) { - list.set(i, toHover.getRarity().rarityColor + list.get(i)); - } else { - list.set(i, EnumChatFormatting.GRAY + list.get(i)); - } - } - FontRenderer font = toHover.getItem().getFontRenderer(toHover); - GlStateManager.popMatrix(); - GL11.glDisable(GL11.GL_SCISSOR_TEST); - FontRenderer theRenderer = (font == null ? fr : font); - GuiUtils.drawHoveringText(list,mouseX, mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, theRenderer); - GL11.glEnable(GL11.GL_SCISSOR_TEST); - GlStateManager.pushMatrix(); - } - } else { - Gui.drawRect(0,0,162,72, 0xFF666666); - fr.drawSplitString("Player has disabled Inventory API", 5,5, 142, -1); - } - - } - GL11.glDisable(GL11.GL_SCISSOR_TEST); - - - GlStateManager.popMatrix(); // 33 66 108 130 154 // 5 75 - } - @Override - public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) { - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - int width = scaledResolution.getScaledWidth(); - int height = scaledResolution.getScaledHeight(); - int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth; - int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; - - if (Mouse.getEventButton() != -1 && Mouse.isButtonDown(Mouse.getEventButton()) && drawInv) drawInv = false; - if (popupRect == null || !popupRect.contains(mouseX, mouseY)) return; - - mouseInputEvent.setCanceled(true); - - int relX = mouseX - popupRect.x; - int relY = mouseY - popupRect.y; - - - try { - PlayerProfile playerProfile = profileFuture.isDone() ? profileFuture.get().orElse(null) : null; - if (playerProfile == null) return; - if (Mouse.getEventButton() != -1 && Mouse.isButtonDown(Mouse.getEventButton())) { - if (new Rectangle(2, 195, 86, 23).contains(relX, relY)) { - // invite - ChatProcessor.INSTANCE.addToChatQueue("/p invite " + ApiFetchur.fetchNicknameAsync(playerProfile.getMemberUID()).get().orElse("-"), () -> {}, true); - } else if (new Rectangle(2, 170, 86, 23).contains(relX, relY)) { - // kick - ChatProcessor.INSTANCE.addToChatQueue("/p kick " + ApiFetchur.fetchNicknameAsync(playerProfile.getMemberUID()).get().orElse("-"), () -> {}, true); - } else if (new Rectangle(80,159,10,11).contains(relX, relY)) { - drawInv = true; - } - } - - } catch (InterruptedException | ExecutionException e) { - } - - - } - - public IChatComponent getHoveredComponent(ScaledResolution scaledResolution) { - IChatComponent ichatcomponent = null; - if (Loader.isModLoaded("hychat")) { - try { - ChatManager chatManager = HyChat.getInstance().getChatManager(); - GuiChatBox guiChatBox = chatManager.getFocusedChat(); - - int x = guiChatBox.getX(scaledResolution); - int y = guiChatBox.getY(scaledResolution); - ichatcomponent = guiChatBox.chatArray.getHoveredComponent(guiChatBox.getSelectedTab().getChatLines(), Mouse.getX(), Mouse.getY(), x, y); - } catch (Throwable t) {} - } - if (ichatcomponent == null) { - ichatcomponent = Minecraft.getMinecraft().ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY()); - } - return ichatcomponent; - } - - @Override - public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { - if (!isEnabled()) return; - String str = clientChatReceivedEvent.message.getFormattedText(); - if (str.contains("§r§ejoined the dungeon group! (§r§b")) { - String username = TextUtils.stripColor(str).split(" ")[3]; - if (username.equalsIgnoreCase(Minecraft.getMinecraft().getSession().getUsername())) { - PartyManager.INSTANCE.requestPartyList((context) -> { - if (context == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §cBugged Dungeon Party ")); - } else { - - for (String member : context.getPartyRawMembers()) { - ApiFetchur.fetchUUIDAsync(member) - .thenAccept((a) -> { - if (a == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e"+member+"§f's Profile §cCouldn't fetch uuid")); - } else { - ApiFetchur.fetchMostRecentProfileAsync(a.get(), FeatureRegistry.PARTYKICKER_APIKEY.getAPIKey()); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e"+member+"§f's Profile ").appendSibling(new ChatComponentText("§7view").setChatStyle(new ChatStyle().setChatHoverEvent(new FeatureViewPlayerOnJoin.HoverEventRenderPlayer(a.orElse(null)))))); - } - }); - } - } - }); - } else { - ApiFetchur.fetchUUIDAsync(username) - .thenAccept(a -> { - if (a == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e"+username+"§f's Profile §cCouldn't fetch uuid")); - return; - } - ApiFetchur.fetchMostRecentProfileAsync(a.get(), FeatureRegistry.PARTYKICKER_APIKEY.getAPIKey()); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e"+username+"§f's Profile ").appendSibling(new ChatComponentText("§7view").setChatStyle(new ChatStyle().setChatHoverEvent(new FeatureViewPlayerOnJoin.HoverEventRenderPlayer(a.orElse(null)))))); - }); - } - } - } - - - public static class HoverEventRenderPlayer extends HoverEvent { - @Getter - private final String uuid; - public HoverEventRenderPlayer(String uuid) { - super(Action.SHOW_TEXT, new ChatComponentText("")); - this.uuid = uuid; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - if (!super.equals(o)) return false; - HoverEventRenderPlayer that = (HoverEventRenderPlayer) o; - return Objects.equals(uuid, that.uuid); - } - - @Override - public int hashCode() { - return Objects.hash(super.hashCode(), uuid); - } - - private IChatComponent cached; - - @Override - public IChatComponent getValue() { - if (cached == null) - return cached = new ChatComponentText("").setChatStyle(new ChatStyle().setChatHoverEvent(new HoverEvent(Action.SHOW_TEXT, new ChatComponentText(uuid)))); - return cached; - } - } - - public static class FakePlayer extends EntityOtherPlayerMP { - @Setter - @Getter - private PlayerProfile skyblockProfile; - private final SkinFetchur.SkinSet skinSet; - private final PlayerProfile.Armor armor; - private FakePlayer(World w) { - super(w, null); - throw new UnsupportedOperationException("what"); - } - public FakePlayer(GameProfile playerProfile, SkinFetchur.SkinSet skinSet, PlayerProfile skyblockProfile) { - super(Minecraft.getMinecraft().theWorld, playerProfile); - this.skyblockProfile = skyblockProfile; - this.skinSet = skinSet; - armor= skyblockProfile.getCurrentArmor(); - this.inventory.armorInventory = skyblockProfile.getCurrentArmor().getArmorSlots(); - - int highestDungeonScore = Integer.MIN_VALUE; - if (skyblockProfile.getInventory() != null) { - ItemStack highestItem = null; - for (ItemStack itemStack : skyblockProfile.getInventory()) { - if (itemStack == null) continue; - NBTTagCompound display = itemStack.getTagCompound().getCompoundTag("display"); - if (display == null) continue; - NBTTagList nbtTagList = display.getTagList("Lore", 8); - if (nbtTagList == null) continue; - for (int i = 0; i < nbtTagList.tagCount(); i++) { - String str = nbtTagList.getStringTagAt(i); - if (TextUtils.stripColor(str).startsWith("Gear")) { - int dungeonScore = Integer.parseInt(TextUtils.keepIntegerCharactersOnly(TextUtils.stripColor(str).split(" ")[2])); - if (dungeonScore > highestDungeonScore) { - highestItem = itemStack; - highestDungeonScore = dungeonScore; - } - } - } - } - - this.inventory.mainInventory[0] = highestItem; - this.inventory.currentItem = 0; - } - } - - public String getSkinType() { - return this.skinSet == null ? DefaultPlayerSkin.getSkinType(getGameProfile().getId()) : this.skinSet.getSkinType(); - } - - public ResourceLocation getLocationSkin() { - return com.google.common.base.Objects.firstNonNull(skinSet.getSkinLoc(), DefaultPlayerSkin.getDefaultSkin(getGameProfile().getId())); - } - - public ResourceLocation getLocationCape() { - return skinSet.getCapeLoc(); - } - - @Override - public ItemStack[] getInventory() { - return this.inventory.armorInventory; - } - - @Override - public boolean isInvisibleToPlayer(EntityPlayer player) { - return true; - } - - @Override - public Team getTeam() { - return new ScorePlayerTeam(null, null) { - @Override - public EnumVisible getNameTagVisibility() { - return EnumVisible.NEVER; - } - }; - } - } - - - - @Override - public String getEditRoute(RootConfigPanel rootConfigPanel) { - ConfigPanelCreator.map.put("base." + getKey() , new Supplier<MPanel>() { - @Override - public MPanel get() { - - MFeatureEdit featureEdit = new MFeatureEdit(FeatureViewPlayerOnJoin.this, rootConfigPanel); - featureEdit.addParameterEdit("datarenderers", new DataRendererEditor(FeatureViewPlayerOnJoin.this)); - for (FeatureParameter parameter: getParameters()) { - if (parameter.getKey().equals("datarenderers")) continue; - featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(FeatureViewPlayerOnJoin.this, parameter, rootConfigPanel)); - } - return featureEdit; - } - }); - return "base." + getKey() ; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java deleted file mode 100644 index ab9fdcd9..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureActions.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.secret; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.actions.Action; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; -import kr.syeyoung.dungeonsguide.features.text.StyledText; -import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; -import kr.syeyoung.dungeonsguide.features.text.TextStyle; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; - -import java.awt.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class FeatureActions extends TextHUDFeature { - public FeatureActions() { - super("Dungeon Secrets", "Action Viewer", "View List of actions that needs to be taken", "secret.actionview", false, 200, getFontRenderer().FONT_HEIGHT * 10); - - getStyles().add(new TextStyle("pathfinding", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("mechanic", new AColor(0x55, 0xFF,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("separator", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("state", new AColor(0x55, 0xFF,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("current", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("number", new AColor(0x00, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("dot", new AColor(0x55, 0x55,0x55,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("action", new AColor(0x55, 0xFF,0xFF,255), new AColor(0, 0,0,0), false)); - getStyles().add(new TextStyle("afterline", new AColor(0xAA, 0xAA,0xAA,255), new AColor(0, 0,0,0), false)); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - - @Override - public boolean doesScaleWithHeight() { - return false; - } - - @Override - public boolean isHUDViewable() { - if (!skyblockStatus.isOnDungeon()) return false; - if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return false; - DungeonContext context = skyblockStatus.getContext(); - - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - if (dungeonRoom == null) return false; - return dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor; - } - - private static final List<StyledText> dummyText= new ArrayList<StyledText>(); - static { - dummyText.add(new StyledText("Pathfinding ","pathfinding")); - dummyText.add(new StyledText("Secret ","mechanic")); - dummyText.add(new StyledText("-> ","separator")); - dummyText.add(new StyledText("Found\n","state")); - dummyText.add(new StyledText("> ","current")); - dummyText.add(new StyledText("1","number")); - dummyText.add(new StyledText(". ","dot")); - dummyText.add(new StyledText("Move ","action")); - dummyText.add(new StyledText("OffsetPoint{x=1,y=42,z=1} \n","afterline")); - dummyText.add(new StyledText(" ","current")); - dummyText.add(new StyledText("2","number")); - dummyText.add(new StyledText(". ","dot")); - dummyText.add(new StyledText("Click ","action")); - dummyText.add(new StyledText("OffsetPoint{x=1,y=42,z=1} \n","afterline")); - dummyText.add(new StyledText(" ","current")); - dummyText.add(new StyledText("3","number")); - dummyText.add(new StyledText(". ","dot")); - dummyText.add(new StyledText("Profit ","action")); - } - - @Override - public List<String> getUsedTextStyle() { - return Arrays.asList("pathfinding","mechanic","separator","state","current", "number", "dot", "action", "afterline"); - } - - @Override - public List<StyledText> getDummyText() { - return dummyText; - } - - - @Override - public List<StyledText> getText() { - List<StyledText> actualBit = new ArrayList<StyledText>(); - - DungeonContext context = skyblockStatus.getContext(); - - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - - for (ActionRoute path : ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).getPath().values()) { - actualBit.add(new StyledText("Pathfinding ","pathfinding")); - actualBit.add(new StyledText(path.getMechanic()+" ","mechanic")); - actualBit.add(new StyledText("-> ","separator")); - actualBit.add(new StyledText(path.getState()+"\n","state")); - - for (int i = Math.max(0,path.getCurrent()-2); i < path.getActions().size(); i++) { - actualBit.add(new StyledText((i == path.getCurrent() ? ">" : " ") +" ","current")); - actualBit.add(new StyledText(i+"","number")); - actualBit.add(new StyledText(". ","dot")); - Action action = path.getActions().get(i); - String[] str = action.toString().split("\n"); - actualBit.add(new StyledText(str[0] + " ","action")); - actualBit.add(new StyledText("(","afterline")); - for (int i1 = 1; i1 < str.length; i1++) { - String base = str[i1].trim(); - if (base.startsWith("-")) - base = base.substring(1); - base = base.trim(); - actualBit.add(new StyledText(base+" ","afterline")); - } - actualBit.add(new StyledText(")\n","afterline")); - } - } - return actualBit; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureBloodRush.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureBloodRush.java deleted file mode 100644 index 857dc9f0..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureBloodRush.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.secret; - -import kr.syeyoung.dungeonsguide.features.listener.KeybindPressedListener; -import kr.syeyoung.dungeonsguide.events.KeyBindPressedEvent; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ChatComponentText; -import org.lwjgl.input.Keyboard; - -public class FeatureBloodRush extends SimpleFeature implements KeybindPressedListener { - public FeatureBloodRush() { - super("Dungeon Secrets.Blood Rush", "Blood Rush Mode", "Auto pathfind to witherdoors. \nCan be toggled with key set in settings", "secret.bloodrush", false); - this.parameters.put("key", new FeatureParameter<Integer>("key", "Key", "Press to toggle Blood Rush", Keyboard.KEY_NONE, "keybind")); - } - - @Override - public void onKeybindPress(KeyBindPressedEvent keyBindPressedEvent) { - if (keyBindPressedEvent.getKey() == this.<Integer>getParameter("key").getValue()) { - setEnabled(!isEnabled()); - try { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fToggled Blood Rush to §e"+(FeatureRegistry.SECRET_BLOOD_RUSH.isEnabled() ? "on":"off"))); - } catch (Exception ignored) {} - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureCreateRefreshLine.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureCreateRefreshLine.java deleted file mode 100644 index d8e3ac2f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureCreateRefreshLine.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.secret; - -import com.google.common.base.Supplier; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import org.lwjgl.input.Keyboard; - -import java.util.LinkedHashMap; - -public class FeatureCreateRefreshLine extends SimpleFeature { - public FeatureCreateRefreshLine() { - super("Dungeon Secrets.Keybinds", "Refresh pathfind line or Trigger pathfind", "A keybind for creating or refresh pathfind lines for pathfind contexts that doesn't have line, or contexts that has refresh rate set to -1.\nPress settings to edit the key", "secret.refreshPathfind", true); - this.parameters = new LinkedHashMap<>(); - this.parameters.put("key", new FeatureParameter<Integer>("key", "Key","Press to refresh or create pathfind line", Keyboard.KEY_NONE, "keybind")); - this.parameters.put("pathfind", new FeatureParameter<Boolean>("pathfind", "Enable Pathfinding", "Force Enable pathfind for future actions when used", false, "boolean")); - this.parameters.put("refreshrate", new FeatureParameter<Integer>("refreshrate", "Line Refreshrate", "Ticks to wait per line refresh, to be overriden. If the line already has pathfind enabled, this value does nothing. Specify it to -1 to don't refresh line at all", 10, "integer")); - } - public int getKeybind() {return this.<Integer>getParameter("key").getValue();} - public boolean isPathfind() { - return this.<Boolean>getParameter("pathfind").getValue(); - } - public int getRefreshRate() { - return this.<Integer>getParameter("refreshrate").getValue(); - } - - - public String getEditRoute(RootConfigPanel rootConfigPanel) { - ConfigPanelCreator.map.put("base." + getKey() , new Supplier<MPanel>() { - @Override - public MPanel get() { - MFeatureEdit featureEdit = new MFeatureEdit(FeatureCreateRefreshLine.this, rootConfigPanel); - for (FeatureParameter parameter: getParameters()) { - if (parameter.getKey().equals("refreshrate")) - featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(FeatureCreateRefreshLine.this, parameter, rootConfigPanel, a -> !isPathfind())); - else - featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(FeatureCreateRefreshLine.this, parameter, rootConfigPanel, a -> false)); - } - return featureEdit; - } - }); - return "base." + getKey() ; - } - - - -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureFreezePathfind.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureFreezePathfind.java deleted file mode 100644 index 225a7850..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureFreezePathfind.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.secret; - -import kr.syeyoung.dungeonsguide.features.listener.KeybindPressedListener; -import kr.syeyoung.dungeonsguide.events.KeyBindPressedEvent; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ChatComponentText; -import org.lwjgl.input.Keyboard; - -public class FeatureFreezePathfind extends SimpleFeature implements KeybindPressedListener { - public FeatureFreezePathfind() { - super("Dungeon Secrets.Keybinds", "Global Freeze Pathfind", "Freeze Pathfind, meaning the pathfind lines won't change when you move.\nPress settings to edit the key", "secret.freezepathfind", false); - this.parameters.put("key", new FeatureParameter<Integer>("key", "Key", "Press to toggle freeze pathfind", Keyboard.KEY_NONE, "keybind")); - } - - @Override - public void onKeybindPress(KeyBindPressedEvent keyBindPressedEvent) { - if (keyBindPressedEvent.getKey() == this.<Integer>getParameter("key").getValue()) { - setEnabled(!isEnabled()); - try { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fToggled Pathfind Freeze to §e"+(FeatureRegistry.SECRET_FREEZE_LINES.isEnabled() ? "on":"off"))); - } catch (Exception ignored) {} - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeaturePathfindStrategy.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeaturePathfindStrategy.java deleted file mode 100644 index 6e1dccbc..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeaturePathfindStrategy.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.secret; - -import com.google.common.base.Supplier; -import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.gui.elements.MStringSelectionButton; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -import java.awt.*; -import java.util.Arrays; -import java.util.stream.Collectors; - -public class FeaturePathfindStrategy extends SimpleFeature { - public FeaturePathfindStrategy() { - super("Dungeon Secrets", "Pathfind Algorithm", "Select pathfind algorithm used by paths", "secret.secretpathfind.algorithm", true); - this.parameters.put("strategy", new FeatureParameter<String>("strategy", "Pathfind Strategy", "Pathfind Strategy", "THETA_STAR", "string")); - - } - - @Override - public boolean isDisyllable() { - return false; - } - - @Override - public String getEditRoute(RootConfigPanel rootConfigPanel) { - ConfigPanelCreator.map.put("base." + getKey() , new Supplier<MPanel>() { - @Override - public MPanel get() { - - MFeatureEdit featureEdit = new MFeatureEdit(FeaturePathfindStrategy.this, rootConfigPanel); - PathfindStrategy alignment = getPathfindStrat(); - MStringSelectionButton mStringSelectionButton = new MStringSelectionButton(Arrays.stream(PathfindStrategy.values()).map(Enum::name).collect(Collectors.toList()), alignment.name()) { - @Override - public Dimension getPreferredSize() { - return new Dimension(150, 20); - } - }; - mStringSelectionButton.setOnUpdate(() -> { - FeaturePathfindStrategy.this.<String>getParameter("strategy").setValue(mStringSelectionButton.getSelected()); - FeaturePathfindStrategy.this.<String>getParameter("strategy").setDescription(getPathfindStrat().getDescription()); - featureEdit.removeParameterEdit(null); - }); - featureEdit.addParameterEdit("strategy", new MParameterEdit(FeaturePathfindStrategy.this, FeaturePathfindStrategy.this.<String>getParameter("strategy"), rootConfigPanel, mStringSelectionButton, (a) -> false)); - - for (FeatureParameter parameter: getParameters()) { - if (parameter.getKey().equals("strategy")) continue; - featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(FeaturePathfindStrategy.this, parameter, rootConfigPanel)); - } - return featureEdit; - } - }); - return "base." + getKey() ; - } - - @Getter @RequiredArgsConstructor - public enum PathfindStrategy { - THETA_STAR("The default pathfinding algorithm. It will generate sub-optimal path quickly."), - A_STAR_DIAGONAL("New pathfinding algorithm. It will generate path that looks like the one JPS generates"), - A_STAR_FINE_GRID("New pathfinding algorithm. It will generate path that kind of looks like stair"), - JPS_LEGACY("The improved pathfinding algorithm. Not suggested for usage. It will have problems on diagonal movements, thus giving wrong routes"), - A_STAR_LEGACY("The first pathfinding algorithm. It may have problem on navigating through stairs. This is the one used by Minecraft for mob pathfind."); - - private final String description; - } - - @Override - public void loadConfig(JsonObject jsonObject) { - super.loadConfig(jsonObject); - FeaturePathfindStrategy.PathfindStrategy alignment; - try { - alignment = PathfindStrategy.valueOf(FeaturePathfindStrategy.this.<String>getParameter("strategy").getValue()); - } catch (Exception e) {alignment = PathfindStrategy.THETA_STAR;} - FeaturePathfindStrategy.this.<String>getParameter("strategy").setValue(alignment.name()); - FeaturePathfindStrategy.this.<String>getParameter("strategy").setDescription(alignment.getDescription()); - } - - public PathfindStrategy getPathfindStrat() { - return PathfindStrategy.valueOf(FeaturePathfindStrategy.this.<String>getParameter("strategy").getValue()); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeaturePathfindToAll.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeaturePathfindToAll.java deleted file mode 100644 index 886eefef..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeaturePathfindToAll.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.secret; - -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -public class FeaturePathfindToAll extends SimpleFeature { - public FeaturePathfindToAll(){ - super("Dungeon Secrets.Pathfind To All", "Start pathfind to all secrets upon entering a room", "Auto browse to all secrets in the room", "secret.secretpathfind.allbrowse", false); - this.parameters.put("bat", new FeatureParameter<Boolean>("bat", "Trigger pathfind to Bat", "This feature will trigger pathfind to all bats in this room when entering a room", true, "boolean")); - this.parameters.put("chest", new FeatureParameter<Boolean>("chest", "Trigger pathfind to Chest", "This feature will trigger pathfind to all chests in this room when entering a room", true, "boolean")); - this.parameters.put("essence", new FeatureParameter<Boolean>("essence", "Trigger pathfind to Essence", "This feature will trigger pathfind to all essences in this room when entering a room", true, "boolean")); - this.parameters.put("itemdrop", new FeatureParameter<Boolean>("itemdrop", "Trigger pathfind to Itemdrop", "This feature will trigger pathfind to all itemdrops in this room when entering a room", true, "boolean")); - } - - public boolean isBat() { - return this.<Boolean>getParameter("bat").getValue(); - } - public boolean isChest() { - return this.<Boolean>getParameter("chest").getValue(); - } - public boolean isEssence() { - return this.<Boolean>getParameter("essence").getValue(); - } - public boolean isItemdrop() { - return this.<Boolean>getParameter("itemdrop").getValue(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureSoulRoomWarning.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureSoulRoomWarning.java deleted file mode 100644 index 983674fd..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureSoulRoomWarning.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.secret; - -import com.google.common.base.Supplier; -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonFairySoul; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; -import kr.syeyoung.dungeonsguide.features.listener.TickListener; -import kr.syeyoung.dungeonsguide.features.text.*; -import kr.syeyoung.dungeonsguide.gui.elements.MButton; -import kr.syeyoung.dungeonsguide.gui.elements.MPassiveLabelAndElement; -import kr.syeyoung.dungeonsguide.gui.elements.MStringSelectionButton; -import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.text.*; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.awt.*; -import java.util.*; -import java.util.List; -import java.util.function.Predicate; - -public class FeatureSoulRoomWarning extends TextHUDFeature implements TickListener { - - public FeatureSoulRoomWarning() { - super("Dungeon.Dungeon Information","Secret Soul Alert", "Alert if there is an fairy soul in the room", "secret.fairysoulwarn", true, getFontRenderer().getStringWidth("There is a fairy soul in this room!"), getFontRenderer().FONT_HEIGHT); - getStyles().add(new TextStyle("warning", new AColor(0xFF, 0x69,0x17,255), new AColor(0, 0,0,0), false)); - - this.parameters.put("roomuids", new FeatureParameter("roomuids", "Disabled room Names", "Disable for these rooms", new ArrayList<>(), "stringlist")); - } - - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - @Override - public boolean isHUDViewable() { - return warning > System.currentTimeMillis(); - } - - @Override - public List<String> getUsedTextStyle() { - return Collections.singletonList("warning"); - } - - private UUID lastRoomUID = UUID.randomUUID(); - private long warning = 0; - - private static final List<StyledText> text = new ArrayList<StyledText>(); - static { - text.add(new StyledText("There is a fairy soul in this room!", "warning")); - } - - @Override - public List<StyledText> getText() { - return text; - } - - - @Override - public void onTick() { - if (!skyblockStatus.isOnDungeon()) return; - if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return; - DungeonContext context = skyblockStatus.getContext(); - - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - if (thePlayer == null) return; - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - if (dungeonRoom == null) return; - if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return; - - if (!dungeonRoom.getDungeonRoomInfo().getUuid().equals(lastRoomUID)) { - for (DungeonMechanic value : dungeonRoom.getMechanics().values()) { - if (value instanceof DungeonFairySoul) - warning = System.currentTimeMillis() + 2500; - } - lastRoomUID = dungeonRoom.getDungeonRoomInfo().getUuid(); - } - } - - @Override - public String getEditRoute(RootConfigPanel rootConfigPanel) { - ConfigPanelCreator.map.put("base." + getKey() , new Supplier<MPanel>() { - @Override - public MPanel get() { - - MFeatureEdit featureEdit = new MFeatureEdit(FeatureSoulRoomWarning.this, rootConfigPanel); - featureEdit.addParameterEdit("textStyleNEW", new PanelTextParameterConfig(FeatureSoulRoomWarning.this)); - - StyledTextRenderer.Alignment alignment = StyledTextRenderer.Alignment.valueOf(FeatureSoulRoomWarning.this.<String>getParameter("alignment").getValue()); - MStringSelectionButton mStringSelectionButton = new MStringSelectionButton(Arrays.asList("LEFT", "CENTER", "RIGHT"), alignment.name()); - mStringSelectionButton.setOnUpdate(() -> { - FeatureSoulRoomWarning.this.<String>getParameter("alignment").setValue(mStringSelectionButton.getSelected()); - }); - featureEdit.addParameterEdit("alignment", new MParameterEdit(FeatureSoulRoomWarning.this, FeatureSoulRoomWarning.this.<String>getParameter("alignment"), rootConfigPanel, mStringSelectionButton, (a) -> false)); - - for (FeatureParameter parameter: getParameters()) { - if (parameter.getKey().equals("textStylesNEW")) continue; - if (parameter.getKey().equals("alignment")) continue; - if (parameter.getKey().equals("roomuids")) continue; - featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(FeatureSoulRoomWarning.this, parameter, rootConfigPanel)); - } - featureEdit.addParameterEdit("roomuids", new RoomSelectionPanel(FeatureSoulRoomWarning.this.<List<String>>getParameter("roomuids"), (a) -> { - for (DungeonMechanic value : a.getMechanics().values()) { - if (value instanceof DungeonFairySoul) return true; - } - return false; - }) ); - return featureEdit; - } - }); - return "base." + getKey() ; - } - - public static class RoomSelectionPanel extends MPanel { - FeatureParameter<List<String>> uids; - private List<MPassiveLabelAndElement> passiveLabelAndElements = new ArrayList<>(); - private List<MToggleButton> toggleButtons = new ArrayList<>(); - private MButton addAll, removeAll; - public RoomSelectionPanel(FeatureParameter<List<String>> roomuids, Predicate<DungeonRoomInfo> selectableRooms) { - this.uids = roomuids; - for (DungeonRoomInfo dungeonRoomInfo : DungeonRoomInfoRegistry.getRegistered()) { - if (!selectableRooms.test(dungeonRoomInfo)) continue; - MToggleButton mToggleButton = new MToggleButton(); - mToggleButton.setEnabled(!roomuids.getValue().contains(dungeonRoomInfo.getUuid().toString())); - mToggleButton.setOnToggle(() -> { - if (mToggleButton.isEnabled()) - roomuids.getValue().remove(dungeonRoomInfo.getUuid().toString()); - else - roomuids.getValue().add(dungeonRoomInfo.getUuid().toString()); - }); - toggleButtons.add(mToggleButton); - MPassiveLabelAndElement passiveLabelAndElement = new MPassiveLabelAndElement(dungeonRoomInfo.getName(), mToggleButton); - passiveLabelAndElement.setDivideRatio(0.7); - passiveLabelAndElements.add(passiveLabelAndElement); - } - for (MPassiveLabelAndElement passiveLabelAndElement : passiveLabelAndElements) { - add(passiveLabelAndElement); - } - { - addAll = new MButton(); addAll.setText("Enable All"); - addAll.setOnActionPerformed(() -> { - roomuids.getValue().clear(); - for (MToggleButton toggleButton : toggleButtons) { - toggleButton.setEnabled(true); - } - }); - removeAll = new MButton(); removeAll.setText("Disable All"); - removeAll.setOnActionPerformed(() -> { - for (MToggleButton toggleButton : toggleButtons) { - toggleButton.setEnabled(false); - toggleButton.getOnToggle().run(); - } - }); - add(addAll); add(removeAll); - } - } - - @Override - public Dimension getPreferredSize() { - return new Dimension(-1, (int) (20 * Math.ceil(passiveLabelAndElements.size() / 3) + 27)); - } - - @Override - public void onBoundsUpdate() { - int xI = 0; - int y = 22; - int w3 = (getBounds().width-20) / 3; - for (MPassiveLabelAndElement passiveLabelAndElement : passiveLabelAndElements) { - passiveLabelAndElement.setBounds(new Rectangle(5 + xI * (w3+5), y, w3, 20)); - xI ++; - if (xI == 3) { - xI = 0; - y += 20; - } - } - - addAll.setBounds(new Rectangle(getBounds().width-150, 2, 70, 14)); - removeAll.setBounds(new Rectangle(getBounds().width-75, 2, 70, 14)); - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - Gui.drawRect(0,0,getBounds().width, getBounds().height,RenderUtils.blendAlpha(0x141414, 0.12f)); - Gui.drawRect(1,18,getBounds().width -1, getBounds().height-1, RenderUtils.blendAlpha(0x141414, 0.15f)); - Gui.drawRect(1,1,getBounds().width-1, 18, RenderUtils.blendAlpha(0x141414, 0.12f)); - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - GlStateManager.pushMatrix(); - GlStateManager.translate(5,5,0); - GlStateManager.scale(1.0,1.0,0); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Enable for these rooms", 0,0, 0xFFFFFFFF); - GlStateManager.popMatrix(); - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureTogglePathfind.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureTogglePathfind.java deleted file mode 100644 index b4d41096..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureTogglePathfind.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.secret; - -import kr.syeyoung.dungeonsguide.features.listener.KeybindPressedListener; -import kr.syeyoung.dungeonsguide.events.KeyBindPressedEvent; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ChatComponentText; -import org.lwjgl.input.Keyboard; - -public class FeatureTogglePathfind extends SimpleFeature implements KeybindPressedListener { - public FeatureTogglePathfind() { - super("Dungeon Secrets.Keybinds", "Toggle Pathfind Lines", "A key for toggling pathfound line visibility.\nPress settings to edit the key", "secret.togglePathfind"); - this.parameters.put("key", new FeatureParameter<Integer>("key", "Key", "Press to toggle pathfind lines", Keyboard.KEY_NONE, "keybind")); - } - public boolean togglePathfindStatus = false; - - @Override - public void onKeybindPress(KeyBindPressedEvent keyBindPressedEvent) { - if (keyBindPressedEvent.getKey() == this.<Integer>getParameter("key").getValue() && isEnabled()) { - togglePathfindStatus = !togglePathfindStatus; - try { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fToggled Pathfind Line visibility to §e"+(togglePathfindStatus ? "on":"off"))); - } catch (Exception ignored) {} - } - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/PathfindLineProperties.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/PathfindLineProperties.java deleted file mode 100644 index 9405814d..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/PathfindLineProperties.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.secret; - -import com.google.common.base.Supplier; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import kr.syeyoung.dungeonsguide.gui.MPanel; - -import java.util.LinkedHashMap; - -public class PathfindLineProperties extends SimpleFeature { - private PathfindLineProperties parent; - public PathfindLineProperties(String category, String name, String description, String key, boolean useParent, PathfindLineProperties parent) { - super(category, name, description, key); - this.parent = parent; - this.parameters = new LinkedHashMap<>(); - if (parent != null) - this.parameters.put("useGlobal", new FeatureParameter<Boolean>("useGlobal", "Use Global Settings instead of this", "Completely ignore these settings, then use the parent one:: '"+parent.getName()+"'", useParent, "boolean")); - this.parameters.put("pathfind", new FeatureParameter<Boolean>("pathfind", "Enable Pathfinding", "Enable pathfind for secrets", useParent, "boolean")); - this.parameters.put("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the pathfind line", new AColor(0xFFFF0000, true), "acolor")); - this.parameters.put("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the pathfind line",1.0f, "float")); - this.parameters.put("linerefreshrate", new FeatureParameter<Integer>("linerefreshrate", "Line Refreshrate", "Ticks to wait per line refresh. Specify it to -1 to don't refresh line at all", 10, "integer")); - this.parameters.put("beacon", new FeatureParameter<Boolean>("beacon", "Enable Beacons", "Enable beacons for pathfind line targets", true, "boolean")); - this.parameters.put("beamColor", new FeatureParameter<AColor>("beamColor", "Beam Color", "Color of the beacon beam", new AColor(0x77FF0000, true), "acolor")); - this.parameters.put("beamTargetColor", new FeatureParameter<AColor>("beamTargetColor", "Target Color", "Color of the target", new AColor(0x33FF0000, true), "acolor")); - } - - - public String getEditRoute(RootConfigPanel rootConfigPanel) { - ConfigPanelCreator.map.put("base." + getKey() , new Supplier<MPanel>() { - @Override - public MPanel get() { - MFeatureEdit featureEdit = new MFeatureEdit(PathfindLineProperties.this, rootConfigPanel); - for (FeatureParameter parameter: getParameters()) { - if (parameter.getKey().startsWith("line")) - featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(PathfindLineProperties.this, parameter, rootConfigPanel, a -> isGlobal() || !isPathfind())); - else if (parameter.getKey().startsWith("beam")) - featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(PathfindLineProperties.this, parameter, rootConfigPanel, a -> isGlobal() || !isBeacon())); - else if (!parameter.getKey().equals("useGlobal")) - featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(PathfindLineProperties.this, parameter, rootConfigPanel, a -> isGlobal())); - else - featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(PathfindLineProperties.this, parameter, rootConfigPanel, a -> false)); - } - return featureEdit; - } - }); - return "base." + getKey() ; - } - - @Override - public boolean isDisyllable() { - return false; - } - - public boolean isGlobal() { - if (parent == null) return false; - return this.<Boolean>getParameter("useGlobal").getValue(); - } - - public boolean isPathfind() { - return isGlobal() ? parent.isPathfind() : this.<Boolean>getParameter("pathfind").getValue(); - } - public AColor getLineColor() { - return isGlobal() ? parent.getLineColor() : this.<AColor>getParameter("lineColor").getValue(); - } - public float getLineWidth() { - return isGlobal() ? parent.getLineWidth() : this.<Float>getParameter("lineWidth").getValue(); - } - public int getRefreshRate() { - return isGlobal() ? parent.getRefreshRate() : this.<Integer>getParameter("linerefreshrate").getValue(); - } - public boolean isBeacon() { - return isGlobal() ? parent.isBeacon() : this.<Boolean>getParameter("beacon").getValue(); - } - public AColor getBeamColor() { - return isGlobal() ? parent.getBeamColor() : this.<AColor>getParameter("beamColor").getValue(); - } - public AColor getTargetColor() { - return isGlobal() ? parent.getTargetColor() : this.<AColor>getParameter("beamTargetColor").getValue(); - } - public ActionRoute.ActionRouteProperties getRouteProperties() { - ActionRoute.ActionRouteProperties actionRouteProperties = new ActionRoute.ActionRouteProperties(); - actionRouteProperties.setPathfind(isPathfind()); - actionRouteProperties.setLineColor(getLineColor()); - actionRouteProperties.setLineWidth(getLineWidth()); - actionRouteProperties.setLineRefreshRate(getRefreshRate()); - actionRouteProperties.setBeacon(isBeacon()); - actionRouteProperties.setBeaconBeamColor(getBeamColor()); - actionRouteProperties.setBeaconColor(getTargetColor()); - return actionRouteProperties; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java deleted file mode 100644 index 1979d741..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/FeatureMechanicBrowse.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.secret.mechanicbrowser; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.SkyblockStatus; -import kr.syeyoung.dungeonsguide.config.types.GUIRectangle; -import kr.syeyoung.dungeonsguide.features.listener.GuiClickListener; -import kr.syeyoung.dungeonsguide.features.listener.GuiPreRenderListener; -import kr.syeyoung.dungeonsguide.features.listener.WorldRenderListener; -import kr.syeyoung.dungeonsguide.gui.elements.MFloatSelectionButton; -import kr.syeyoung.dungeonsguide.gui.elements.MPassiveLabelAndElement; -import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.*; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.util.MathHelper; -import net.minecraftforge.client.event.GuiScreenEvent; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.awt.*; -import java.io.IOException; -import java.util.*; -import java.util.List; - -public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderListener, GuiClickListener, WorldRenderListener { - public FeatureMechanicBrowse() { - super("Dungeon Secrets.Secret Browser","Secret Browser", "Browse and Pathfind secrets and mechanics in the current room", "secret.mechanicbrowse", false, 100, 300); - parameters.put("scale", new FeatureParameter<Float>("scale", "Scale", "Scale", 1.0f, "float")); - mGuiMechanicBrowser = new MGuiMechanicBrowser(this); - mGuiMechanicBrowser.setWorldAndResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); - lastWidth = Minecraft.getMinecraft().displayWidth; lastHeight = Minecraft.getMinecraft().displayHeight; - } - - public double getScale() { - return this.<Float>getParameter("scale").getValue(); - } - - private MGuiMechanicBrowser mGuiMechanicBrowser; - - - @Override - public void drawDemo(float partialTicks) { - super.drawDemo(partialTicks); - double scale = FeatureMechanicBrowse.this.<Float>getParameter("scale").getValue(); - GlStateManager.scale(scale, scale, 1.0); - - Dimension bigDim = getFeatureRect().getRectangleNoScale().getSize(); - Dimension effectiveDim = new Dimension((int) (bigDim.width / scale),(int)( bigDim.height / scale)); - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - Gui.drawRect(0, 0, effectiveDim.width, fr.FONT_HEIGHT + 4, 0xFF444444); - Gui.drawRect(1, 1, effectiveDim.width - 1, fr.FONT_HEIGHT + 3, 0xFF262626); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Selected: ", 2,2, 0xFFAAAAAA); - fr.drawString("Nothing", fr.getStringWidth("Selected: ") + 2,2, 0xFFAA0000); - fr.drawString("Open Chat to Select Secrets", 2, fr.FONT_HEIGHT + 5, 0xFFAAAAAA); - } - - private int lastWidth, lastHeight; - - @Override - public void drawScreen(float partialTicks) { - if (!isEnabled()) return; - int i = Mouse.getEventX(); - int j = Minecraft.getMinecraft().displayHeight - Mouse.getEventY(); - if (Minecraft.getMinecraft().displayWidth != lastWidth || Minecraft.getMinecraft().displayHeight != lastHeight) mGuiMechanicBrowser.initGui(); - lastWidth = Minecraft.getMinecraft().displayWidth; lastHeight = Minecraft.getMinecraft().displayHeight; - mGuiMechanicBrowser.drawScreen(i,j,partialTicks); - } - - @Override - public void setFeatureRect(GUIRectangle featureRect) { - super.setFeatureRect(featureRect); - mGuiMechanicBrowser.initGui(); - } - - @Override - public void drawHUD(float partialTicks) { } - - @Override - public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) { - if (!isEnabled()) return; - try { - mGuiMechanicBrowser.handleMouseInput(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - - @Override - public void onGuiPreRender(GuiScreenEvent.DrawScreenEvent.Pre rendered) { - if (!isEnabled()) return; - int i = Mouse.getEventX(); - int j = Minecraft.getMinecraft().displayHeight - Mouse.getEventY(); - mGuiMechanicBrowser.drawScreen(i, j, rendered.renderPartialTicks); - } - - @Override - public void drawWorld(float partialTicks) { - if (!isEnabled()) return; - SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus(); - if (!skyblockStatus.isOnDungeon()) return; - if (skyblockStatus.getContext() == null || !skyblockStatus.getContext().getMapProcessor().isInitialized()) return; - DungeonContext context = skyblockStatus.getContext(); - - EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer; - Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition()); - DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt); - if (dungeonRoom == null) return; - if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return; - String id = mGuiMechanicBrowser.getPanelMechanicBrowser().getSelectedID(); - if (id != null) { - Optional.ofNullable(dungeonRoom.getMechanics().get(mGuiMechanicBrowser.getPanelMechanicBrowser().getSelectedID())) - .ifPresent(a -> { - a.highlight(new Color(0,255,255,50), id +" ("+( - dungeonRoom.getMechanics().get(id).getRepresentingPoint(dungeonRoom) != null ? - String.format("%.1f", MathHelper.sqrt_double((dungeonRoom.getMechanics().get(id)).getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "") - +"m)", dungeonRoom, partialTicks); - }); - } - } - @Override - public List<MPanel> getTooltipForEditor(GuiGuiLocationConfig guiGuiLocationConfig) { - List<MPanel> mPanels = super.getTooltipForEditor(guiGuiLocationConfig); - - mPanels.add(new MPassiveLabelAndElement("Scale", new MFloatSelectionButton(FeatureMechanicBrowse.this.<Float>getParameter("scale").getValue()) {{ - setOnUpdate(() ->{ - FeatureMechanicBrowse.this.<Float>getParameter("scale").setValue(this.getData()); - mGuiMechanicBrowser.initGui(); - }); } - })); - - return mPanels; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MGuiMechanicBrowser.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MGuiMechanicBrowser.java deleted file mode 100644 index 27d5e583..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MGuiMechanicBrowser.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.secret.mechanicbrowser; - -import kr.syeyoung.dungeonsguide.gui.MGui; -import lombok.Getter; - -public class MGuiMechanicBrowser extends MGui { - private FeatureMechanicBrowse featureMechanicBrowse; - @Getter - private PanelMechanicBrowser panelMechanicBrowser; - public MGuiMechanicBrowser(FeatureMechanicBrowse mechanicBrowse) { - this.featureMechanicBrowse = mechanicBrowse; - panelMechanicBrowser = new PanelMechanicBrowser(mechanicBrowse); - getMainPanel().add(panelMechanicBrowser); - } - - @Override - public void initGui() { - super.initGui(); - panelMechanicBrowser.setBounds(featureMechanicBrowse.getFeatureRect().getRectangle()); - panelMechanicBrowser.setScale(featureMechanicBrowse.getScale()); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawScreen(mouseX, mouseY, partialTicks); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MechanicBrowserElement.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MechanicBrowserElement.java deleted file mode 100644 index a177684a..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MechanicBrowserElement.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.secret.mechanicbrowser; - -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor; -import lombok.AllArgsConstructor; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; - -import java.awt.*; -import java.util.function.BiConsumer; -import java.util.function.Supplier; - -@AllArgsConstructor -public class MechanicBrowserElement extends MPanel { - private Supplier<String> name; - private boolean isCategory = false; - private BiConsumer<MechanicBrowserElement, Point> onClick; - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - if (isCategory || isFocused) - Gui.drawRect(0, 0, bounds.width, bounds.height, 0xFF444444); - else if (lastAbsClip.contains(absMousex, absMousey)) - Gui.drawRect(0, 0, bounds.width, bounds.height, 0xFF555555); - Minecraft.getMinecraft().fontRendererObj.drawString((String)name.get(), 4, 1, 0xFFEEEEEE); - } - - @Override - public Dimension getPreferredSize() { - return new Dimension(Minecraft.getMinecraft().fontRendererObj.getStringWidth(name.get()) + 8, Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT); - } - - @Override - public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - if (lastAbsClip.contains(absMouseX, absMouseY) && onClick != null) - onClick.accept(this, new Point(lastParentPoint.x + bounds.x, lastParentPoint.y + bounds.y)); - } - - @Override - public void mouseMoved(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0) { - if (lastAbsClip.contains(absMouseX, absMouseY) && onClick != null) - setCursor(EnumCursor.POINTING_HAND); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MechanicBrowserTooltip.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MechanicBrowserTooltip.java deleted file mode 100644 index e2a0d028..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/MechanicBrowserTooltip.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.secret.mechanicbrowser; - -import kr.syeyoung.dungeonsguide.gui.elements.MList; -import kr.syeyoung.dungeonsguide.gui.elements.MTooltip; -import lombok.Getter; -import net.minecraft.client.gui.Gui; - -import java.awt.*; - -public class MechanicBrowserTooltip extends MTooltip { - @Getter - private MList mList; - public MechanicBrowserTooltip() { - mList = new MList(); - mList.setGap(0); - add(mList); - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - Dimension effectiveDim = getEffectiveDimension(); - Gui.drawRect(0, 0, effectiveDim.width, effectiveDim.height, 0xFF444444); - Gui.drawRect(1, 1, effectiveDim.width - 1, effectiveDim.height - 1, 0xFF262626); - } - - @Override - public void setBounds(Rectangle bounds) { - super.setBounds(bounds); - mList.setBounds(new Rectangle(1,1, getEffectiveDimension().width-2, getEffectiveDimension().height-2)); - mList.realignChildren(); - } - - @Override - public void setScale(double scale) { - super.setScale(scale); - mList.setBounds(new Rectangle(1,1, getEffectiveDimension().width-2, getEffectiveDimension().height-2)); - mList.realignChildren(); - } - - @Override - public Dimension getPreferredSize() { - Dimension dim = mList.getPreferredSize(); - return new Dimension((int) ((dim.width + 2) * getScale()), (int) ((dim.height + 2) * getScale())); - } - - @Override - public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - if (!lastAbsClip.contains(absMouseX, absMouseY)) close(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/PanelMechanicBrowser.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/PanelMechanicBrowser.java deleted file mode 100644 index 0457a2a8..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/mechanicbrowser/PanelMechanicBrowser.java +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.secret.mechanicbrowser; - -import kr.syeyoung.dungeonsguide.DungeonsGuide; -import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; -import kr.syeyoung.dungeonsguide.dungeon.mechanics.*; -import kr.syeyoung.dungeonsguide.gui.elements.MList; -import kr.syeyoung.dungeonsguide.gui.elements.MPanelScaledGUI; -import kr.syeyoung.dungeonsguide.gui.elements.MScrollablePanel; -import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; -import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.features.FeatureRegistry; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; -import lombok.Getter; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiChat; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.util.MathHelper; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.awt.*; -import java.util.*; -import java.util.List; - -public class PanelMechanicBrowser extends MPanelScaledGUI { - private FeatureMechanicBrowse feature; - private MScrollablePanel scrollablePanel; - private MList mList; - private MechanicBrowserTooltip mechanicBrowserTooltip; - - public PanelMechanicBrowser(FeatureMechanicBrowse mechanicBrowse) { - this.feature = mechanicBrowse; - this.scrollablePanel = new MScrollablePanel(1); - add(this.scrollablePanel); - scrollablePanel.getScrollBarY().setWidth(0); - mList = new MList() { - @Override - public void resize(int parentWidth, int parentHeight) { - setBounds(new Rectangle(0,0,parentWidth,parentHeight)); - Dimension prefSize = getPreferredSize(); - int hei = prefSize.height; - setBounds(new Rectangle(0,0,parentWidth,hei)); - realignChildren(); - } - }; - mList.setDrawLine(false); mList.setGap(0); - scrollablePanel.add(mList); - } - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - toggleTooltip(openGUI()); - - Optional<DungeonRoom> dungeonRoomOpt = Optional.ofNullable(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext()) - .map(DungeonContext::getMapProcessor).map(a->a.worldPointToRoomPoint(Minecraft.getMinecraft().thePlayer.getPosition())) - .map(a -> DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext().getRoomMapper().get(a)); - - DungeonRoom dungeonRoom = dungeonRoomOpt.orElse(null); - renderTick(dungeonRoom); - if (dungeonRoom == null) return; - if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return; - - GeneralRoomProcessor grp = (GeneralRoomProcessor) dungeonRoom.getRoomProcessor(); - - - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - - Dimension effectiveDim = getEffectiveDimension(); - - Gui.drawRect(0, 0, effectiveDim.width, fr.FONT_HEIGHT + 4, 0xFF444444); - Gui.drawRect(1, 1, effectiveDim.width - 1, fr.FONT_HEIGHT + 3, 0xFF262626); - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Selected: ", 2,2, 0xFFAAAAAA); - if (grp.getPath("MECH-BROWSER") == null) - fr.drawString("Nothing", fr.getStringWidth("Selected: ") + 2,2, 0xFFAA0000); - else { - ActionRoute route = grp.getPath("MECH-BROWSER"); - fr.drawString(route.getMechanic()+" -> "+route.getState(), fr.getStringWidth("Selected: ") + 2,2, 0xFFFFFF00); - } - fr.drawString("Open Chat to Select Secrets", 2, fr.FONT_HEIGHT + 5, 0xFFAAAAAA); - - if (!openGUI()) return; - - Gui.drawRect(0, fr.FONT_HEIGHT + 4, effectiveDim.width, effectiveDim.height, 0xFF444444); - Gui.drawRect(1, fr.FONT_HEIGHT + 5, effectiveDim.width - 1,effectiveDim.height - 1, 0xFF262626); - } - - private UUID lastRoomUID = null; - public void renderTick(DungeonRoom dungeonRoom) { - if (dungeonRoom == null && lastRoomUID != null) { - lastRoomUID = null; - for (MPanel childComponent : mList.getChildComponents()) { - mList.remove(childComponent); - } - if (mechanicBrowserTooltip != null) { - mechanicBrowserTooltip.close(); - mechanicBrowserTooltip = null; - } - selectedID = null; - } else if (dungeonRoom != null && lastRoomUID != dungeonRoom.getDungeonRoomInfo().getUuid()) { - lastRoomUID = dungeonRoom.getDungeonRoomInfo().getUuid(); - // SETUP THINGS. - for (MPanel childComponent : mList.getChildComponents()) { - mList.remove(childComponent); - } - if (mechanicBrowserTooltip != null) { - mechanicBrowserTooltip.close(); - mechanicBrowserTooltip = null; - } - selectedID = null; - mList.add(new MechanicBrowserElement(() -> "§bCancel Current", false, (pt, me) -> cancel(pt))); - - boolean found = false; - for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getMechanics().entrySet()) { - if (value.getValue() instanceof DungeonFairySoul) { - if (!found) { - mList.add(new MechanicBrowserElement(() -> "Fairy Soul", true, null)); - found = true; - } - mList.add(new MechanicBrowserElement(() -> value.getKey()+" §7("+ value.getValue().getCurrentState(dungeonRoom) +", "+ - (value.getValue().getRepresentingPoint(dungeonRoom) != null ? - String.format("%.1f", MathHelper.sqrt_double(value.getValue().getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "") - +"m)", false, (me, pt) -> onElementClick(value.getKey(), value.getValue(), pt, me))); - } - } - found = false; - for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getMechanics().entrySet()) { - if (value.getValue() instanceof DungeonSecret) { - if (!found) { - mList.add(new MechanicBrowserElement(() -> "Secrets", true, null)); - found = true; - } - mList.add(new MechanicBrowserElement(() -> value.getKey()+" §7("+ value.getValue().getCurrentState(dungeonRoom) +", "+ - (value.getValue().getRepresentingPoint(dungeonRoom) != null ? - String.format("%.1f", MathHelper.sqrt_double(value.getValue().getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "") - +"m)", false, (me, pt) -> onElementClick(value.getKey(), value.getValue(), pt, me))); - } - } - found = false; - for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getMechanics().entrySet()) { - if (value.getValue() instanceof DungeonTomb) { - if (!found) { - mList.add(new MechanicBrowserElement(() -> "Crypts", true, null)); - found = true; - } - mList.add(new MechanicBrowserElement(() -> value.getKey()+" §7("+ value.getValue().getCurrentState(dungeonRoom) +", "+ - (value.getValue().getRepresentingPoint(dungeonRoom) != null ? - String.format("%.1f", MathHelper.sqrt_double(value.getValue().getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "") - +"m)", false, (me, pt) -> onElementClick(value.getKey(), value.getValue(), pt, me))); - } - } - found = false; - for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getMechanics().entrySet()) { - if (value.getValue() instanceof DungeonNPC) { - if (!found) { - mList.add(new MechanicBrowserElement(() -> "NPC", true, null)); - found = true; - } - mList.add(new MechanicBrowserElement(() -> value.getKey()+" §7("+ value.getValue().getCurrentState(dungeonRoom) +", "+ - (value.getValue().getRepresentingPoint(dungeonRoom) != null ? - String.format("%.1f", MathHelper.sqrt_double(value.getValue().getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "") - +"m)", false, (me, pt) -> onElementClick(value.getKey(), value.getValue(), pt, me))); - } - } - found = false; - for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getMechanics().entrySet()) { - if (value.getValue() instanceof DungeonJournal) { - if (!found) { - mList.add(new MechanicBrowserElement(() -> "Journals", true, null)); - found = true; - } - mList.add(new MechanicBrowserElement(() -> value.getKey()+" §7("+ value.getValue().getCurrentState(dungeonRoom) +", "+ - (value.getValue().getRepresentingPoint(dungeonRoom) != null ? - String.format("%.1f", MathHelper.sqrt_double(value.getValue().getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "") - +"m)", false, (me, pt) -> onElementClick(value.getKey(), value.getValue(), pt, me))); - } - } - found = false; - for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getMechanics().entrySet()) { - if (value.getValue() instanceof DungeonRoomDoor){ - if (!found) { - mList.add(new MechanicBrowserElement(() -> "Gates", true, null)); - found = true; - } - mList.add(new MechanicBrowserElement(() -> value.getKey()+" §7("+ value.getValue().getCurrentState(dungeonRoom) +", "+ - (value.getValue().getRepresentingPoint(dungeonRoom) != null ? - String.format("%.1f", MathHelper.sqrt_double(value.getValue().getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "") - +"m)", false, (me, pt) -> onElementClick(value.getKey(), value.getValue(), pt, me))); - } - } - found = false; - for (Map.Entry<String, DungeonMechanic> value : dungeonRoom.getMechanics().entrySet()) { - if (value.getValue() instanceof DungeonDoor || value.getValue() instanceof DungeonBreakableWall || value.getValue() instanceof DungeonLever - || value.getValue() instanceof DungeonOnewayDoor || value.getValue() instanceof DungeonOnewayLever || value.getValue() instanceof DungeonPressurePlate) { - if (!found) { - mList.add(new MechanicBrowserElement(() -> "ETC", true, null)); - found = true; - } - mList.add(new MechanicBrowserElement(() -> value.getKey()+" §7("+ value.getValue().getCurrentState(dungeonRoom) +", "+ - (value.getValue().getRepresentingPoint(dungeonRoom) != null ? - String.format("%.1f", MathHelper.sqrt_double(value.getValue().getRepresentingPoint(dungeonRoom).getBlockPos(dungeonRoom).distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))) : "") - +"m)", false, (me, pt) -> onElementClick(value.getKey(), value.getValue(), pt, me))); - } - } - - scrollablePanel.evalulateContentArea(); - - } - } - - private int latestTooltipDY; - @Getter - private String selectedID = null; - public void onElementClick(String id, DungeonMechanic dungeonMechanic, Point pt, MechanicBrowserElement mechanicBrowserElement) { - Optional<DungeonRoom> dungeonRoomOpt = Optional.ofNullable(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext()) - .map(DungeonContext::getMapProcessor).map(a->a.worldPointToRoomPoint(Minecraft.getMinecraft().thePlayer.getPosition())) - .map(a -> DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext().getRoomMapper().get(a)); - selectedID = id; - - DungeonRoom dungeonRoom = dungeonRoomOpt.orElse(null); - if (dungeonRoom == null) return; - DungeonMechanic dungeonMechanic1 = dungeonRoom.getMechanics().get(id); - if (dungeonMechanic1 != dungeonMechanic) return; - Set<String> states = dungeonMechanic1.getPossibleStates(dungeonRoom); - - - if (mechanicBrowserTooltip != null) { - mechanicBrowserTooltip.close(); - } - - latestTooltipDY = (int) (pt.y * getScale() - bounds.y - 1); - - mechanicBrowserTooltip = new MechanicBrowserTooltip(); - for (String state : states) { - mechanicBrowserTooltip.getMList().add(new MechanicBrowserElement(() -> state, false, (m2, pt2) -> { - if (dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor) - ((GeneralRoomProcessor)dungeonRoom.getRoomProcessor()).pathfind("MECH-BROWSER", id, state, FeatureRegistry.SECRET_LINE_PROPERTIES_SECRET_BROWSER.getRouteProperties()); -// mechanicBrowserTooltip.close(); -// mechanicBrowserTooltip = null; - })); - } - mechanicBrowserTooltip.setScale(getScale()); - Dimension prefSize = mechanicBrowserTooltip.getPreferredSize(); - mechanicBrowserTooltip.setBounds(new Rectangle(bounds.x + - (bounds.x > Minecraft.getMinecraft().displayWidth/2 ? -prefSize.width : bounds.width), latestTooltipDY + bounds.y, prefSize.width, prefSize.height)); - mechanicBrowserTooltip.open(this); - } - - public void cancel(MechanicBrowserElement mechanicBrowserElement) { - Optional<DungeonRoom> dungeonRoomOpt = Optional.ofNullable(DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext()) - .map(DungeonContext::getMapProcessor).map(a->a.worldPointToRoomPoint(Minecraft.getMinecraft().thePlayer.getPosition())) - .map(a -> DungeonsGuide.getDungeonsGuide().getSkyblockStatus().getContext().getRoomMapper().get(a)); - mechanicBrowserElement.setFocused(false); - if (!dungeonRoomOpt.isPresent()) return; - DungeonRoom dungeonRoom = dungeonRoomOpt.get(); - if (!(dungeonRoom.getRoomProcessor() instanceof GeneralRoomProcessor)) return; - ((GeneralRoomProcessor) dungeonRoom.getRoomProcessor()).cancel("MECH-BROWSER"); - } - - public void toggleTooltip(boolean open) { - if (mechanicBrowserTooltip != null) { - if (open) { - mechanicBrowserTooltip.open(this); - } else { - mechanicBrowserTooltip.close(); - } - } - } - - @Override - public void setBounds(Rectangle bounds) { - super.setBounds(bounds); - Dimension dimension = getEffectiveDimension(); - int y = Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT + 4; - scrollablePanel.setBounds(new Rectangle(1,y + 1, dimension.width - 2, dimension.height - y - 2)); - scrollablePanel.evalulateContentArea(); - if (mechanicBrowserTooltip != null) { - Dimension prefSize = mechanicBrowserTooltip.getPreferredSize(); - mechanicBrowserTooltip.setScale(getScale()); - mechanicBrowserTooltip.setBounds(new Rectangle(bounds.x + (bounds.x > Minecraft.getMinecraft().displayWidth/2 ? -prefSize.width: bounds.width), latestTooltipDY + bounds.y, prefSize.width, prefSize.height)); - } - } - - public boolean openGUI() { - return Minecraft.getMinecraft().currentScreen != null - && Minecraft.getMinecraft().currentScreen instanceof GuiChat && lastRoomUID != null; - } - - @Override - public List<MPanel> getChildComponents() { - return openGUI() ? super.getChildComponents() : Collections.emptyList(); - } - - @Override - public boolean mouseClicked0(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int mouseButton) { - selectedID = null; - if (mechanicBrowserTooltip != null) { - mechanicBrowserTooltip.close(); - mechanicBrowserTooltip = null; - } - - return super.mouseClicked0(absMouseX, absMouseY, relMouseX0, relMouseY0, mouseButton); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBlaze.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBlaze.java deleted file mode 100644 index 1e698414..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBlaze.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.solvers; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -public class FeatureSolverBlaze extends SimpleFeature { - public FeatureSolverBlaze() { - super("Solver.Floor 2+", "Blaze", "Highlights the blaze that needs to be killed in an blaze room", "solver.blaze"); - parameters.put("normBlazeColor", new FeatureParameter<AColor>("blazecolor", "Normal Blaze Color", "Normal Blaze Color", new AColor(255,255,255,255), "acolor")); - parameters.put("nextBlazeColor", new FeatureParameter<AColor>("blazecolor", "Next Blaze Color", "Next Blaze Color", new AColor(0,255,0,255), "acolor")); - parameters.put("nextUpBlazeColor", new FeatureParameter<AColor>("blazecolor", "Next Up Blaze Color", "Color of blaze after next blaze", new AColor(255,255,0,255), "acolor")); - parameters.put("blazeborder", new FeatureParameter<AColor>("blazeborder", "Blaze Border Color", "Blaze border color", new AColor(255,255,255,0), "acolor")); - } - - public AColor getBlazeColor() { - return this.<AColor>getParameter("normBlazeColor").getValue(); - } - public AColor getNextBlazeColor() { - return this.<AColor>getParameter("nextBlazeColor").getValue(); - } - public AColor getNextUpBlazeColor() { - return this.<AColor>getParameter("nextUpBlazeColor").getValue(); - } - public AColor getBorder() { - return this.<AColor>getParameter("blazeborder").getValue(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBombdefuse.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBombdefuse.java deleted file mode 100644 index e9bf623b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBombdefuse.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.solvers; - -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; -import org.lwjgl.input.Keyboard; - -public class FeatureSolverBombdefuse extends SimpleFeature { - public FeatureSolverBombdefuse() { - super("Solver.Floor 7+", "Bomb Defuse", "Communicates with others dg using key 'F' for solutions and displays it", "solver.bombdefuse"); - parameters.put("key", new FeatureParameter<Integer>("key", "Key","Press to send solution in chat", Keyboard.KEY_NONE, "keybind")); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBox.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBox.java deleted file mode 100644 index c4dcebf6..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverBox.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.solvers; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -import java.util.LinkedHashMap; - -public class FeatureSolverBox extends SimpleFeature { - public FeatureSolverBox() { - super("Solver.Floor 3+", "Box (Advanced)", "Calculates solution for box puzzle room, and displays it to user", "solver.box"); - this.parameters = new LinkedHashMap<>(); - this.parameters.put("disableText", new FeatureParameter<Boolean>("disableText", "Box Puzzle Solver Disable text", "Disable 'Type recalc to recalculate solution' showing up on top left.\nYou can still type recalc to recalc solution after disabling this feature", false, "boolean")); - this.parameters.put("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the solution line", new AColor(0xFF00FF00, true), "acolor")); - this.parameters.put("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the solution line",1.0f, "float")); - - this.parameters.put("targetColor", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the target button", new AColor(0x5500FFFF, true), "acolor")); - this.parameters.put("textColor1", new FeatureParameter<AColor>("textColor1", "Text Color", "Color of the text (next step)", new AColor(0xFF00FF00, true), "acolor")); - this.parameters.put("textColor2", new FeatureParameter<AColor>("textColor2", "Text Color", "Color of the text (others)", new AColor(0xFF000000, true), "acolor")); - } - public AColor getLineColor() { - return this.<AColor>getParameter("lineColor").getValue(); - } - public float getLineWidth() { - return this.<Float>getParameter("lineWidth").getValue(); - } - public boolean disableText() { - return this.<Boolean>getParameter("disableText").getValue(); - } - public AColor getTargetColor() { - return this.<AColor>getParameter("targetColor").getValue(); - } - public AColor getTextColor() { - return this.<AColor>getParameter("textColor1").getValue(); - } - public AColor getTextColor2() { - return this.<AColor>getParameter("textColor2").getValue(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverIcefill.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverIcefill.java deleted file mode 100644 index 681e6b12..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverIcefill.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.solvers; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -import java.util.LinkedHashMap; - -public class FeatureSolverIcefill extends SimpleFeature { - public FeatureSolverIcefill() { - super("Solver.Floor 3+", "Icepath (Advanced)", "Calculates solution for icepath puzzle and displays it to user", "solver.icepath"); - this.parameters = new LinkedHashMap<>(); - this.parameters.put("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the solution line", new AColor(0xFF00FF00, true), "acolor")); - this.parameters.put("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the solution line",1.0f, "float")); - } - public AColor getLineColor() { - return this.<AColor>getParameter("lineColor").getValue(); - } - public float getLineWidth() { - return this.<Float>getParameter("lineWidth").getValue(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverKahoot.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverKahoot.java deleted file mode 100644 index 6055c12b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverKahoot.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.solvers; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -public class FeatureSolverKahoot extends SimpleFeature { - public FeatureSolverKahoot() { - super("Solver.Floor 4+", "Quiz", "Highlights the correct solution for trivia puzzle", "solver.trivia"); - - this.parameters.put("targetColor", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the solution box", new AColor(0,255,0,50), "acolor")); - } - - public AColor getTargetColor() { - return this.<AColor>getParameter("targetColor").getValue(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverRiddle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverRiddle.java deleted file mode 100644 index 23bc5a0c..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverRiddle.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.solvers; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -public class FeatureSolverRiddle extends SimpleFeature { - public FeatureSolverRiddle() { - super("Solver.Any Floor", "Riddle", "Highlights the correct box after clicking on all 3 weirdos", "solver.riddle"); - - this.parameters.put("targetColor", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the solution box", new AColor(0,255,0,50), "acolor")); - } - - public AColor getTargetColor() { - return this.<AColor>getParameter("targetColor").getValue(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverSilverfish.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverSilverfish.java deleted file mode 100644 index 31a4d0e6..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverSilverfish.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.solvers; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -import java.util.LinkedHashMap; - -public class FeatureSolverSilverfish extends SimpleFeature { - public FeatureSolverSilverfish() { - super("Solver.Floor 3+", "Silverfish (Advanced)", "Actively calculates solution for silverfish puzzle and displays it to user", "solver.silverfish"); - this.parameters = new LinkedHashMap<>(); - this.parameters.put("lineColor", new FeatureParameter<AColor>("lineColor", "Line Color", "Color of the solution line", new AColor(0xFF00FF00, true), "acolor")); - this.parameters.put("lineWidth", new FeatureParameter<Float>("lineWidth", "Line Thickness", "Thickness of the solution line",1.0f, "float")); - } - public AColor getLineColor() { - return this.<AColor>getParameter("lineColor").getValue(); - } - public float getLineWidth() { - return this.<Float>getParameter("lineWidth").getValue(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverTeleport.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverTeleport.java deleted file mode 100644 index c7e42516..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverTeleport.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.solvers; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -public class FeatureSolverTeleport extends SimpleFeature { - public FeatureSolverTeleport() { - super("Solver.Any Floor", "Teleport", "Shows teleport pads you've visited in a teleport maze room", "solver.teleport"); - - this.parameters.put("targetColor", new FeatureParameter<AColor>("targetColor", "Solution Color", "Color of the solution teleport pad", new AColor(0,255,0,100), "acolor")); - this.parameters.put("targetColor2", new FeatureParameter<AColor>("targetColor2", "Not-Solution Color", "Color of the solution teleport pads you've been to", new AColor(255,0,0,100), "acolor")); - } - - public AColor getTargetColor() { - return this.<AColor>getParameter("targetColor").getValue(); - } - public AColor getTargetColor2() { - return this.<AColor>getParameter("targetColor2").getValue(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverTictactoe.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverTictactoe.java deleted file mode 100644 index 68ca4cb5..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/impl/solvers/FeatureSolverTictactoe.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.impl.solvers; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.SimpleFeature; - -public class FeatureSolverTictactoe extends SimpleFeature { - public FeatureSolverTictactoe() { - super("Solver.Any Floor", "Tictactoe", "Shows the best move that could be taken by player in the tictactoe room", "solver.tictactoe"); - - this.parameters.put("targetColor", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the solution box during your turn", new AColor(0,255,255,50), "acolor")); - this.parameters.put("targetColor2", new FeatureParameter<AColor>("targetColor", "Target Color", "Color of the solution box during enemy turn", new AColor(255,201,0,50), "acolor")); - } - - public AColor getTargetColor() { - return this.<AColor>getParameter("targetColor").getValue(); - } - public AColor getTargetColor2() { - return this.<AColor>getParameter("targetColor2").getValue(); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/BossroomEnterListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/BossroomEnterListener.java deleted file mode 100644 index bb1934b0..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/BossroomEnterListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface BossroomEnterListener { - void onBossroomEnter(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ChatListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ChatListener.java deleted file mode 100644 index 88d8cd2b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ChatListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -public interface ChatListener { - void onChat(ClientChatReceivedEvent clientChatReceivedEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ChatListenerGlobal.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ChatListenerGlobal.java deleted file mode 100644 index 4f8f61de..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ChatListenerGlobal.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.ClientChatReceivedEvent; - -public interface ChatListenerGlobal { - void onChat(ClientChatReceivedEvent clientChatReceivedEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DiscordUserJoinRequestListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DiscordUserJoinRequestListener.java deleted file mode 100644 index 99793f69..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DiscordUserJoinRequestListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import kr.syeyoung.dungeonsguide.events.DiscordUserJoinRequestEvent; - -public interface DiscordUserJoinRequestListener { - void onDiscordUserJoinRequest(DiscordUserJoinRequestEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DiscordUserUpdateListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DiscordUserUpdateListener.java deleted file mode 100644 index d376a21d..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DiscordUserUpdateListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import kr.syeyoung.dungeonsguide.events.DiscordUserUpdateEvent; - -public interface DiscordUserUpdateListener { - void onDiscordUserUpdate(DiscordUserUpdateEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonContextInitializationListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonContextInitializationListener.java deleted file mode 100644 index 53cea3c3..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonContextInitializationListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface DungeonContextInitializationListener { - void onDungeonInitialize(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonEndListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonEndListener.java deleted file mode 100644 index ba8ba263..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonEndListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface DungeonEndListener { - void onDungeonEnd(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonQuitListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonQuitListener.java deleted file mode 100644 index 120d773e..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonQuitListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface DungeonQuitListener { - void onDungeonQuit(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonStartListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonStartListener.java deleted file mode 100644 index d7497c63..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/DungeonStartListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface DungeonStartListener { - void onDungeonStart(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/EntityLivingRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/EntityLivingRenderListener.java deleted file mode 100644 index 7b982a7f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/EntityLivingRenderListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.RenderLivingEvent; - -public interface EntityLivingRenderListener { - void onEntityRenderPre(RenderLivingEvent.Pre renderPlayerEvent); - void onEntityRenderPost(RenderLivingEvent.Post renderPlayerEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiBackgroundRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiBackgroundRenderListener.java deleted file mode 100644 index 03e525bc..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiBackgroundRenderListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.GuiScreenEvent; - -public interface GuiBackgroundRenderListener { - void onGuiBGRender(GuiScreenEvent.BackgroundDrawnEvent rendered); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiClickListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiClickListener.java deleted file mode 100644 index f860e39f..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiClickListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.GuiScreenEvent; - -public interface GuiClickListener { - void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiOpenListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiOpenListener.java deleted file mode 100644 index a28ea7a6..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiOpenListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.GuiOpenEvent; - -public interface GuiOpenListener { - void onGuiOpen(GuiOpenEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiPostRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiPostRenderListener.java deleted file mode 100644 index c6c66f99..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiPostRenderListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.GuiScreenEvent; - -public interface GuiPostRenderListener { - void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiPreRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiPreRenderListener.java deleted file mode 100644 index 08a44009..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiPreRenderListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.GuiScreenEvent; - -public interface GuiPreRenderListener { - void onGuiPreRender(GuiScreenEvent.DrawScreenEvent.Pre rendered); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiUpdateListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiUpdateListener.java deleted file mode 100644 index 2e6389f0..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiUpdateListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import kr.syeyoung.dungeonsguide.events.WindowUpdateEvent; - -public interface GuiUpdateListener { - void onGuiUpdate(WindowUpdateEvent windowUpdateEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/InteractListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/InteractListener.java deleted file mode 100644 index 4b2fac80..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/InteractListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.event.entity.player.PlayerInteractEvent; - -public interface InteractListener { - void onInteract(PlayerInteractEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/KeyInputListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/KeyInputListener.java deleted file mode 100644 index 80ec57d8..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/KeyInputListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.GuiScreenEvent; - -public interface KeyInputListener { - void onKeyInput(GuiScreenEvent.KeyboardInputEvent keyboardInputEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/KeybindPressedListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/KeybindPressedListener.java deleted file mode 100644 index 3d67e326..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/KeybindPressedListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import kr.syeyoung.dungeonsguide.events.KeyBindPressedEvent; - -public interface KeybindPressedListener { - void onKeybindPress(KeyBindPressedEvent keyBindPressedEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/PlayerRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/PlayerRenderListener.java deleted file mode 100644 index 33c91fb8..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/PlayerRenderListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.RenderPlayerEvent; - -public interface PlayerRenderListener { - void onEntityRenderPre(RenderPlayerEvent.Pre renderPlayerEvent ); - void onEntityRenderPost(RenderPlayerEvent.Post renderPlayerEvent ); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ScreenRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ScreenRenderListener.java deleted file mode 100644 index 0f8fec79..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ScreenRenderListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface ScreenRenderListener { - void drawScreen(float partialTicks); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockJoinListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockJoinListener.java deleted file mode 100644 index 67a44f6b..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockJoinListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface SkyblockJoinListener { - void onSkyblockJoin(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockLeaveListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockLeaveListener.java deleted file mode 100644 index b38c0b75..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SkyblockLeaveListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface SkyblockLeaveListener { - void onSkyblockQuit(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SoundListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SoundListener.java deleted file mode 100644 index 1b8da9c4..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/SoundListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.sound.PlaySoundEvent; - -public interface SoundListener { - void onSound(PlaySoundEvent playSoundEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/StompConnectedListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/StompConnectedListener.java deleted file mode 100644 index e52d0642..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/StompConnectedListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import kr.syeyoung.dungeonsguide.events.StompConnectedEvent; - -public interface StompConnectedListener { - void onStompConnected(StompConnectedEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TextureStichListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TextureStichListener.java deleted file mode 100644 index 8ecb2315..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TextureStichListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.client.event.TextureStitchEvent; - -public interface TextureStichListener { - void onTextureStitch(TextureStitchEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TickListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TickListener.java deleted file mode 100644 index cd3a21a5..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TickListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface TickListener { - void onTick(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TitleListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TitleListener.java deleted file mode 100644 index ac3e5f48..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TitleListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraft.network.play.server.S45PacketTitle; - -public interface TitleListener { - void onTitle(S45PacketTitle renderPlayerEvent); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TooltipListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TooltipListener.java deleted file mode 100644 index 5bb78da0..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TooltipListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -import net.minecraftforge.event.entity.player.ItemTooltipEvent; - -public interface TooltipListener { - void onTooltip(ItemTooltipEvent event); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/WorldRenderListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/WorldRenderListener.java deleted file mode 100644 index ee4aeb5c..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/listener/WorldRenderListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.listener; - -public interface WorldRenderListener { - void drawWorld(float partialTicks); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java deleted file mode 100644 index 0ded16a8..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.text; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MEditableAColor; -import kr.syeyoung.dungeonsguide.gui.elements.MPanelScaledGUI; -import kr.syeyoung.dungeonsguide.gui.elements.MScrollablePanel; -import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; - -import java.awt.*; -import java.util.*; -import java.util.List; - -public class PanelTextParameterConfig extends MPanel { - - private final StyledTextProvider feature; - - private final MEditableAColor currentColor; - private final MEditableAColor backgroundColor; - private final MToggleButton shadow; - - private MScrollablePanel mScrollablePanel; - private MPanelScaledGUI rendering; - - @Override - public void onBoundsUpdate() { - } - @Override - public Dimension getPreferredSize() { - return new Dimension(400, getPanelBound().height + 20); - } - - public PanelTextParameterConfig(final StyledTextProvider feature) { - this.feature = feature; - setBackgroundColor(new Color(38, 38, 38, 255)); - - currentColor = new MEditableAColor(); - currentColor.setColor(new AColor(0xff555555, true)); - currentColor.setEnableEdit(false); - currentColor.setSize(new Dimension(15, 10)); - currentColor.setOnUpdate(new Runnable() { - @Override - public void run() { - for (String se:selected) - feature.getStylesMap().get(se).setColor(currentColor.getColor()); - } - }); - add(currentColor); - backgroundColor = new MEditableAColor(); - backgroundColor.setColor(new AColor(0xff555555, true)); - backgroundColor.setEnableEdit(false); - backgroundColor.setSize(new Dimension(15, 10)); - backgroundColor.setOnUpdate(new Runnable() { - @Override - public void run() { - for (String se:selected) - feature.getStylesMap().get(se).setBackground(backgroundColor.getColor()); - } - }); - add(backgroundColor); - shadow = new MToggleButton(); - shadow.setSize(new Dimension(20, 10)); - shadow.setOnToggle(new Runnable() { - @Override - public void run() { - for (String se:selected) - feature.getStylesMap().get(se).setShadow(shadow.isEnabled()); - } - }); - add(shadow); - - mScrollablePanel = new MScrollablePanel(3); - mScrollablePanel.setHideScrollBarWhenNotNecessary(true); - add(mScrollablePanel); - - mScrollablePanel.add(rendering = new MPanelScaledGUI() { - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - super.render(absMousex, absMousey, relMousex0, relMousey0, partialTicks, scissor); - - List<StyledText> texts = feature.getDummyText(); - Map<String, TextStyle> styles = feature.getStylesMap(); - List<StyledTextRenderer.StyleTextAssociated> calc = StyledTextRenderer.drawTextWithStylesAssociated(texts, 0,0, getEffectiveDimension().width, styles, StyledTextRenderer.Alignment.LEFT); - boolean bool =scissor.contains(absMousex, absMousey); - for (StyledTextRenderer.StyleTextAssociated calc3: calc) { - if (selected.contains(calc3.getStyledText().getGroup())) { - Gui.drawRect(calc3.getRectangle().x, calc3.getRectangle().y, calc3.getRectangle().x + calc3.getRectangle().width, calc3.getRectangle().y + calc3.getRectangle().height, 0x4244A800); - } else if (bool && calc3.getRectangle().contains(relMousex0, relMousey0)) { - for (StyledTextRenderer.StyleTextAssociated calc2 : calc) { - if (calc2.getStyledText().getGroup().equals(calc3.getStyledText().getGroup())) - Gui.drawRect(calc2.getRectangle().x, calc2.getRectangle().y, calc2.getRectangle().x + calc2.getRectangle().width, calc2.getRectangle().y + calc2.getRectangle().height, 0x55777777); - } - } - } - } - - - private int lastX; - private int lastY; - private boolean dragStart = false; - @Override - public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { - List<StyledText> texts = feature.getDummyText(); - Map<String, TextStyle> styles = feature.getStylesMap(); - boolean existed = selected.isEmpty(); - boolean found = false; - List<StyledTextRenderer.StyleTextAssociated> calc = StyledTextRenderer.calculate(texts, 0,0, styles); - for (StyledTextRenderer.StyleTextAssociated calc3: calc) { - if (calc3.getRectangle().contains(relMouseX, relMouseY)) { - if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) { - if (!selected.contains(calc3.getStyledText().getGroup())) - selected.add(calc3.getStyledText().getGroup()); - else - selected.remove(calc3.getStyledText().getGroup()); - } else { - selected.clear(); - selected.add(calc3.getStyledText().getGroup()); - } - found = true; - } - } - - if (!found && !(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) && parent.getLastAbsClip().contains(absMouseX * getScale(), absMouseY* getScale())) { - selected.clear(); - dragStart = true; - lastX = absMouseX; - lastY = absMouseY; - } - currentColor.setEnableEdit(selected.size() != 0); - PanelTextParameterConfig.this.backgroundColor.setEnableEdit(selected.size() != 0); - if (existed != selected.isEmpty()) { - if (selected.size() != 0) { - currentColor.setColor(styles.get(selected.iterator().next()).getColor()); - PanelTextParameterConfig.this.backgroundColor.setColor(styles.get(selected.iterator().next()).getBackground()); - shadow.setEnabled(styles.get(selected.iterator().next()).isShadow()); - } else { - currentColor.setColor(new AColor(0xff555555, true)); - PanelTextParameterConfig.this.backgroundColor.setColor(new AColor(0xff555555, true)); - shadow.setEnabled(false); - } - } - - if (selected.size() == 1) { - currentColor.setColor(styles.get(selected.iterator().next()).getColor()); - PanelTextParameterConfig.this.backgroundColor.setColor(styles.get(selected.iterator().next()).getBackground()); - shadow.setEnabled(styles.get(selected.iterator().next()).isShadow()); - } - } - - @Override - public void mouseReleased(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int state) { - dragStart = false; - } - - @Override - public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) { - if (dragStart) { - int dx= absMouseX - lastX; - int dy= absMouseY - lastY; - int actualOFFX = (int) (dx / getScale()); - int actualOFFY = (int) (dy / getScale()); - lastX =(int) (actualOFFX * getScale())+lastX; - lastY =(int) (actualOFFY * getScale())+lastY; - mScrollablePanel.getScrollBarX().addToCurrent(-actualOFFX); - mScrollablePanel.getScrollBarY().addToCurrent(-actualOFFY); - } - } - - @Override - public Dimension getPreferredSize() { - List<StyledTextRenderer.StyleTextAssociated> calc = StyledTextRenderer.calculate(feature.getDummyText(), 0,0, feature.getStylesMap()); - int w = 0, h = 0; - for (StyledTextRenderer.StyleTextAssociated styleTextAssociated : calc) { - int endX = styleTextAssociated.getRectangle().x + styleTextAssociated.getRectangle().width; - int endY = styleTextAssociated.getRectangle().y + styleTextAssociated.getRectangle().height; - if (endX > w) w = endX; - if (endY > h) h = endY; - } - return new Dimension((int) (w * getScale()),(int) (h * getScale())); - } - - @Override - public void resize(int parentWidth, int parentHeight) { - setBounds(new Rectangle(new Point(0,0), getPreferredSize())); - } - - - @Override - public void mouseScrolled(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) { - if ( parent.getLastAbsClip().contains(absMouseX * getScale(), absMouseY* getScale())) { - double scale = rendering.getScale(); - if (scrollAmount > 0) { - scale += 0.1; - } else if (scrollAmount < 0) { - scale -= 0.1; - } - if (scale < 0.1) scale = 0.1f; - if (scale > 5) scale = 5.0f; - rendering.setScale(scale); - mScrollablePanel.setBounds(new Rectangle(new Point(5,5),getPanelBound())); - } - } - }); - - - } - - private final Set<String> selected = new HashSet<String>(); - - @Override - public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - - GlStateManager.pushMatrix(); - - Dimension dim = getPanelBound(); - int width = dim.width, height = dim.height; - Gui.drawRect(0,0,getBounds().width, getBounds().height, RenderUtils.blendAlpha(0x141414, 0.12f)); - Gui.drawRect(4,4,width+6, height+6, 0xFF222222); - Gui.drawRect(5,5,width+5, height+5, RenderUtils.blendAlpha(0x141414, 0.15f)); - - - GlStateManager.translate(5, height + 7, 0); - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - fr.drawString("Press Shift to multi-select", 0, 0, 0xFFBFBFBF); - GlStateManager.popMatrix(); - - GlStateManager.pushMatrix(); - GlStateManager.translate(width + 15, 5, 0); - GlStateManager.pushMatrix(); - fr.drawString("Selected Groups: "+selected, 0, 0, 0xFFBFBFBF); - GlStateManager.popMatrix(); - fr.drawString("Text Color: ", 0, 10, 0xFFFFFFFF); - fr.drawString("Background Color: ", 0, 20, 0xFFFFFFFF); - fr.drawString("Shadow: ", 0, 39, 0xFFFFFFFF); - - GlStateManager.popMatrix(); - } - - private Dimension getPanelBound(){ -// return new Dimension((getBounds().width-25)/2, 100); - return new Dimension(150,100); - } - - @Override - public void setBounds(Rectangle bounds) { - super.setBounds(bounds); - - Dimension dim = getPanelBound(); - currentColor.setBounds(new Rectangle(75+dim.width , 14, 15, 10)); - backgroundColor.setBounds(new Rectangle(110+dim.width , 24, 15, 10)); - shadow.setBounds(new Rectangle(75+dim.width , 43, 30, 10)); - mScrollablePanel.setBounds(new Rectangle(5,5,dim.width,dim.height)); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledText.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledText.java deleted file mode 100644 index 074243b9..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledText.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.text; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class StyledText { - private String text; - private String group; -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledTextProvider.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledTextProvider.java deleted file mode 100644 index 2b68e4a3..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledTextProvider.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.text; - -import java.util.List; -import java.util.Map; - -public interface StyledTextProvider { - List<StyledText> getDummyText(); - List<StyledText> getText(); - - List<TextStyle> getStyles(); - Map<String, TextStyle> getStylesMap(); -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledTextRenderer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledTextRenderer.java deleted file mode 100644 index ed6cb2da..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledTextRenderer.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.text; - -import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import lombok.AllArgsConstructor; -import lombok.Data; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraftforge.fml.relauncher.ReflectionHelper; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class StyledTextRenderer { - - public static enum Alignment { - LEFT, CENTER, RIGHT - } - - private static final Method renderChar = ReflectionHelper.findMethod(FontRenderer.class, null, new String[] {"renderChar", "func_181559_a"}, char.class, boolean.class); - private static final Method doDraw = ReflectionHelper.findMethod(FontRenderer.class, null, new String[] {"doDraw"}, float.class); - private static final Field posX = ReflectionHelper.findField(FontRenderer.class, "posX", "field_78295_j"); - private static final Field posY = ReflectionHelper.findField(FontRenderer.class, "posY", "field_78296_k"); - - - public static List<StyleTextAssociated> drawTextWithStylesAssociated(List<StyledText> texts, int x, int y,int width, Map<String, TextStyle> styleMap, Alignment alignment) { - String[] totalLines = (texts.stream().map( a-> a.getText()).collect(Collectors.joining())+" ").split("\n"); - - - GlStateManager.enableBlend(); - GlStateManager.enableAlpha(); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - - int currentLine = 0; - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - int currX = alignment == Alignment.LEFT ? x : alignment == Alignment.CENTER ? (x+width-fr.getStringWidth(totalLines[currentLine]))/2 : (x+width-fr.getStringWidth(totalLines[currentLine])); - int currY = y; - int maxHeightForLine = 0; - List<StyleTextAssociated> associateds = new ArrayList<StyleTextAssociated>(); - for (StyledText st : texts) { - TextStyle ts = styleMap.get(st.getGroup()); - String[] lines = st.getText().split("\n"); - for (int i = 0; i < lines.length; i++) { - String str = lines[i]; - Dimension d = null; - try { - d = drawFragmentText(fr, str, ts, currX, currY, false); - } catch (InvocationTargetException | IllegalAccessException e) { - e.printStackTrace(); - } - associateds.add(new StyleTextAssociated(st, new Rectangle(currX, currY, d.width, d.height))); - currX += d.width; - if (maxHeightForLine < d.height) - maxHeightForLine = d.height; - - if (i+1 != lines.length) { - currY += maxHeightForLine ; - currentLine++; - currX = alignment == Alignment.LEFT ? x : alignment == Alignment.CENTER ? (x+width-fr.getStringWidth(totalLines[currentLine]))/2 : (x+width-fr.getStringWidth(totalLines[currentLine])); - maxHeightForLine = 0; - } - } - if (st.getText().endsWith("\n")) { - currY += maxHeightForLine; - currentLine++; - currX = alignment == Alignment.LEFT ? x : alignment == Alignment.CENTER ? (x+width-fr.getStringWidth(totalLines[currentLine]))/2 : (x+width-fr.getStringWidth(totalLines[currentLine])); - maxHeightForLine = 0; - } - } - return associateds; - } - - public static List<StyleTextAssociated> calculate(List<StyledText> texts, int x, int y, Map<String, TextStyle> styleMap) { - int currX = x; - int currY = y; - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - int maxHeightForLine = 0; - List<StyleTextAssociated> associateds = new ArrayList<StyleTextAssociated>(); - for (StyledText st : texts) { - TextStyle ts = styleMap.get(st.getGroup()); - String[] lines = st.getText().split("\n"); - for (int i = 0; i < lines.length; i++) { - String str = lines[i]; - Dimension d = null; - try { - d = drawFragmentText(fr, str, ts, currX, currY, true); - } catch (InvocationTargetException | IllegalAccessException e) { - e.printStackTrace(); - } - associateds.add(new StyleTextAssociated(st, new Rectangle(currX, currY, d.width, d.height))); - currX += d.width; - if (maxHeightForLine < d.height) - maxHeightForLine = d.height; - - if (i+1 != lines.length) { - currY += maxHeightForLine; - currX = x; - maxHeightForLine = 0; - } - } - if (st.getText().endsWith("\n")) { - currY += maxHeightForLine; - currX = x; - maxHeightForLine = 0; - } - } - return associateds; - } - - @Data - @AllArgsConstructor - public static class StyleTextAssociated { - private StyledText styledText; - private Rectangle rectangle; - } - - private static Dimension drawFragmentText(FontRenderer fr, String content, TextStyle style, int x, int y, boolean stopDraw) throws InvocationTargetException, IllegalAccessException { - if (stopDraw) - return new Dimension(fr.getStringWidth(content), fr.FONT_HEIGHT); - - int bgColor = RenderUtils.getColorAt(x,y, style.getBackground()); - if ((bgColor & 0xFF000000) != 0) - Gui.drawRect(x,y, x+fr.getStringWidth(content), y + fr.FONT_HEIGHT, bgColor); - - - posX.set(fr, x+1); - posY.set(fr, y+1); - - if (style.isShadow()) { - char[] charArr = content.toCharArray(); - float width = 0; - for (int i = 0; i < charArr.length; i++) { - int color = RenderUtils.getColorAt(x + width, y, style.getColor()); - color = (color & 16579836) >> 2 | color & -16777216; - - width +=renderChar(fr, charArr[i], color,true, false, false, false); - } - } - posX.set(fr, x); - posY.set(fr, y); - { - char[] charArr = content.toCharArray(); - float width = 0; - for (int i = 0; i < charArr.length; i++) { - int color = RenderUtils.getColorAt(x + width, y, style.getColor()); - - width +=renderChar(fr, charArr[i], color, false, false, false, false); - } - return new Dimension((int) width, fr.FONT_HEIGHT); - } - } - - private static float renderChar(FontRenderer fr, char character, int color, boolean shadow, boolean randomStyle, boolean boldStyle, boolean italicStyle) throws InvocationTargetException, IllegalAccessException { - RenderUtils.GL_SETCOLOR(color); - int j = "\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000".indexOf(character); - - if (randomStyle && j != -1) - { - int k = fr.getCharWidth(character); - char c1; - - while (true) - { - j = fr.fontRandom.nextInt("\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000".length()); - c1 = "\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000".charAt(j); - - if (k == fr.getCharWidth(c1)) - { - break; - } - } - - character = c1; - } - - float f1 = j == -1 || fr.getUnicodeFlag() ? 0.5f : 1f; - boolean flag = (character == 0 || j == -1 || fr.getUnicodeFlag()) && shadow; - - if (flag) - { - posX.set(fr,(float) posX.get(fr) - f1); - posY.set(fr,(float) posY.get(fr) - f1); - } - - float f = (float) renderChar.invoke(fr, character, italicStyle); - - if (flag) - { - posX.set(fr,(float) posX.get(fr) + f1); - posY.set(fr,(float) posY.get(fr) + f1); - } - - if (boldStyle) - { - posX.set(fr,(float) posX.get(fr) + f1); - - if (flag) - { - posX.set(fr,(float) posX.get(fr) - f1); - posY.set(fr,(float) posY.get(fr) - f1); - } - - renderChar.invoke(fr, character, italicStyle); - posX.set(fr,(float) posX.get(fr) - f1); - - if (flag) - { - posX.set(fr,(float) posX.get(fr) + f1); - posY.set(fr,(float) posY.get(fr) + f1); - } - - ++f; - } - doDraw.invoke(fr, f); - - return f; - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java deleted file mode 100644 index 5b709904..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextHUDFeature.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.text; - -import com.google.common.base.Supplier; -import com.google.gson.JsonObject; -import kr.syeyoung.dungeonsguide.config.guiconfig.ConfigPanelCreator; -import kr.syeyoung.dungeonsguide.gui.elements.MStringSelectionButton; -import kr.syeyoung.dungeonsguide.config.guiconfig.MFeatureEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.MParameterEdit; -import kr.syeyoung.dungeonsguide.config.guiconfig.RootConfigPanel; -import kr.syeyoung.dungeonsguide.config.guiconfig.location.GuiGuiLocationConfig; -import kr.syeyoung.dungeonsguide.config.types.AColor; -import kr.syeyoung.dungeonsguide.features.FeatureParameter; -import kr.syeyoung.dungeonsguide.features.GuiFeature; -import kr.syeyoung.dungeonsguide.gui.MPanel; -import kr.syeyoung.dungeonsguide.gui.elements.MFloatSelectionButton; -import kr.syeyoung.dungeonsguide.gui.elements.MPassiveLabelAndElement; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.GlStateManager; - -import java.util.*; -import java.util.List; - -public abstract class TextHUDFeature extends GuiFeature implements StyledTextProvider { - protected TextHUDFeature(String category, String name, String description, String key, boolean keepRatio, int width, int height) { - super(category, name, description, key, keepRatio, width, height); - this.parameters.put("textStylesNEW", new FeatureParameter<List<TextStyle>>("textStylesNEW", "", "", new ArrayList<TextStyle>(), "list_textStyle")); - this.parameters.put("alignment", new FeatureParameter<String>("alignment", "Alignment", "Alignment", "LEFT", "string")); - this.parameters.put("scale", new FeatureParameter<Float>("scale", "Scale", "Scale", 1.0f, "float")); - } - - @Override - public void drawHUD(float partialTicks) { - if (isHUDViewable()) { - List<StyledText> asd = getText(); - - double scale = 1; - if (doesScaleWithHeight()) { - FontRenderer fr = getFontRenderer(); - scale = getFeatureRect().getRectangle().getHeight() / (fr.FONT_HEIGHT* countLines(asd)); - } else { - scale = this.<Float>getParameter("scale").getValue(); - } - GlStateManager.scale(scale, scale, 0); - StyledTextRenderer.drawTextWithStylesAssociated(asd, 0, 0, (int) (Math.abs(getFeatureRect().getWidth())/scale), getStylesMap(), - StyledTextRenderer.Alignment.valueOf(TextHUDFeature.this.<String>getParameter("alignment").getValue())); - } - } - - public boolean doesScaleWithHeight() { - return true; - } - - @Override - public void drawDemo(float partialTicks) { - List<StyledText> asd = getDummyText(); - double scale = 1; - if (doesScaleWithHeight()) { - FontRenderer fr = getFontRenderer(); - scale = getFeatureRect().getRectangle().getHeight() / (fr.FONT_HEIGHT* countLines(asd)); - } else { - scale = this.<Float>getParameter("scale").getValue(); - } - GlStateManager.scale(scale, scale, 0); - - StyledTextRenderer.drawTextWithStylesAssociated(asd, 0, 0, (int) (Math.abs(getFeatureRect().getWidth())/scale), getStylesMap(), - StyledTextRenderer.Alignment.valueOf(TextHUDFeature.this.<String>getParameter("alignment").getValue())); - } - - public int countLines(List<StyledText> texts) { - StringBuilder things = new StringBuilder(); - for (StyledText text : texts) { - things.append(text.getText()); - } - String things2 = things.toString().trim(); - int lines = 1; - for (char c : things2.toCharArray()) { - if (c == '\n') lines++; - } - return lines; - } - - public abstract boolean isHUDViewable(); - - public abstract List<String> getUsedTextStyle(); - public List<StyledText> getDummyText() { - return getText(); - } - public abstract List<StyledText> getText(); - - public List<TextStyle> getStyles() { - return this.<List<TextStyle>>getParameter("textStylesNEW").getValue(); - } - private Map<String, TextStyle> stylesMap; - public Map<String, TextStyle> getStylesMap() { - if (stylesMap == null) { - List<TextStyle> styles = getStyles(); - Map<String, TextStyle> res = new HashMap<String, TextStyle>(); - for (TextStyle ts : styles) { - res.put(ts.getGroupName(), ts); - } - for (String str : getUsedTextStyle()) { - if (!res.containsKey(str)) - res.put(str, new TextStyle(str, new AColor(0xffffffff, true), new AColor(0x00777777, true), false)); - } - stylesMap = res; - } - return stylesMap; - } - - - @Override - public String getEditRoute(RootConfigPanel rootConfigPanel) { - ConfigPanelCreator.map.put("base." + getKey() , new Supplier<MPanel>() { - @Override - public MPanel get() { - - MFeatureEdit featureEdit = new MFeatureEdit(TextHUDFeature.this, rootConfigPanel); - featureEdit.addParameterEdit("textStyleNEW", new PanelTextParameterConfig(TextHUDFeature.this)); - - StyledTextRenderer.Alignment alignment = StyledTextRenderer.Alignment.valueOf(TextHUDFeature.this.<String>getParameter("alignment").getValue()); - MStringSelectionButton mStringSelectionButton = new MStringSelectionButton(Arrays.asList("LEFT", "CENTER", "RIGHT"), alignment.name()); - mStringSelectionButton.setOnUpdate(() -> { - TextHUDFeature.this.<String>getParameter("alignment").setValue(mStringSelectionButton.getSelected()); - }); - featureEdit.addParameterEdit("alignment", new MParameterEdit(TextHUDFeature.this, TextHUDFeature.this.<String>getParameter("alignment"), rootConfigPanel, mStringSelectionButton, (a) -> false)); - - for (FeatureParameter parameter: getParameters()) { - if (parameter.getKey().equals("textStylesNEW")) continue; - if (parameter.getKey().equals("alignment")) continue; - featureEdit.addParameterEdit(parameter.getKey(), new MParameterEdit(TextHUDFeature.this, parameter, rootConfigPanel)); - } - return featureEdit; - } - }); - return "base." + getKey() ; - } - - @Override - public List<MPanel> getTooltipForEditor(GuiGuiLocationConfig guiGuiLocationConfig) { - List<MPanel> mPanels = super.getTooltipForEditor(guiGuiLocationConfig); - StyledTextRenderer.Alignment alignment = StyledTextRenderer.Alignment.valueOf(this.<String>getParameter("alignment").getValue()); - MStringSelectionButton mStringSelectionButton = new MStringSelectionButton(Arrays.asList("LEFT", "CENTER", "RIGHT"), alignment.name()); - mStringSelectionButton.setOnUpdate(() -> { - TextHUDFeature.this.<String>getParameter("alignment").setValue(mStringSelectionButton.getSelected()); - }); - - mPanels.add(new MPassiveLabelAndElement("Alignment", mStringSelectionButton)); - if (!doesScaleWithHeight()) { - mPanels.add(new MPassiveLabelAndElement("Scale", new MFloatSelectionButton(TextHUDFeature.this.<Float>getParameter("scale").getValue()) {{ - setOnUpdate(() ->{ - TextHUDFeature.this.<Float>getParameter("scale").setValue(this.getData()); - }); } - })); - } - - return mPanels; - } - - @Override - public void onParameterReset() { - stylesMap = null; - } - - @Override - public void loadConfig(JsonObject jsonObject) { - super.loadConfig(jsonObject); - StyledTextRenderer.Alignment alignment; - try { - alignment = StyledTextRenderer.Alignment.valueOf(TextHUDFeature.this.<String>getParameter("alignment").getValue()); - } catch (Exception e) {alignment = StyledTextRenderer.Alignment.LEFT;} - TextHUDFeature.this.<String>getParameter("alignment").setValue(alignment.name()); - } -} diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java deleted file mode 100644 index 4bf87649..00000000 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/features/text/TextStyle.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod - * Copyright (C) 2021 cyoung06 - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package kr.syeyoung.dungeonsguide.features.text; - -import kr.syeyoung.dungeonsguide.config.types.AColor; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class TextStyle { - private String groupName; - private AColor color; - private AColor background; - private boolean shadow = false; -} |