aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolverTest.java
diff options
context:
space:
mode:
authorWalker Selby <git@walkerselby.com>2022-03-27 12:13:08 -0500
committerGitHub <noreply@github.com>2022-03-27 13:13:08 -0400
commit5e7a8a02fe836c1e635faf067fbe8913549bc0e0 (patch)
treedc99a2544bd81af6d70c7bd07ba53142ff38d057 /src/test/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolverTest.java
parent47efdd4f84cc9a29738fe16d631eb33ee716db61 (diff)
downloadnotenoughupdates-5e7a8a02fe836c1e635faf067fbe8913549bc0e0.tar.gz
notenoughupdates-5e7a8a02fe836c1e635faf067fbe8913549bc0e0.tar.bz2
notenoughupdates-5e7a8a02fe836c1e635faf067fbe8913549bc0e0.zip
Add NBT Data to Profile Viewer Tabs and XP Bars (#94)
* Fixed what hypxiel broke in dungeons * Added Longswords to Tools Tab (Itemlist) * Set max cata level to 70 * ups * why is it now E * YEP the cap is 99 not 70 * long cata xp BatChest + remove crash check because hypixel profile is null and i havent fixed that yet * Added checks for chat messages for dungeon win overlay - i think ive got them all but 4Shrug * Added an option to alert you if you put something for too much onto ah (default 50%) + Lowest bin alert triggers if lowest bin isnt found * IMPORTANT * fix dungeon page in /pv * show minions from coop in /pv * (BREAKING CHANGE) remove whitespace in changelog * fix crash with minion check * initial draft * tooltip * important changes * progress related things progress bar for community goals total collected points and personal goals display * only show bingo tab on Bingo profiles * make goals display gold when completed * Added MM7 button to dungeon preset * wart go not stonks * fix percents and added stack size * use code nopo in fortnite shop — Today at 17:29 The capitalisation * config option for always showing bingo page * 🙂 * movble pv tabs * 2.1.md 🙂 * oops * der Kabel * import * Added powder amount to level up perk * Made it only show if the perk isnt maxed / level 0 * fix /pv crash when pet is not in repo * 2.1.md 🙂 * web editor my beloved * Add NBT Data to Profile Viewer Tabs and XP Bars Add NBT Data Support for Resources in Tabs Add NBT Data Support for Resources in XP Bars Optimize renderTabs function Optimize mouseClicked Function Optimize ProfileViewerPage Enum * Update Style Co-authored-by: NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> * Update GuiProfileViewer Rebased on pvbingo Updated formatting with IntelliJ reformatting tool (hopefully that matches now, let me know if you want me to try again but I think I did it right) * dungeons and pv bingo tab (#93) * add custom skull loading back (#96) * Refactor Hollows solvers, add tests, add Vec3Comparable, fix bugs (#95) * Rebase on master * Fix conflicts and rebase on master Add changes to change log * Oops Co-authored-by: nopo <noahogno@gmail.com> Co-authored-by: jani270 <jani270@gmx.de> Co-authored-by: Lulonaut <lulonaut@tutanota.de> Co-authored-by: NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> Co-authored-by: Lulonaut <67191924+Lulonaut@users.noreply.github.com> Co-authored-by: CraftyOldMiner <85420839+CraftyOldMiner@users.noreply.github.com>
Diffstat (limited to 'src/test/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolverTest.java')
-rw-r--r--src/test/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolverTest.java204
1 files changed, 0 insertions, 204 deletions
diff --git a/src/test/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolverTest.java b/src/test/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolverTest.java
deleted file mode 100644
index 58233410..00000000
--- a/src/test/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolverTest.java
+++ /dev/null
@@ -1,204 +0,0 @@
-package io.github.moulberry.notenoughupdates.miscfeatures;
-
-import io.github.moulberry.notenoughupdates.core.util.Vec3Comparable;
-import io.github.moulberry.notenoughupdates.miscfeatures.CrystalMetalDetectorSolver.SolutionState;
-import io.github.moulberry.notenoughupdates.util.NEUDebugLogger;
-import net.minecraft.util.BlockPos;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Assertions;
-
-import java.util.ArrayList;
-
-class CrystalMetalDetectorSolverTest {
- class Location {
- double distance;
- Vec3Comparable playerPosition;
- SolutionState expectedState;
- boolean centerKnown;
-
- public Location(double distance,
- Vec3Comparable playerPosition,
- SolutionState expectedState,
- boolean centerKnown) {
- this.distance = distance;
- this.playerPosition = playerPosition;
- this.expectedState = expectedState;
- this.centerKnown = centerKnown;
- }
- }
-
- class Solution {
- ArrayList<Location> locations = new ArrayList<>();
- BlockPos center = BlockPos.ORIGIN;
- BlockPos expectedSolution = BlockPos.ORIGIN;
- }
-
- @BeforeEach
- void setUp() {
- CrystalMetalDetectorSolver.initWorld();
- CrystalMetalDetectorSolver.treasureAllowedPredicate = blockPos -> true;
- NEUDebugLogger.logMethod = CrystalMetalDetectorSolverTest::neuDebugLog;
- NEUDebugLogger.allFlagsEnabled = true;
- }
-
- private void findPossibleSolutionsTwice(Location loc, boolean centerNewlyDiscovered) {
- // Each location has to be received twice to be valid
- CrystalMetalDetectorSolver.findPossibleSolutions(loc.distance, loc.playerPosition, centerNewlyDiscovered);
- CrystalMetalDetectorSolver.findPossibleSolutions(loc.distance, loc.playerPosition, false);
- }
-
- private void checkSolution(Solution solution) {
- boolean centerSet = false;
- int index = 0;
- for (Location loc : solution.locations) {
- if (loc.centerKnown && !centerSet && !solution.center.equals(BlockPos.ORIGIN)) {
- CrystalMetalDetectorSolver.setMinesCenter(solution.center);
- centerSet = true;
- findPossibleSolutionsTwice(loc, true);
- } else {
- findPossibleSolutionsTwice(loc, false);
- }
- Assertions.assertEquals(loc.expectedState,
- CrystalMetalDetectorSolver.currentState,
- "Location index " + index);
- index++;
- }
-
- Assertions.assertEquals(solution.expectedSolution, CrystalMetalDetectorSolver.getSolution());
- }
-
- @Test
- void findPossibleSolutions_single_location_sample_is_ignored() {
- Location location = new Location(37.3,
- new Vec3Comparable(779.1057116115207, 70.5, 502.2997937667801),
- SolutionState.MULTIPLE,
- false);
-
- CrystalMetalDetectorSolver.findPossibleSolutions(location.distance, location.playerPosition, false);
- Assertions.assertEquals(SolutionState.NOT_STARTED, CrystalMetalDetectorSolver.previousState,
- "Previous state");
- Assertions.assertEquals(SolutionState.NOT_STARTED, CrystalMetalDetectorSolver.currentState,
- "Current state");
- }
-
- @Test
- void findPossibleSolutions_currentState_becomes_previousState() {
- Location location = new Location(37.3,
- new Vec3Comparable(779.1057116115207, 70.5, 502.2997937667801),
- SolutionState.MULTIPLE,
- false);
-
- findPossibleSolutionsTwice(location, false);
- Assertions.assertEquals(SolutionState.NOT_STARTED, CrystalMetalDetectorSolver.previousState,
- "Previous state");
- Assertions.assertEquals(location.expectedState, CrystalMetalDetectorSolver.currentState,
- "Current state");
- }
-
- @Test
- void findPossibleSolutions_state_is_invalid_when_solution_and_distance_mismatch() {
- Solution solution = new Solution();
- solution.center = new BlockPos(736, 88, 547);
- solution.expectedSolution = new BlockPos(722, 67, 590);
- solution.locations.add(new Location(67.5,
- new Vec3Comparable(757.8235166144441, 68.0, 532.8037800566217),
- SolutionState.FOUND_KNOWN,
- true));
- // slightly different player position with invalid distance
- solution.locations.add(new Location(4.0,
- new Vec3Comparable(757.8235166144441, 69.0, 532.8037800566217),
- SolutionState.INVALID,
- true));
- checkSolution(solution);
- }
-
- @Test
- void findPossibleSolutions_state_is_failed_when_second_location_eliminates_all_blocks() {
- Solution solution = new Solution();
- solution.center = new BlockPos(736, 88, 547);
- solution.locations.add(new Location(29.4,
- new Vec3Comparable(721.5979761606153, 68.0, 590.9056839507032),
- SolutionState.MULTIPLE_KNOWN,
- true));
- solution.locations.add(new Location(4.0, // actual distance should be 38.2
- new Vec3Comparable(711.858759313838, 67.0, 590.3583935310772),
- SolutionState.FAILED,
- true));
- checkSolution(solution);
- }
-
- @Test
- void findPossibleSolutions_state_is_found_known_when_center_found_after_location() {
- Solution solution = new Solution();
- solution.center = new BlockPos(736, 88, 547);
- solution.locations.add(new Location(67.5,
- new Vec3Comparable(757.8235166144441, 68.0, 532.8037800566217),
- SolutionState.MULTIPLE,
- false));
- checkSolution(solution);
-
- solution.locations.get(0).centerKnown = true;
- solution.locations.get(0).expectedState = SolutionState.FOUND_KNOWN;
- solution.expectedSolution = new BlockPos(722, 67, 590);
- checkSolution(solution);
- }
-
- @Test
- void findPossibleSolutions_state_is_found_when_single_known_location() {
- Solution solution = new Solution();
- solution.center = new BlockPos(736, 88, 547);
- solution.expectedSolution = new BlockPos(722, 67, 590);
- solution.locations.add(new Location(67.5,
- new Vec3Comparable(757.8235166144441, 68.0, 532.8037800566217),
- SolutionState.FOUND_KNOWN,
- true));
- checkSolution(solution);
- }
-
- @Test
- void findPossibleSolutions_states_are_correct_using_multiple_locations_with_unknown_center() {
- Solution solution = new Solution();
- solution.locations.add(new Location(37.3,
- new Vec3Comparable(779.1057116115207, 70.5, 502.2997937667801),
- SolutionState.MULTIPLE,
- false));
- solution.locations.add(new Location(34.8,
- new Vec3Comparable(782.6999999880791, 71.0, 508.69999998807907),
- SolutionState.FOUND,
- false));
- solution.expectedSolution = new BlockPos(758, 67, 533);
-
- checkSolution(solution);
- }
-
- @Test
- void findPossibleSolutions_states_are_correct_when_multiple_known_locations_found() {
- Solution solution = new Solution();
-
- // First, validate that the solution doesn't work without the center
- solution.locations.add(new Location(29.4,
- new Vec3Comparable(721.5979761606153, 68.0, 590.9056839507032),
- SolutionState.MULTIPLE,
- false));
- solution.locations.add(new Location(38.2,
- new Vec3Comparable(711.858759313838, 67.0, 590.3583935310772),
- SolutionState.MULTIPLE,
- false));
- checkSolution(solution);
-
- // Now validate that the solution works with the center
- CrystalMetalDetectorSolver.resetSolution(false);
- solution.locations.get(0).expectedState = SolutionState.MULTIPLE_KNOWN;
- solution.locations.get(0).centerKnown = true;
- solution.locations.get(1).expectedState = SolutionState.FOUND_KNOWN;
- solution.locations.get(1).centerKnown = true;
- solution.expectedSolution = new BlockPos(748, 66, 578);
- solution.center = new BlockPos(736, 88, 547);
- checkSolution(solution);
- }
-
- private static void neuDebugLog(String message) {
- System.out.println(message);
- }
-}