diff options
Diffstat (limited to 'src/main/java')
41 files changed, 2379 insertions, 210 deletions
diff --git a/src/main/java/de/hysky/skyblocker/SkyblockerMod.java b/src/main/java/de/hysky/skyblocker/SkyblockerMod.java index 75918fa9..3d96cc50 100644 --- a/src/main/java/de/hysky/skyblocker/SkyblockerMod.java +++ b/src/main/java/de/hysky/skyblocker/SkyblockerMod.java @@ -21,6 +21,7 @@ import de.hysky.skyblocker.skyblock.dwarven.CrystalsHud; import de.hysky.skyblocker.skyblock.dwarven.CrystalsLocationsManager; import de.hysky.skyblocker.skyblock.dwarven.DwarvenHud; import de.hysky.skyblocker.skyblock.end.BeaconHighlighter; +import de.hysky.skyblocker.skyblock.end.EnderNodes; import de.hysky.skyblocker.skyblock.end.TheEnd; import de.hysky.skyblocker.skyblock.garden.FarmingHud; import de.hysky.skyblocker.skyblock.garden.LowerSensitivity; @@ -98,6 +99,7 @@ public class SkyblockerMod implements ClientModInitializer { ClientTickEvents.END_CLIENT_TICK.register(this::tick); Utils.init(); SkyblockerConfigManager.init(); + SkyblockerScreen.initClass(); Tips.init(); NEURepoManager.init(); ImageRepoLoader.init(); @@ -110,6 +112,7 @@ public class SkyblockerMod implements ClientModInitializer { FairySouls.init(); Relics.init(); MythologicalRitual.init(); + EnderNodes.init(); OrderedWaypoints.init(); BackpackPreview.init(); QuickNav.init(); @@ -148,6 +151,7 @@ public class SkyblockerMod implements ClientModInitializer { TeleportOverlay.init(); CustomItemNames.init(); CustomArmorDyeColors.init(); + CustomArmorAnimatedDyes.init(); CustomArmorTrims.init(); TicTacToe.init(); QuiverWarning.init(); @@ -166,6 +170,8 @@ public class SkyblockerMod implements ClientModInitializer { containerSolverManager.init(); statusBarTracker.init(); BeaconHighlighter.init(); + WarpAutocomplete.init(); + Scheduler.INSTANCE.scheduleCyclic(Utils::update, 20); Scheduler.INSTANCE.scheduleCyclic(DiscordRPCManager::updateDataAndPresence, 200); Scheduler.INSTANCE.scheduleCyclic(LividColor::update, 10); diff --git a/src/main/java/de/hysky/skyblocker/SkyblockerScreen.java b/src/main/java/de/hysky/skyblocker/SkyblockerScreen.java new file mode 100644 index 00000000..ba0745ed --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/SkyblockerScreen.java @@ -0,0 +1,125 @@ +package de.hysky.skyblocker; + +import de.hysky.skyblocker.config.SkyblockerConfigManager; +import de.hysky.skyblocker.skyblock.Tips; +import de.hysky.skyblocker.utils.scheduler.Scheduler; +import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; +import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.screen.ConfirmLinkScreen; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.client.gui.widget.GridWidget; +import net.minecraft.client.gui.widget.MultilineTextWidget; +import net.minecraft.client.gui.widget.TextWidget; +import net.minecraft.client.gui.widget.ThreePartsLayoutWidget; +import net.minecraft.screen.ScreenTexts; +import net.minecraft.text.OrderedText; +import net.minecraft.text.StringVisitable; +import net.minecraft.text.Text; +import net.minecraft.util.Identifier; +import net.minecraft.util.Language; + +public class SkyblockerScreen extends Screen { + private static final int SPACING = 8; + private static final int BUTTON_WIDTH = 210; + private static final int HALF_BUTTON_WIDTH = 101; //Same as (210 - 8) / 2 + private static final Text TITLE = Text.literal("Skyblocker " + SkyblockerMod.VERSION); + private static final Identifier ICON = new Identifier(SkyblockerMod.NAMESPACE, "icon.png"); + private static final Text CONFIGURATION_TEXT = Text.translatable("text.skyblocker.config"); + private static final Text SOURCE_TEXT = Text.translatable("text.skyblocker.source"); + private static final Text REPORT_BUGS_TEXT = Text.translatable("menu.reportBugs"); + private static final Text WEBSITE_TEXT = Text.translatable("text.skyblocker.website"); + private static final Text TRANSLATE_TEXT = Text.translatable("text.skyblocker.translate"); + private static final Text MODRINTH_TEXT = Text.translatable("text.skyblocker.modrinth"); + private static final Text DISCORD_TEXT = Text.translatable("text.skyblocker.discord"); + private final ThreePartsLayoutWidget layout = new ThreePartsLayoutWidget(this); + + private SkyblockerScreen() { + super(TITLE); + } + + public static void initClass() { + ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> { + dispatcher.register(ClientCommandManager.literal(SkyblockerMod.NAMESPACE) + .executes(Scheduler.queueOpenScreenCommand(SkyblockerScreen::new))); + }); + } + + @Override + protected void init() { + this.layout.addHeader(new IconTextWidget(this.getTitle(), this.textRenderer, ICON)); + + GridWidget gridWidget = this.layout.addBody(new GridWidget()).setSpacing(SPACING); + gridWidget.getMainPositioner().alignHorizontalCenter(); + GridWidget.Adder adder = gridWidget.createAdder(2); + + adder.add(ButtonWidget.builder(CONFIGURATION_TEXT, button -> this.openConfig()).width(BUTTON_WIDTH).build(), 2); + adder.add(ButtonWidget.builder(SOURCE_TEXT, ConfirmLinkScreen.opening(this, "https://github.com/SkyblockerMod/Skyblocker")).width(HALF_BUTTON_WIDTH).build()); + adder.add(ButtonWidget.builder(REPORT_BUGS_TEXT, ConfirmLinkScreen.opening(this, "https://github.com/SkyblockerMod/Skyblocker/issues")).width(HALF_BUTTON_WIDTH).build()); + adder.add(ButtonWidget.builder(WEBSITE_TEXT, ConfirmLinkScreen.opening(this, "https://hysky.de/")).width(HALF_BUTTON_WIDTH).build()); + adder.add(ButtonWidget.builder(TRANSLATE_TEXT, ConfirmLinkScreen.opening(this, "https://translate.hysky.de/")).width(HALF_BUTTON_WIDTH).build()); + adder.add(ButtonWidget.builder(MODRINTH_TEXT, ConfirmLinkScreen.opening(this, "https://modrinth.com/mod/skyblocker-liap")).width(HALF_BUTTON_WIDTH).build()); + adder.add(ButtonWidget.builder(DISCORD_TEXT, ConfirmLinkScreen.opening(this, "https://discord.gg/aNNJHQykck")).width(HALF_BUTTON_WIDTH).build()); + adder.add(ButtonWidget.builder(ScreenTexts.DONE, button -> this.close()).width(BUTTON_WIDTH).build(), 2); + + MultilineTextWidget tip = new MultilineTextWidget(Text.translatable("skyblocker.tips.tip", Tips.nextTipInternal()), this.textRenderer) + .setCentered(true) + .setMaxWidth((int) (this.width * 0.7)); + + this.layout.addFooter(tip); + this.layout.refreshPositions(); + this.layout.forEachChild(this::addDrawableChild); + } + + @Override + protected void initTabNavigation() { + this.layout.refreshPositions(); + } + + private void openConfig() { + this.client.setScreen(SkyblockerConfigManager.createGUI(this)); + } + + @Override + public void render(DrawContext context, int mouseX, int mouseY, float delta) { + this.renderBackground(context, mouseX, mouseY, delta); + super.render(context, mouseX, mouseY, delta); + } + + private static class IconTextWidget extends TextWidget { + private final Identifier icon; + + IconTextWidget(Text message, TextRenderer textRenderer, Identifier icon) { + super(message, textRenderer); + this.icon = icon; + } + + @Override + public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) { + Text text = this.getMessage(); + TextRenderer textRenderer = this.getTextRenderer(); + + int width = this.getWidth(); + int textWidth = textRenderer.getWidth(text); + float horizontalAlignment = 0.5f; // default + //17 = (32 + 2) / 2 • 32 + 2 is the width of the icon + spacing between icon and text + int x = this.getX() + 17 + Math.round(horizontalAlignment * (float) (width - textWidth)); + int y = this.getY() + (this.getHeight() - textRenderer.fontHeight) / 2; + OrderedText orderedText = textWidth > width ? this.trim(text, width) : text.asOrderedText(); + + int iconX = x - 34; + int iconY = y - 13; + + context.drawTextWithShadow(textRenderer, orderedText, x, y, this.getTextColor()); + context.drawTexture(this.icon, iconX, iconY, 0, 0, 32, 32, 32, 32); + } + + private OrderedText trim(Text text, int width) { + TextRenderer textRenderer = this.getTextRenderer(); + StringVisitable stringVisitable = textRenderer.trimToWidth(text, width - textRenderer.getWidth(ScreenTexts.ELLIPSIS)); + return Language.getInstance().reorder(StringVisitable.concat(stringVisitable, ScreenTexts.ELLIPSIS)); + } + } +} diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index bafcd115..e301e8e2 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -1,6 +1,7 @@ package de.hysky.skyblocker.config; import de.hysky.skyblocker.SkyblockerMod; +import de.hysky.skyblocker.skyblock.item.CustomArmorAnimatedDyes; import de.hysky.skyblocker.skyblock.item.CustomArmorTrims; import de.hysky.skyblocker.utils.chat.ChatFilterResult; import de.hysky.skyblocker.utils.waypoint.Waypoint; @@ -250,6 +251,9 @@ public class SkyblockerConfig { public SearchOverlay searchOverlay = new SearchOverlay(); @SerialEntry + public FancyAuctionHouse fancyAuctionHouse = new FancyAuctionHouse(); + + @SerialEntry public List<Integer> lockedSlots = new ArrayList<>(); @SerialEntry @@ -263,6 +267,9 @@ public class SkyblockerConfig { @SerialEntry public Object2ObjectOpenHashMap<String, CustomArmorTrims.ArmorTrimId> customArmorTrims = new Object2ObjectOpenHashMap<>(); + + @SerialEntry + public Object2ObjectOpenHashMap<String, CustomArmorAnimatedDyes.AnimatedDye> customAnimatedDyes = new Object2ObjectOpenHashMap<>(); } public static class TabHudConf { @@ -349,6 +356,18 @@ public class SkyblockerConfig { public static class Fishing { @SerialEntry public boolean enableFishingHelper = true; + + @SerialEntry + public boolean enableFishingTimer = false; + + @SerialEntry + public boolean changeTimerColor = true; + + @SerialEntry + public float fishingTimerScale = 1f; + + @SerialEntry + public boolean hideOtherPlayersRods = false; } public static class FairySouls { @@ -402,138 +421,11 @@ public class SkyblockerConfig { public boolean enableQuiverWarningAfterDungeon = true; } - public static class Hitbox { - @SerialEntry - public boolean oldFarmlandHitbox = false; - - @SerialEntry - public boolean oldLeverHitbox = false; - } - - public static class TitleContainer { - @SerialEntry - public float titleContainerScale = 100; - - @SerialEntry - public int x = 540; - - @SerialEntry - public int y = 10; - - @SerialEntry - public Direction direction = Direction.HORIZONTAL; - - @SerialEntry - public Alignment alignment = Alignment.MIDDLE; - } - - public enum Direction { - HORIZONTAL, VERTICAL; - - @Override - public String toString() { - return switch (this) { - case HORIZONTAL -> "Horizontal"; - case VERTICAL -> "Vertical"; - }; - } - } - - public enum Alignment { - LEFT, RIGHT, MIDDLE; - - @Override - public String toString() { - return switch (this) { - case LEFT -> "Left"; - case RIGHT -> "Right"; - case MIDDLE -> "Middle"; - }; - } - } - - public static class TeleportOverlay { - @SerialEntry - public boolean enableTeleportOverlays = true; - - @SerialEntry - public boolean enableWeirdTransmission = true; - - @SerialEntry - public boolean enableInstantTransmission = true; - - @SerialEntry - public boolean enableEtherTransmission = true; - - @SerialEntry - public boolean enableSinrecallTransmission = true; - - @SerialEntry - public boolean enableWitherImpact = true; - } - - public static class FlameOverlay { - @SerialEntry - public int flameHeight = 100; - - @SerialEntry - public int flameOpacity = 100; - } - - public static class SearchOverlay { - @SerialEntry - public boolean enableBazaar = true; - - @SerialEntry - public boolean enableAuctionHouse = true; - - @SerialEntry - public boolean keepPreviousSearches = false; - - @SerialEntry - public int maxSuggestions = 3; - - @SerialEntry - public int historyLength = 3; - - @SerialEntry - public boolean enableCommands = false; - - @SerialEntry - public List<String> bazaarHistory = new ArrayList<>(); - - @SerialEntry - public List<String> auctionHistory = new ArrayList<>(); - } - - public static class RichPresence { - @SerialEntry - public boolean enableRichPresence = false; - - @SerialEntry - public Info info = Info.LOCATION; - - @SerialEntry - public boolean cycleMode = false; - - @SerialEntry - public String customMessage = "Playing Skyblock"; - } - public static class ItemList { @SerialEntry public boolean enableItemList = true; } - public enum Average { - ONE_DAY, THREE_DAY, BOTH; - - @Override - public String toString() { - return I18n.translate("text.autoconfig.skyblocker.option.general.itemTooltip.avg." + name()); - } - } - public static class ItemTooltip { @SerialEntry public boolean enableNPCPrice = true; @@ -566,6 +458,15 @@ public class SkyblockerConfig { public boolean enableAccessoriesHelper = true; } + public enum Average { + ONE_DAY, THREE_DAY, BOTH; + + @Override + public String toString() { + return I18n.translate("text.autoconfig.skyblocker.option.general.itemTooltip.avg." + name()); + } + } + public static class ItemInfoDisplay { @SerialEntry public boolean attributeShardInfo = true; @@ -647,6 +548,118 @@ public class SkyblockerConfig { public boolean rareDungeonDropEffects = true; } + public static class Hitbox { + @SerialEntry + public boolean oldFarmlandHitbox = false; + + @SerialEntry + public boolean oldLeverHitbox = false; + } + + public static class TitleContainer { + @SerialEntry + public float titleContainerScale = 100; + + @SerialEntry + public int x = 540; + + @SerialEntry + public int y = 10; + + @SerialEntry + public Direction direction = Direction.HORIZONTAL; + + @SerialEntry + public Alignment alignment = Alignment.MIDDLE; + } + + public enum Direction { + HORIZONTAL, VERTICAL; + + @Override + public String toString() { + return switch (this) { + case HORIZONTAL -> "Horizontal"; + case VERTICAL -> "Vertical"; + }; + } + } + + public enum Alignment { + LEFT, RIGHT, MIDDLE; + + @Override + public String toString() { + return switch (this) { + case LEFT -> "Left"; + case RIGHT -> "Right"; + case MIDDLE -> "Middle"; + }; + } + } + + public static class TeleportOverlay { + @SerialEntry + public boolean enableTeleportOverlays = true; + + @SerialEntry + public boolean enableWeirdTransmission = true; + + @SerialEntry + public boolean enableInstantTransmission = true; + + @SerialEntry + public boolean enableEtherTransmission = true; + + @SerialEntry + public boolean enableSinrecallTransmission = true; + + @SerialEntry + public boolean enableWitherImpact = true; + } + + public static class FlameOverlay { + @SerialEntry + public int flameHeight = 100; + + @SerialEntry + public int flameOpacity = 100; + } + + public static class SearchOverlay { + @SerialEntry + public boolean enableBazaar = true; + + @SerialEntry + public boolean enableAuctionHouse = true; + + @SerialEntry + public boolean keepPreviousSearches = false; + + @SerialEntry + public int maxSuggestions = 3; + + @SerialEntry + public int historyLength = 3; + + @SerialEntry + public boolean enableCommands = false; + + @SerialEntry + public List<String> bazaarHistory = new ArrayList<>(); + + @SerialEntry + public List<String> auctionHistory = new ArrayList<>(); + } + + public static class FancyAuctionHouse { + @SerialEntry + public boolean enabled = true; + + @SerialEntry + public boolean highlightCheapBIN = true; + } + public static class Locations { @SerialEntry public Barn barn = new Barn(); @@ -1076,6 +1089,8 @@ public class SkyblockerConfig { } public static class TheEnd { + @SerialEntry + public boolean enableEnderNodeHelper = true; @SerialEntry public boolean hudEnabled = true; @@ -1245,6 +1260,20 @@ public class SkyblockerConfig { public int announcementScale = 3; } + public static class RichPresence { + @SerialEntry + public boolean enableRichPresence = false; + + @SerialEntry + public Info info = Info.LOCATION; + + @SerialEntry + public boolean cycleMode = false; + + @SerialEntry + public String customMessage = "Playing Skyblock"; + } + public enum Info { PURSE, BITS, LOCATION; diff --git a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java index e310cb85..dbfbbb10 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java @@ -226,6 +226,38 @@ public class GeneralCategory { newValue -> config.general.fishing.enableFishingHelper = newValue) .controller(ConfigUtils::createBooleanController) .build()) + .option(Option.<Boolean>createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.fishing.enableFishingTimer")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.general.fishing.enableFishingTimer.@Tooltip"))) + .binding(defaults.general.fishing.enableFishingTimer, + () -> config.general.fishing.enableFishingTimer, + newValue -> config.general.fishing.enableFishingTimer = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) + .option(Option.<Boolean>createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.fishing.changeTimerColor")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.general.fishing.changeTimerColor.@Tooltip"))) + .binding(defaults.general.fishing.changeTimerColor, + () -> config.general.fishing.changeTimerColor, + newValue -> config.general.fishing.changeTimerColor = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) + .option(Option.<Float>createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.fishing.fishingTimerScale")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.general.fishing.fishingTimerScale.@Tooltip"))) + .binding(defaults.general.fishing.fishingTimerScale, + () -> config.general.fishing.fishingTimerScale, + newValue -> config.general.fishing.fishingTimerScale = newValue) + .controller(FloatFieldControllerBuilder::create) + .build()) + .option(Option.<Boolean>createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.fishing.hideOtherPlayers")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.general.fishing.hideOtherPlayers.@Tooltip"))) + .binding(defaults.general.fishing.hideOtherPlayersRods, + () -> config.general.fishing.hideOtherPlayersRods, + newValue -> config.general.fishing.hideOtherPlayersRods = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) .build()) //Fairy Souls Helper @@ -739,6 +771,26 @@ public class GeneralCategory { .controller(ConfigUtils::createBooleanController) .build()) .build()) + + // Fancy Auction House + .group(OptionGroup.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.betterAuctionHouse")) + .collapsed(true) + .option(Option.<Boolean>createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.betterAuctionHouse.enabled")) + .binding(defaults.general.fancyAuctionHouse.enabled, + () -> config.general.fancyAuctionHouse.enabled, + newValue -> config.general.fancyAuctionHouse.enabled = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) + .option(Option.<Boolean>createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.betterAuctionHouse.highlightUnderAvgPrice")) + .binding(defaults.general.fancyAuctionHouse.highlightCheapBIN, + () -> config.general.fancyAuctionHouse.highlightCheapBIN, + newValue -> config.general.fancyAuctionHouse.highlightCheapBIN = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) + .build()) .build(); } } diff --git a/src/main/java/de/hysky/skyblocker/config/categories/LocationsCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/LocationsCategory.java index 67512b78..46f3067c 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/LocationsCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/LocationsCategory.java @@ -85,6 +85,13 @@ public class LocationsCategory { .name(Text.translatable("text.autoconfig.skyblocker.option.locations.end")) .collapsed(false) .option(Option.<Boolean>createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.end.enableEnderNodeHelper")) + .binding(defaults.locations.end.enableEnderNodeHelper, + () -> config.locations.end.enableEnderNodeHelper, + newValue -> config.locations.end.enableEnderNodeHelper = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) + .option(Option.<Boolean>createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.end.hudEnabled")) .binding(defaults.locations.end.hudEnabled, () -> config.locations.end.hudEnabled, diff --git a/src/main/java/de/hy |
