Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@
import de.hysky.skyblocker.utils.render.primitive.PrimitiveCollector;
import de.hysky.skyblocker.utils.scheduler.Scheduler;
import it.unimi.dsi.fastutil.objects.Object2ByteMap;
import it.unimi.dsi.fastutil.objects.Object2ByteMaps;
import it.unimi.dsi.fastutil.objects.Object2ByteOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectIntPair;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
Expand Down Expand Up @@ -123,29 +121,29 @@ public class DungeonManager {
* @implNote Not using {@link Registry#getKey(Object) Registry#getId(Block)} and {@link Blocks Blocks} since this is also used by {@link de.hysky.skyblocker.skyblock.dungeon.secrets.DungeonRoomsDFU DungeonRoomsDFU}, which runs outside of Minecraft.
*/
@SuppressWarnings("JavadocReference")
protected static final Object2ByteMap<String> NUMERIC_ID = Object2ByteMaps.unmodifiable(new Object2ByteOpenHashMap<>(Map.ofEntries(
Map.entry("minecraft:stone", (byte) 1),
Map.entry("minecraft:diorite", (byte) 2),
Map.entry("minecraft:polished_diorite", (byte) 3),
Map.entry("minecraft:andesite", (byte) 4),
Map.entry("minecraft:polished_andesite", (byte) 5),
Map.entry("minecraft:grass_block", (byte) 6),
Map.entry("minecraft:dirt", (byte) 7),
Map.entry("minecraft:coarse_dirt", (byte) 8),
Map.entry("minecraft:cobblestone", (byte) 9),
Map.entry("minecraft:bedrock", (byte) 10),
Map.entry("minecraft:oak_leaves", (byte) 11),
Map.entry("minecraft:gray_wool", (byte) 12),
Map.entry("minecraft:double_stone_slab", (byte) 13),
Map.entry("minecraft:mossy_cobblestone", (byte) 14),
Map.entry("minecraft:clay", (byte) 15),
Map.entry("minecraft:stone_bricks", (byte) 16),
Map.entry("minecraft:mossy_stone_bricks", (byte) 17),
Map.entry("minecraft:chiseled_stone_bricks", (byte) 18),
Map.entry("minecraft:gray_terracotta", (byte) 19),
Map.entry("minecraft:cyan_terracotta", (byte) 20),
Map.entry("minecraft:black_terracotta", (byte) 21)
)));
protected static final Object2ByteMap<String> NUMERIC_ID = Object2ByteMap.ofEntries(
Object2ByteMap.entry("minecraft:stone", (byte) 1),
Object2ByteMap.entry("minecraft:diorite", (byte) 2),
Object2ByteMap.entry("minecraft:polished_diorite", (byte) 3),
Object2ByteMap.entry("minecraft:andesite", (byte) 4),
Object2ByteMap.entry("minecraft:polished_andesite", (byte) 5),
Object2ByteMap.entry("minecraft:grass_block", (byte) 6),
Object2ByteMap.entry("minecraft:dirt", (byte) 7),
Object2ByteMap.entry("minecraft:coarse_dirt", (byte) 8),
Object2ByteMap.entry("minecraft:cobblestone", (byte) 9),
Object2ByteMap.entry("minecraft:bedrock", (byte) 10),
Object2ByteMap.entry("minecraft:oak_leaves", (byte) 11),
Object2ByteMap.entry("minecraft:gray_wool", (byte) 12),
Object2ByteMap.entry("minecraft:double_stone_slab", (byte) 13),
Object2ByteMap.entry("minecraft:mossy_cobblestone", (byte) 14),
Object2ByteMap.entry("minecraft:clay", (byte) 15),
Object2ByteMap.entry("minecraft:stone_bricks", (byte) 16),
Object2ByteMap.entry("minecraft:mossy_stone_bricks", (byte) 17),
Object2ByteMap.entry("minecraft:chiseled_stone_bricks", (byte) 18),
Object2ByteMap.entry("minecraft:gray_terracotta", (byte) 19),
Object2ByteMap.entry("minecraft:cyan_terracotta", (byte) 20),
Object2ByteMap.entry("minecraft:black_terracotta", (byte) 21)
);
/**
* Block data for dungeon rooms. See {@link de.hysky.skyblocker.skyblock.dungeon.secrets.DungeonRoomsDFU DungeonRoomsDFU} for format details and how it's generated.
* All access to this map must check {@link #isRoomsLoaded()} to prevent concurrent modification.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import de.hysky.skyblocker.config.configs.HelperConfig;
import de.hysky.skyblocker.utils.render.gui.ColorHighlight;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectMaps;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.gui.screens.inventory.ContainerScreen;
Expand All @@ -16,15 +14,17 @@
import net.minecraft.world.item.Items;

public final class ChronomatronSolver extends ExperimentSolver implements ContainerListener {
public static final Object2ObjectMap<Item, Item> TERRACOTTA_TO_GLASS = Object2ObjectMaps.unmodifiable(
new Object2ObjectArrayMap<>(
new Item[]{
Items.RED_TERRACOTTA, Items.ORANGE_TERRACOTTA, Items.YELLOW_TERRACOTTA, Items.LIME_TERRACOTTA, Items.GREEN_TERRACOTTA, Items.CYAN_TERRACOTTA, Items.LIGHT_BLUE_TERRACOTTA, Items.BLUE_TERRACOTTA, Items.PURPLE_TERRACOTTA, Items.PINK_TERRACOTTA
},
new Item[]{
Items.RED_STAINED_GLASS, Items.ORANGE_STAINED_GLASS, Items.YELLOW_STAINED_GLASS, Items.LIME_STAINED_GLASS, Items.GREEN_STAINED_GLASS, Items.CYAN_STAINED_GLASS, Items.LIGHT_BLUE_STAINED_GLASS, Items.BLUE_STAINED_GLASS, Items.PURPLE_STAINED_GLASS, Items.PINK_STAINED_GLASS
}
)
public static final Object2ObjectMap<Item, Item> TERRACOTTA_TO_GLASS = Object2ObjectMap.ofEntries(
Object2ObjectMap.entry(Items.RED_TERRACOTTA, Items.RED_STAINED_GLASS),
Object2ObjectMap.entry(Items.ORANGE_TERRACOTTA, Items.ORANGE_STAINED_GLASS),
Object2ObjectMap.entry(Items.YELLOW_TERRACOTTA, Items.YELLOW_STAINED_GLASS),
Object2ObjectMap.entry(Items.LIME_TERRACOTTA, Items.LIME_STAINED_GLASS),
Object2ObjectMap.entry(Items.GREEN_TERRACOTTA, Items.GREEN_STAINED_GLASS),
Object2ObjectMap.entry(Items.CYAN_TERRACOTTA, Items.CYAN_STAINED_GLASS),
Object2ObjectMap.entry(Items.LIGHT_BLUE_TERRACOTTA, Items.LIGHT_BLUE_STAINED_GLASS),
Object2ObjectMap.entry(Items.BLUE_TERRACOTTA, Items.BLUE_STAINED_GLASS),
Object2ObjectMap.entry(Items.PURPLE_TERRACOTTA, Items.PURPLE_STAINED_GLASS),
Object2ObjectMap.entry(Items.PINK_TERRACOTTA, Items.PINK_STAINED_GLASS)
);

private ContainerScreen screen;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
import de.hysky.skyblocker.utils.render.gui.ItemButtonWidget;
import de.hysky.skyblocker.utils.scheduler.MessageScheduler;
import it.unimi.dsi.fastutil.ints.Int2IntMap;
import it.unimi.dsi.fastutil.ints.Int2IntMaps;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
Expand Down Expand Up @@ -56,7 +54,6 @@
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;

public class GardenPlotsWidget extends AbstractContainerWidget {
Expand All @@ -68,32 +65,32 @@ public class GardenPlotsWidget extends AbstractContainerWidget {
// STATIC SHENANIGANS
//////////////////////////

public static final Int2IntMap GARDEN_PLOT_TO_SLOT = Int2IntMaps.unmodifiable(new Int2IntOpenHashMap(Map.ofEntries(
Map.entry(1, 7),
Map.entry(2, 11),
Map.entry(3, 13),
Map.entry(4, 17),
Map.entry(5, 6),
Map.entry(6, 8),
Map.entry(7, 16),
Map.entry(8, 18),
Map.entry(9, 2),
Map.entry(10, 10),
Map.entry(11, 14),
Map.entry(12, 22),
Map.entry(13, 1),
Map.entry(14, 3),
Map.entry(15, 5),
Map.entry(16, 9),
Map.entry(17, 15),
Map.entry(18, 19),
Map.entry(19, 21),
Map.entry(20, 23),
Map.entry(21, 0),
Map.entry(22, 4),
Map.entry(23, 20),
Map.entry(24, 24)
)));
public static final Int2IntMap GARDEN_PLOT_TO_SLOT = Int2IntMap.ofEntries(
Int2IntMap.entry(1, 7),
Int2IntMap.entry(2, 11),
Int2IntMap.entry(3, 13),
Int2IntMap.entry(4, 17),
Int2IntMap.entry(5, 6),
Int2IntMap.entry(6, 8),
Int2IntMap.entry(7, 16),
Int2IntMap.entry(8, 18),
Int2IntMap.entry(9, 2),
Int2IntMap.entry(10, 10),
Int2IntMap.entry(11, 14),
Int2IntMap.entry(12, 22),
Int2IntMap.entry(13, 1),
Int2IntMap.entry(14, 3),
Int2IntMap.entry(15, 5),
Int2IntMap.entry(16, 9),
Int2IntMap.entry(17, 15),
Int2IntMap.entry(18, 19),
Int2IntMap.entry(19, 21),
Int2IntMap.entry(20, 23),
Int2IntMap.entry(21, 0),
Int2IntMap.entry(22, 4),
Int2IntMap.entry(23, 20),
Int2IntMap.entry(24, 24)
);

private static final GardenPlot[] gardenPlots = new GardenPlot[25];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import de.hysky.skyblocker.utils.render.HudHelper;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntMaps;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -45,24 +44,24 @@ public class SkillWidget {
Map.entry("Runecraft", Ico.MAGMA_CREAM),
Map.entry("Social", Ico.EMERALD)
);
private static final Object2IntMap<String> SKILL_CAP = Object2IntMaps.unmodifiable(new Object2IntOpenHashMap<>(Map.ofEntries(
Map.entry("Combat", 60),
Map.entry("Farming", 60),
Map.entry("Mining", 60),
Map.entry("Foraging", 50),
Map.entry("Fishing", 50),
Map.entry("Enchanting", 60),
Map.entry("Alchemy", 50),
Map.entry("Taming", 60),
Map.entry("Carpentry", 50),
Map.entry("Catacombs", 50),
Map.entry("Runecraft", 25),
Map.entry("Social", 25)
)));
private static final Object2IntMap<String> SOFT_SKILL_CAP = Object2IntMaps.unmodifiable(new Object2IntOpenHashMap<>(Map.of(
"Taming", 50,
"Farming", 50
)));
private static final Object2IntMap<String> SKILL_CAP = Object2IntMap.ofEntries(
Object2IntMap.entry("Combat", 60),
Object2IntMap.entry("Farming", 60),
Object2IntMap.entry("Mining", 60),
Object2IntMap.entry("Foraging", 50),
Object2IntMap.entry("Fishing", 50),
Object2IntMap.entry("Enchanting", 60),
Object2IntMap.entry("Alchemy", 50),
Object2IntMap.entry("Taming", 60),
Object2IntMap.entry("Carpentry", 50),
Object2IntMap.entry("Catacombs", 50),
Object2IntMap.entry("Runecraft", 25),
Object2IntMap.entry("Social", 25)
);
private static final Object2IntMap<String> SOFT_SKILL_CAP = Object2IntMap.ofEntries(
Object2IntMap.entry("Taming", 50),
Object2IntMap.entry("Farming", 50)
);

private static final Object2IntMap<String> INFINITE = Object2IntMaps.singleton("Catacombs", 0);

Expand Down
21 changes: 9 additions & 12 deletions src/main/java/de/hysky/skyblocker/utils/Calculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

import com.demonwav.mcdev.annotations.Translatable;
import it.unimi.dsi.fastutil.objects.Object2LongMap;
import it.unimi.dsi.fastutil.objects.Object2LongMaps;
import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap;
import java.io.Serial;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.minecraft.util.StringRepresentable;
Expand Down Expand Up @@ -149,15 +146,15 @@ private interface CalculatorFunction {
}

private static final Pattern NUMBER_PATTERN = Pattern.compile("(\\d+\\.?\\d*)([sekmbtq]?)");
private static final Object2LongMap<String> MAGNITUDE_VALUES = Object2LongMaps.unmodifiable(new Object2LongOpenHashMap<>(Map.of(
"s", 64L,
"e", 160L,
"k", 1_000L,
"m", 1_000_000L,
"b", 1_000_000_000L,
"t", 1_000_000_000_000L,
"q", 1_000_000_000_000_000L
)));
private static final Object2LongMap<String> MAGNITUDE_VALUES = Object2LongMap.ofEntries(
Object2LongMap.entry("s", 64L),
Object2LongMap.entry("e", 160L),
Object2LongMap.entry("k", 1_000L),
Object2LongMap.entry("m", 1_000_000L),
Object2LongMap.entry("b", 1_000_000_000L),
Object2LongMap.entry("t", 1_000_000_000_000L),
Object2LongMap.entry("q", 1_000_000_000_000_000L)
);

private static List<AbstractToken<?>> lex(String input) throws CalculatorException {
List<AbstractToken<?>> tokens = new ArrayList<>();
Expand Down