Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add chocolate factory helper #683

Merged
merged 52 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
a8c689d
Add chocolate factory helper
Emirlol May 4, 2024
0ec2707
Updated for 1.20.6 PR compatibility
Emirlol May 5, 2024
16b449c
Delete EggFinderDebugUtil to prepare for PR
Emirlol May 6, 2024
9fea533
Egg Finder initial commit
Emirlol May 9, 2024
05a18be
Add configs and minor code refactor
Emirlol May 10, 2024
e2f18c8
Add support for unemployed rabbits
Emirlol May 11, 2024
45643ed
Fix incorrect textures for EggFinder.EggType
Emirlol May 13, 2024
07c352c
Refactor null handling in EggFinder.checkIfEgg
Emirlol May 13, 2024
e0327e3
Fix waypoint rendering not turning off
Emirlol May 13, 2024
589692a
Code formatting
Emirlol May 13, 2024
1d6969a
Add missing LUNCH EggType to EggType.entries
Emirlol May 13, 2024
4a0284f
Add Time Tower Reminder
Emirlol May 13, 2024
9e0f427
Add coach cps calculation to the ChocolateFactorySolver
Emirlol May 13, 2024
bb2d694
Improve TIME_TOWER_PATTERN regex in case of failure with the use of M…
Emirlol May 13, 2024
bf20bed
Change uses of raw integers to colors from Formatting
Emirlol May 13, 2024
ba5047d
Mixin into ClientPlayNetworkHandler.onEntityTrackerUpdate to check fo…
Emirlol May 14, 2024
eee4ee6
Time tower fix attempt
Emirlol May 14, 2024
e8d5f6f
Add SkyblockTime
Emirlol May 14, 2024
87c382b
Add season check to EggFinder
Emirlol May 14, 2024
5ea7ccf
Refactor code, fix coach calculation and attempt to highlight the bes…
Emirlol May 14, 2024
5b7c40e
Refactor EggFinder for CompactDamage compatibility
Emirlol May 14, 2024
2a1321b
Update src/main/java/de/hysky/skyblocker/skyblock/chocolatefactory/Ch…
Emirlol May 14, 2024
fc3c1c0
Update src/main/java/de/hysky/skyblocker/skyblock/chocolatefactory/Ch…
Emirlol May 14, 2024
c12dab2
Update src/main/java/de/hysky/skyblocker/skyblock/chocolatefactory/Ch…
Emirlol May 14, 2024
cb4964c
Update src/main/java/de/hysky/skyblocker/skyblock/chocolatefactory/Ch…
Emirlol May 14, 2024
4ba6a0f
Update src/main/java/de/hysky/skyblocker/skyblock/chocolatefactory/Ch…
Emirlol May 14, 2024
fff992a
Update src/main/java/de/hysky/skyblocker/skyblock/chocolatefactory/Ch…
Emirlol May 14, 2024
58f2e28
Refactor ChocolateFactorySolver in preparation of tooltips
Emirlol May 15, 2024
5fd12a3
Fix unemployed rabbits crashing the game
Emirlol May 15, 2024
30ecf3e
Add tooltips for the chocolate factory
Emirlol May 15, 2024
7106802
Fix missing `RegexUtils.`
Emirlol May 15, 2024
8f060cf
Add the meaning of highlight colors to the config description
Emirlol May 15, 2024
4009602
Add thousand separators to the CPS format
Emirlol May 15, 2024
4b477d0
Revert ItemUtils.getHeadTexture change and add ItemUtils.getHeadTextu…
Emirlol May 16, 2024
fa37113
Attempt to fix decimal format depending on the user's locale
Emirlol May 16, 2024
8fed85f
Do a bunch of things that I can't split into separate commits
Emirlol May 17, 2024
5de1319
Remove unused import
Emirlol May 17, 2024
8ad266d
Add location detection to EggFinder
Emirlol May 17, 2024
8866c7a
Change String == null check into String#isBlank
Emirlol May 19, 2024
475be1a
Narrow the scope of the line smoother in ItemTooltip
Emirlol May 19, 2024
6383328
Fix crash caused by Time Tower lore being empty in rare cases
Emirlol May 19, 2024
25080e6
Code cleanup
Emirlol May 19, 2024
7a6fc4c
Fix time tower reminder being sent outside skyblock
Emirlol May 19, 2024
eb25667
Fix time tower reminder being sent multiple times
Emirlol May 19, 2024
0c4284c
Sort chocolate factory translation keys
Emirlol May 19, 2024
b43cf96
Revert backwards compatible changes in ItemUtils.getHeadTexture to av…
kevinthegreat1 May 20, 2024
c28c60b
Fix time tower calculations being wrong due to incorrect string matching
Emirlol May 21, 2024
9286543
Renamed variable
Emirlol May 21, 2024
2bbeccd
Clean up small formatting
kevinthegreat1 May 23, 2024
7601959
Fix egg found message being sent twice in rare cases
Emirlol May 23, 2024
3c578b3
Fix 1 second gap in formatTime
Emirlol May 23, 2024
1f6798d
Change poch to epoch
kevinthegreat1 May 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/main/java/de/hysky/skyblocker/SkyblockerMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import de.hysky.skyblocker.config.datafixer.ConfigDataFixer;
import de.hysky.skyblocker.config.ImageRepoLoader;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.config.datafixer.ConfigDataFixer;
import de.hysky.skyblocker.debug.Debug;
import de.hysky.skyblocker.skyblock.*;
import de.hysky.skyblocker.skyblock.calculators.CalculatorCommand;
import de.hysky.skyblocker.skyblock.chat.ChatRuleAnnouncementScreen;
import de.hysky.skyblocker.skyblock.chat.ChatRulesHandler;
import de.hysky.skyblocker.skyblock.chocolatefactory.EggFinder;
import de.hysky.skyblocker.skyblock.chocolatefactory.TimeTowerReminder;
import de.hysky.skyblocker.skyblock.crimson.kuudra.Kuudra;
import de.hysky.skyblocker.skyblock.dungeon.*;
import de.hysky.skyblocker.skyblock.dungeon.partyfinder.PartyFinderScreen;
Expand Down Expand Up @@ -45,10 +46,7 @@
import de.hysky.skyblocker.skyblock.waypoint.MythologicalRitual;
import de.hysky.skyblocker.skyblock.waypoint.OrderedWaypoints;
import de.hysky.skyblocker.skyblock.waypoint.Relics;
import de.hysky.skyblocker.utils.ApiUtils;
import de.hysky.skyblocker.utils.NEURepoManager;
import de.hysky.skyblocker.utils.ProfileUtils;
import de.hysky.skyblocker.utils.Utils;
import de.hysky.skyblocker.utils.*;
import de.hysky.skyblocker.utils.chat.ChatMessageListener;
import de.hysky.skyblocker.utils.discord.DiscordRPCManager;
import de.hysky.skyblocker.utils.render.RenderHelper;
Expand Down Expand Up @@ -183,6 +181,9 @@ public void onInitializeClient() {
BeaconHighlighter.init();
WarpAutocomplete.init();
MobBoundingBoxes.init();
EggFinder.init();
TimeTowerReminder.init();
SkyblockTime.init();

Scheduler.INSTANCE.scheduleCyclic(Utils::update, 20);
Scheduler.INSTANCE.scheduleCyclic(DiscordRPCManager::updateDataAndPresence, 200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import de.hysky.skyblocker.config.ConfigUtils;
import de.hysky.skyblocker.config.SkyblockerConfig;
import dev.isxander.yacl3.api.*;
import de.hysky.skyblocker.utils.waypoint.Waypoint;
import dev.isxander.yacl3.api.ConfigCategory;
import dev.isxander.yacl3.api.Option;
import dev.isxander.yacl3.api.OptionDescription;
import dev.isxander.yacl3.api.OptionGroup;
import dev.isxander.yacl3.api.controller.FloatFieldControllerBuilder;
import net.minecraft.text.Text;

Expand Down Expand Up @@ -137,6 +138,52 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
.build())
.build())

//Chocolate Factory
.group(OptionGroup.createBuilder()
.name(Text.translatable("skyblocker.config.helpers.chocolateFactory"))
.collapsed(true)
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.helpers.chocolateFactory.enableChocolateFactoryHelper"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.helpers.chocolateFactory.enableChocolateFactoryHelper.@Tooltip")))
.binding(defaults.helpers.chocolateFactory.enableChocolateFactoryHelper,
() -> config.helpers.chocolateFactory.enableChocolateFactoryHelper,
newValue -> config.helpers.chocolateFactory.enableChocolateFactoryHelper = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.helpers.chocolateFactory.enableEggFinder"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.helpers.chocolateFactory.enableEggFinder.@Tooltip")))
.binding(defaults.helpers.chocolateFactory.enableEggFinder,
() -> config.helpers.chocolateFactory.enableEggFinder,
newValue -> config.helpers.chocolateFactory.enableEggFinder = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.helpers.chocolateFactory.sendEggFoundMessages"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.helpers.chocolateFactory.sendEggFoundMessages.@Tooltip")))
.binding(defaults.helpers.chocolateFactory.sendEggFoundMessages,
() -> config.helpers.chocolateFactory.sendEggFoundMessages,
newValue -> config.helpers.chocolateFactory.sendEggFoundMessages = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Waypoint.Type>createBuilder()
.name(Text.translatable("skyblocker.config.helpers.chocolateFactory.waypointType"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.helpers.chocolateFactory.waypointType.@Tooltip")))
.binding(defaults.helpers.chocolateFactory.waypointType,
() -> config.helpers.chocolateFactory.waypointType,
newValue -> config.helpers.chocolateFactory.waypointType = newValue)
.controller(ConfigUtils::createEnumCyclingListController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.helpers.chocolateFactory.enableTimeTowerReminder"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.helpers.chocolateFactory.enableTimeTowerReminder.@Tooltip")))
.binding(defaults.helpers.chocolateFactory.enableTimeTowerReminder,
() -> config.helpers.chocolateFactory.enableTimeTowerReminder,
newValue -> config.helpers.chocolateFactory.enableTimeTowerReminder = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.build())

.build();
}
}
21 changes: 21 additions & 0 deletions src/main/java/de/hysky/skyblocker/config/configs/HelperConfig.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.hysky.skyblocker.config.configs;

import de.hysky.skyblocker.utils.waypoint.Waypoint;
import dev.isxander.yacl3.config.v2.api.SerialEntry;

public class HelperConfig {
Expand All @@ -19,6 +20,9 @@ public class HelperConfig {
@SerialEntry
public FairySouls fairySouls = new FairySouls();

@SerialEntry
public ChocolateFactory chocolateFactory = new ChocolateFactory();

public static class MythologicalRitual {
@SerialEntry
public boolean enableMythologicalRitualHelper = true;
Expand Down Expand Up @@ -62,4 +66,21 @@ public static class FairySouls {
@SerialEntry
public boolean highlightOnlyNearbySouls = false;
}

public static class ChocolateFactory {
@SerialEntry
public boolean enableChocolateFactoryHelper = true;

@SerialEntry
public boolean enableEggFinder = true;

@SerialEntry
public boolean sendEggFoundMessages = true;

@SerialEntry
public Waypoint.Type waypointType = Waypoint.Type.WAYPOINT;

@SerialEntry
public boolean enableTimeTowerReminder = true;
}
}
4 changes: 1 addition & 3 deletions src/main/java/de/hysky/skyblocker/debug/Debug.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ private static LiteralArgumentBuilder<FabricClientCommandSource> dumpArmorStandH
Iterable<ItemStack> equippedItems = armorStand.getEquippedItems();

for (ItemStack stack : equippedItems) {
String texture = ItemUtils.getHeadTexture(stack);

if (!texture.isEmpty()) context.getSource().sendFeedback(Text.of(texture));
ItemUtils.getHeadTextureOptional(stack).ifPresent(texture -> context.getSource().sendFeedback(Text.of(texture)));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import com.llamalad7.mixinextras.sugar.Local;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.skyblock.CompactDamage;
import de.hysky.skyblocker.skyblock.FishingHelper;
import de.hysky.skyblocker.skyblock.chocolatefactory.EggFinder;
import de.hysky.skyblocker.skyblock.dungeon.DungeonScore;
import de.hysky.skyblocker.skyblock.dungeon.secrets.DungeonManager;
import de.hysky.skyblocker.skyblock.end.BeaconHighlighter;
Expand Down Expand Up @@ -84,7 +84,7 @@ public abstract class ClientPlayNetworkHandlerMixin {
return !(Utils.isOnHypixel() && ((Identifier) identifier).getNamespace().equals("badlion"));
}

@WrapWithCondition(method = { "onScoreboardScoreUpdate", "onScoreboardScoreReset" }, at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false))
@WrapWithCondition(method = {"onScoreboardScoreUpdate", "onScoreboardScoreReset"}, at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false))
private boolean skyblocker$cancelUnknownScoreboardObjectiveWarnings(Logger instance, String message, Object objectiveName) {
return !Utils.isOnHypixel();
}
Expand All @@ -111,11 +111,18 @@ public abstract class ClientPlayNetworkHandlerMixin {

@Inject(method = "onEntityTrackerUpdate", at = @At("TAIL"))
private void skyblocker$onEntityTrackerUpdate(EntityTrackerUpdateS2CPacket packet, CallbackInfo ci, @Local Entity entity) {
if (!SkyblockerConfigManager.get().uiAndVisuals.compactDamage.enabled || !(entity instanceof ArmorStandEntity armorStandEntity)) return;
if (!(entity instanceof ArmorStandEntity armorStandEntity)) return;

EggFinder.checkIfEgg(armorStandEntity);
try { //Prevent packet handling fails if something goes wrong so that entity trackers still update, just without compact damage numbers
CompactDamage.compactDamage(armorStandEntity);
} catch (Exception e) {
LOGGER.error("[Skyblocker Compact Damage] Failed to compact damage number", e);
}
}

@Inject(method = "onEntityEquipmentUpdate", at = @At(value = "TAIL"))
private void skyblocker$onEntityEquip(EntityEquipmentUpdateS2CPacket packet, CallbackInfo ci, @Local Entity entity) {
EggFinder.checkIfEgg(entity);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ private CompactDamage() {
}

public static void compactDamage(ArmorStandEntity entity) {
if (!SkyblockerConfigManager.get().uiAndVisuals.compactDamage.enabled) return;
if (!entity.isInvisible() || !entity.hasCustomName() || !entity.isCustomNameVisible()) return;
Text customName = entity.getCustomName();
String customNameStringified = customName.getString();
Expand Down
Loading