diff options
author | olim <bobq4582@gmail.com> | 2024-06-20 15:18:55 +0100 |
---|---|---|
committer | olim <bobq4582@gmail.com> | 2024-07-15 12:38:00 +0100 |
commit | d03d158f8ca40572560f78285e646d4bb3b28d8e (patch) | |
tree | 5400a6661818912967c4971afb490864708b459e /src/main/java | |
parent | 72c7a10e3e30b2502e7142d59a07b9aaecd5bedb (diff) | |
download | Skyblocker-d03d158f8ca40572560f78285e646d4bb3b28d8e.tar.gz Skyblocker-d03d158f8ca40572560f78285e646d4bb3b28d8e.tar.bz2 Skyblocker-d03d158f8ca40572560f78285e646d4bb3b28d8e.zip |
make sure the location guess is sensible
make sure its within 100 blocks of the players zone
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/dwarven/WishingCompassSolver.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/WishingCompassSolver.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/WishingCompassSolver.java index 7ba2e05a..ce1fdf55 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/WishingCompassSolver.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/WishingCompassSolver.java @@ -169,6 +169,15 @@ public class WishingCompassSolver { }; } + /** + * Verify that a location could be correct and not to far out of zone. This is a problem when areas sometimes do not exist and is not a perfect solution + * @param startingZone zone player is searching in + * @param pos location where the area should be + * @return corrected location + */ + private static Boolean verifyLocation(ZONE startingZone, Vec3d pos) { + return ZONE_BOUNDING_BOXES.get(startingZone).expand(100, 0, 100).contains(pos); + } public static void onParticle(ParticleS2CPacket packet) { if (!Utils.isInCrystalHollows() || !ParticleTypes.HAPPY_VILLAGER.equals(packet.getParameters().getType())) { @@ -216,7 +225,11 @@ public class WishingCompassSolver { CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.somethingWentWrongMessage").formatted(Formatting.RED)), false); } else { //send message to player with location and name - MiningLocationLabel.CrystalHollowsLocationsCategory location = getTargetLocation(getZoneOfLocation(startPosOne)); + ZONE playerZone = getZoneOfLocation(startPosOne); + MiningLocationLabel.CrystalHollowsLocationsCategory location = getTargetLocation(playerZone); + if (!verifyLocation(playerZone, targetLocation)) { + location = MiningLocationLabel.CrystalHollowsLocationsCategory.UNKNOWN; + } //offset the jungle location to its doors if (location == MiningLocationLabel.CrystalHollowsLocationsCategory.JUNGLE_TEMPLE) { targetLocation = targetLocation.add(JUNGLE_TEMPLE_DOOR_OFFSET); |