aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/hysky/skyblocker/mixins/ItemStackMixin.java12
-rw-r--r--src/main/java/de/hysky/skyblocker/mixins/accessors/MinecraftClientAccessor.java12
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/chocolatefactory/ChocolateFactorySolver.java12
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/events/EventNotifications.java32
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/item/MuseumItemCache.java10
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java1
-rw-r--r--src/main/java/de/hysky/skyblocker/utils/ApiAuthentication.java5
-rw-r--r--src/main/java/de/hysky/skyblocker/utils/Http.java1
-rw-r--r--src/main/resources/assets/skyblocker/lang/en_us.json2
-rw-r--r--src/main/resources/skyblocker.accesswidener21
-rw-r--r--src/main/resources/skyblocker.mixins.json1
11 files changed, 78 insertions, 31 deletions
diff --git a/src/main/java/de/hysky/skyblocker/mixins/ItemStackMixin.java b/src/main/java/de/hysky/skyblocker/mixins/ItemStackMixin.java
index c0186fee..1493cf26 100644
--- a/src/main/java/de/hysky/skyblocker/mixins/ItemStackMixin.java
+++ b/src/main/java/de/hysky/skyblocker/mixins/ItemStackMixin.java
@@ -254,6 +254,18 @@ public abstract class ItemStackMixin implements ComponentHolder, SkyblockerStack
return customDataString + "-LIFELINE-MANA_POOL";
}
}
+
+ case "MIDAS_SWORD" -> {
+ if (customData.getInt("winning_bid") >= 50000000) {
+ return customDataString + "_50M";
+ }
+ }
+
+ case "MIDAS_STAFF" -> {
+ if (customData.getInt("winning_bid") >= 100000000) {
+ return customDataString + "_100M";
+ }
+ }
}
return customDataString;
}
diff --git a/src/main/java/de/hysky/skyblocker/mixins/accessors/MinecraftClientAccessor.java b/src/main/java/de/hysky/skyblocker/mixins/accessors/MinecraftClientAccessor.java
new file mode 100644
index 00000000..a750ded2
--- /dev/null
+++ b/src/main/java/de/hysky/skyblocker/mixins/accessors/MinecraftClientAccessor.java
@@ -0,0 +1,12 @@
+package de.hysky.skyblocker.mixins.accessors;
+
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.session.ProfileKeys;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.gen.Accessor;
+
+@Mixin(MinecraftClient.class)
+public interface MinecraftClientAccessor {
+ @Accessor
+ ProfileKeys getProfileKeys();
+}
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/chocolatefactory/ChocolateFactorySolver.java b/src/main/java/de/hysky/skyblocker/skyblock/chocolatefactory/ChocolateFactorySolver.java
index e4f904b5..f984d751 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/chocolatefactory/ChocolateFactorySolver.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/chocolatefactory/ChocolateFactorySolver.java
@@ -209,10 +209,10 @@ public class ChocolateFactorySolver extends ContainerSolver {
}
Matcher costMatcher = COST_PATTERN.matcher(coachLore);
- OptionalInt cost = RegexUtils.getIntFromMatcher(costMatcher, multiplierIncreaseMatcher.hasMatch() ? multiplierIncreaseMatcher.end() : 0); //Cost comes after the multiplier line
+ OptionalLong cost = RegexUtils.getLongFromMatcher(costMatcher, multiplierIncreaseMatcher.hasMatch() ? multiplierIncreaseMatcher.end() : 0); //Cost comes after the multiplier line
if (cost.isEmpty()) return Optional.empty();
- return Optional.of(new Rabbit(totalCps / totalCpsMultiplier * (nextCpsMultiplier.getAsDouble() - currentCpsMultiplier.getAsDouble()), cost.getAsInt(), COACH_SLOT));
+ return Optional.of(new Rabbit(totalCps / totalCpsMultiplier * (nextCpsMultiplier.getAsDouble() - currentCpsMultiplier.getAsDouble()), cost.getAsLong(), COACH_SLOT));
}
private static Optional<Rabbit> getRabbit(ItemStack item, int slot) {
@@ -227,9 +227,9 @@ public class ChocolateFactorySolver extends ContainerSolver {
}
Matcher costMatcher = COST_PATTERN.matcher(lore);
- OptionalInt cost = RegexUtils.getIntFromMatcher(costMatcher, cpsMatcher.hasMatch() ? cpsMatcher.end() : 0); //Cost comes after the cps line
+ OptionalLong cost = RegexUtils.getLongFromMatcher(costMatcher, cpsMatcher.hasMatch() ? cpsMatcher.end() : 0); //Cost comes after the cps line
if (cost.isEmpty()) return Optional.empty();
- return Optional.of(new Rabbit((nextCps.getAsInt() - currentCps.getAsInt())*(totalCpsMultiplier < 0 ? 1 : totalCpsMultiplier), cost.getAsInt(), slot));
+ return Optional.of(new Rabbit((nextCps.getAsInt() - currentCps.getAsInt())*(totalCpsMultiplier < 0 ? 1 : totalCpsMultiplier), cost.getAsLong(), slot));
}
private static Optional<ColorHighlight> getPrestigeHighlight() {
@@ -244,14 +244,14 @@ public class ChocolateFactorySolver extends ContainerSolver {
ItemStack item = slots.get(i);
if (!item.isOf(Items.PLAYER_HEAD)) continue;
String name = item.getName().getString();
- if (name.equals("CLICK ME!") || name.startsWith("GOLDEN RABBIT")) {
+ if (name.equals("CLICK ME!") || name.startsWith("Golden Rabbit - ")) {
highlights.add(ColorHighlight.green(i));
}
}
return highlights;
}
- private record Rabbit(double cpsIncrease, int cost, int slot) { }
+ private record Rabbit(double cpsIncrease, long cost, int slot) { }
public static final class Tooltip extends TooltipAdder {
public Tooltip() {
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/events/EventNotifications.java b/src/main/java/de/hysky/skyblocker/skyblock/events/EventNotifications.java
index da2a0c2f..e846a88a 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/events/EventNotifications.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/events/EventNotifications.java
@@ -13,7 +13,6 @@ import de.hysky.skyblocker.utils.Http;
import de.hysky.skyblocker.utils.Utils;
import de.hysky.skyblocker.utils.scheduler.Scheduler;
import it.unimi.dsi.fastutil.ints.IntList;
-import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.minecraft.client.MinecraftClient;
@@ -29,6 +28,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentHashMap;
public class EventNotifications {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -39,21 +39,19 @@ public class EventNotifications {
public static final IntList DEFAULT_REMINDERS = IntList.of(60, 60 * 5);
- public static final Map<String, ItemStack> eventIcons = new Object2ObjectOpenHashMap<>();
-
- static {
- eventIcons.put("Dark Auction", new ItemStack(Items.NETHER_BRICK));
- eventIcons.put("Bonus Fishing Festival", new ItemStack(Items.FISHING_ROD));
- eventIcons.put("Bonus Mining Fiesta", new ItemStack(Items.IRON_PICKAXE));
- eventIcons.put(JACOBS, new ItemStack(Items.IRON_HOE));
- eventIcons.put("New Year Celebration", new ItemStack(Items.CAKE));
- eventIcons.put("Election Over!", new ItemStack(Items.JUKEBOX));
- eventIcons.put("Election Booth Opens", new ItemStack(Items.JUKEBOX));
- eventIcons.put("Spooky Festival", new ItemStack(Items.JACK_O_LANTERN));
- eventIcons.put("Season of Jerry", new ItemStack(Items.SNOWBALL));
- eventIcons.put("Jerry's Workshop Opens", new ItemStack(Items.SNOW_BLOCK));
- eventIcons.put("Traveling Zoo", new ItemStack(Items.HAY_BLOCK)); // change to the custom head one day
- }
+ public static final Map<String, ItemStack> eventIcons = Map.ofEntries(
+ Map.entry("Dark Auction", new ItemStack(Items.NETHER_BRICK)),
+ Map.entry("Bonus Fishing Festival", new ItemStack(Items.FISHING_ROD)),
+ Map.entry("Bonus Mining Fiesta", new ItemStack(Items.IRON_PICKAXE)),
+ Map.entry(JACOBS, new ItemStack(Items.IRON_HOE)),
+ Map.entry("New Year Celebration", new ItemStack(Items.CAKE)),
+ Map.entry("Election Over!", new ItemStack(Items.JUKEBOX)),
+ Map.entry("Election Booth Opens", new ItemStack(Items.JUKEBOX)),
+ Map.entry("Spooky Festival", new ItemStack(Items.JACK_O_LANTERN)),
+ Map.entry("Season of Jerry", new ItemStack(Items.SNOWBALL)),
+ Map.entry("Jerry's Workshop Opens", new ItemStack(Items.SNOW_BLOCK)),
+ Map.entry("Traveling Zoo", new ItemStack(Items.HAY_BLOCK)) // change to the custom head one day
+ );
public static void init() {
Scheduler.INSTANCE.scheduleCyclic(EventNotifications::timeUpdate, 20);
@@ -85,7 +83,7 @@ public class EventNotifications {
));
}
- private static final Map<String, LinkedList<SkyblockEvent>> events = new Object2ObjectOpenHashMap<>();
+ private static final Map<String, LinkedList<SkyblockEvent>> events = new ConcurrentHashMap<>();
public static Map<String, LinkedList<SkyblockEvent>> getEvents() {
return events;
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/MuseumItemCache.java b/src/main/java/de/hysky/skyblocker/skyblock/item/MuseumItemCache.java
index 50982d29..214ecc84 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/item/MuseumItemCache.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/item/MuseumItemCache.java
@@ -10,7 +10,6 @@ import com.mojang.brigadier.CommandDispatcher;
import com.mojang.serialization.Codec;
import com.mojang.serialization.JsonOps;
import com.mojang.serialization.codecs.RecordCodecBuilder;
-import com.mojang.util.UndashedUuid;
import de.hysky.skyblocker.SkyblockerMod;
import de.hysky.skyblocker.utils.Constants;
import de.hysky.skyblocker.utils.Http;
@@ -44,6 +43,7 @@ import java.nio.file.Path;
import java.util.Base64;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
+import java.util.function.Supplier;
public class MuseumItemCache {
private static final Logger LOGGER = LoggerFactory.getLogger(MuseumItemCache.class);
@@ -113,7 +113,7 @@ public class MuseumItemCache {
String uuid = Utils.getUndashedUuid();
//Be safe about access to avoid NPEs
Map<String, ProfileMuseumData> playerData = MUSEUM_ITEM_CACHE.computeIfAbsent(uuid, _uuid -> new Object2ObjectOpenHashMap<>());
- playerData.putIfAbsent(profileId, ProfileMuseumData.EMPTY);
+ playerData.putIfAbsent(profileId, ProfileMuseumData.EMPTY.get());
playerData.get(profileId).collectedItemIds().add(itemId);
save();
@@ -224,7 +224,7 @@ public class MuseumItemCache {
if (loaded.isDone() && (!MUSEUM_ITEM_CACHE.containsKey(uuid) || !MUSEUM_ITEM_CACHE.getOrDefault(uuid, new Object2ObjectOpenHashMap<>()).containsKey(profileId))) {
Map<String, ProfileMuseumData> playerData = MUSEUM_ITEM_CACHE.computeIfAbsent(uuid, _uuid -> new Object2ObjectOpenHashMap<>());
- playerData.putIfAbsent(profileId, ProfileMuseumData.EMPTY);
+ playerData.putIfAbsent(profileId, ProfileMuseumData.EMPTY.get());
updateData4ProfileMember(uuid, profileId);
}
@@ -238,7 +238,7 @@ public class MuseumItemCache {
}
private record ProfileMuseumData(long lastResync, ObjectOpenHashSet<String> collectedItemIds) {
- private static final ProfileMuseumData EMPTY = new ProfileMuseumData(0L, null);
+ private static final Supplier<ProfileMuseumData> EMPTY = () -> new ProfileMuseumData(0L, new ObjectOpenHashSet<>());
private static final long TIME_BETWEEN_RESYNCING_ALLOWED = 600_000L;
private static final Codec<ProfileMuseumData> CODEC = RecordCodecBuilder.create(instance -> instance.group(
Codec.LONG.fieldOf("lastResync").forGetter(ProfileMuseumData::lastResync),
@@ -256,4 +256,4 @@ public class MuseumItemCache {
return this.lastResync + TIME_BETWEEN_RESYNCING_ALLOWED < System.currentTimeMillis();
}
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java
index cc3d2099..49d170b9 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java
@@ -57,6 +57,7 @@ public class ItemTooltip {
case "CRIMSON_HELMET", "CRIMSON_CHESTPLATE", "CRIMSON_LEGGINGS", "CRIMSON_BOOTS",
"AURORA_HELMET", "AURORA_CHESTPLATE", "AURORA_LEGGINGS", "AURORA_BOOTS",
"TERROR_HELMET", "TERROR_CHESTPLATE", "TERROR_LEGGINGS", "TERROR_BOOTS" -> apiId = id;
+ case "MIDAS_SWORD", "MIDAS_STAFF" -> apiId = id;
default -> apiId = apiId.replace(":", "-");
}
return apiId;
diff --git a/src/main/java/de/hysky/skyblocker/utils/ApiAuthentication.java b/src/main/java/de/hysky/skyblocker/utils/ApiAuthentication.java
index fbf814ee..5f65c336 100644
--- a/src/main/java/de/hysky/skyblocker/utils/ApiAuthentication.java
+++ b/src/main/java/de/hysky/skyblocker/utils/ApiAuthentication.java
@@ -7,6 +7,8 @@ import java.util.Base64;
import java.util.Objects;
import java.util.UUID;
+import de.hysky.skyblocker.mixins.accessors.MinecraftClientAccessor;
+import net.minecraft.client.session.ProfileKeys;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
@@ -56,8 +58,9 @@ public class ApiAuthentication {
* was generated by Mojang and is tied to said player. For information about what the randomly signed data is used for and why see {@link #getRandomSignedData(PrivateKey)}
*/
private static void updateToken() {
+ ProfileKeys profileKeys = ((MinecraftClientAccessor) CLIENT).getProfileKeys();
//The fetching runs async in ProfileKeysImpl#getKeyPair
- CLIENT.getProfileKeys().fetchKeyPair().thenAcceptAsync(playerKeypairOpt -> {
+ profileKeys.fetchKeyPair().thenAcceptAsync(playerKeypairOpt -> {
if (playerKeypairOpt.isPresent()) {
PlayerKeyPair playerKeyPair = playerKeypairOpt.get();
diff --git a/src/main/java/de/hysky/skyblocker/utils/Http.java b/src/main/java/de/hysky/skyblocker/utils/Http.java
index e5fd18a0..1adf75d3 100644
--- a/src/main/java/de/hysky/skyblocker/utils/Http.java
+++ b/src/main/java/de/hysky/skyblocker/utils/Http.java
@@ -90,6 +90,7 @@ public class Http {
public static String sendPostRequest(String url, String requestBody, String contentType) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.POST(BodyPublishers.ofString(requestBody))
+ .header("Accept", contentType)
.header("Accept-Encoding", "gzip, deflate")
.header("Content-Type", contentType)
.header("User-Agent", USER_AGENT)
diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json
index a73d523d..a814718e 100644
--- a/src/main/resources/assets/skyblocker/lang/en_us.json
+++ b/src/main/resources/assets/skyblocker/lang/en_us.json
@@ -686,7 +686,7 @@
"skyblocker.api.cache.HIT": "This data was cached!\nIt's %d seconds old.",
"skyblocker.api.cache.MISS": "This data wasn't cached!",
"skyblocker.api.token.authFailure": "Failed to refresh your Skyblocker API token, some features may not work temporarily!",
- "skyblocker.api.token.noProfileKeys": "Failed to get your profile keys! Some features of the mod may not work temporarily :( (Has your game been open for more than 24 hours?)",
+ "skyblocker.api.token.noProfileKeys": "Failed to get your profile keys! Some features of the mod may not work temporarily :( (Has your game been open for more than 24 hours?). To reactivate these features restart the game.",
"skyblocker.exotic.crystal": "CRYSTAL",
"skyblocker.exotic.fairy": "FAIRY",
diff --git a/src/main/resources/skyblocker.accesswidener b/src/main/resources/skyblocker.accesswidener
index 2464d6d5..9fcdfa45 100644
--- a/src/main/resources/skyblocker.accesswidener
+++ b/src/main/resources/skyblocker.accesswidener
@@ -1 +1,20 @@
-accessWidener v2 named \ No newline at end of file
+accessWidener v2 named
+
+accessible class net/minecraft/client/render/RenderLayer$MultiPhase
+accessible class net/minecraft/client/render/RenderLayer$MultiPhaseParameters
+accessible class net/minecraft/client/render/RenderPhase$Transparency
+accessible class net/minecraft/client/render/RenderPhase$ShaderProgram
+accessible class net/minecraft/client/render/RenderPhase$Texture
+accessible class net/minecraft/client/render/RenderPhase$TextureBase
+accessible class net/minecraft/client/render/RenderPhase$Texturing
+accessible class net/minecraft/client/render/RenderPhase$Lightmap
+accessible class net/minecraft/client/render/RenderPhase$Overlay
+accessible class net/minecraft/client/render/RenderPhase$Cull
+accessible class net/minecraft/client/render/RenderPhase$DepthTest
+accessible class net/minecraft/client/render/RenderPhase$WriteMaskState
+accessible class net/minecraft/client/render/RenderPhase$Layering
+accessible class net/minecraft/client/render/RenderPhase$Target
+accessible class net/minecraft/client/render/RenderPhase$LineWidth
+accessible class net/minecraft/client/render/RenderPhase$ColorLogic
+accessible class net/minecraft/client/render/RenderPhase$OffsetTexturing
+accessible class net/minecraft/client/render/RenderPhase$Textures
diff --git a/src/main/resources/skyblocker.mixins.json b/src/main/resources/skyblocker.mixins.json
index 9b96ba61..27755550 100644
--- a/src/main/resources/skyblocker.mixins.json
+++ b/src/main/resources/skyblocker.mixins.json
@@ -45,6 +45,7 @@
"accessors.FrustumInvoker",
"accessors.HandledScreenAccessor",
"accessors.MessageHandlerAccessor",
+ "accessors.MinecraftClientAccessor",
"accessors.PlayerListHudAccessor",
"accessors.RecipeBookWidgetAccessor",
"accessors.ScreenAccessor",