diff options
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/skyblock/dwarven')
3 files changed, 18 insertions, 32 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java index 01b1e9ec..e9dfd6ac 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java @@ -11,9 +11,7 @@ import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallba import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.texture.atlas.Sprite; import net.minecraft.util.Identifier; -import org.apache.commons.math3.analysis.UnivariateMatrixFunction; import java.awt.*; import java.util.Arrays; @@ -22,13 +20,16 @@ import java.util.Map; public class CrystalsHud { public static final MinecraftClient client = MinecraftClient.getInstance(); - protected static final Identifier MAP_TEXTURE = new Identifier(SkyblockerMod.NAMESPACE, "textures/gui/crystals_map.png"); //todo is this the right place to store file + protected static final Identifier MAP_TEXTURE = new Identifier(SkyblockerMod.NAMESPACE, "textures/gui/crystals_map.png"); private static final Identifier MAP_ICON = new Identifier("textures/map/map_icons.png"); - public static boolean visable = false; + private static final String[] SMALL_LOCATIONS = new String[] {"Fairy Grotto","King","Corleone"}; + + public static boolean visible = false; + + - public static final int LOCATION_SIZE = 10; //todo possible config option @@ -42,7 +43,7 @@ public class CrystalsHud { if (!SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.enabled || client.options.playerListKey.isPressed() || client.player == null - || !visable) { + || !visible) { return; } render(context, SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.x, @@ -64,8 +65,12 @@ public class CrystalsHud { for (CrystalsWaypoint waypoint : ActiveWaypoints.values()){ Color waypointColor = waypoint.category.color; Pair<Integer, Integer> renderPos = transformLocation(waypoint.pos.getX(),waypoint.pos.getZ()); - //fill square of size LOCATION_SIZE around the coordinates of the location - context.fill(hudX+renderPos.first()-LOCATION_SIZE/2,hudY+renderPos.second()-LOCATION_SIZE/2,hudX+renderPos.first()+LOCATION_SIZE/2,hudY+renderPos.second()+LOCATION_SIZE/2,waypointColor.getRGB()); + int locationSize = SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.locationSize; + if (Arrays.asList(SMALL_LOCATIONS).contains(waypoint.name.getString())){//if small location half the location size + locationSize = locationSize/2; + } + //fill square of size locationSize around the coordinates of the location + context.fill(hudX+renderPos.first()-locationSize/2,hudY+renderPos.second()-locationSize/2,hudX+renderPos.first()+locationSize/2,hudY+renderPos.second()+locationSize/2,waypointColor.getRGB()); } } //draw player on map @@ -96,11 +101,11 @@ public class CrystalsHud { public static void update() { if (client.player == null || client.getNetworkHandler() == null || !SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.enabled) { - visable = false; + visible = false; return; } //get if the player is in the crystals - visable = Utils.isInCrystals(); + visible = Utils.isInCrystals(); } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java index ed9ba8bf..181a8750 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java @@ -25,6 +25,7 @@ import net.minecraft.server.command.ServerCommandSource; import net.minecraft.text.ClickEvent; import net.minecraft.text.MutableText; import net.minecraft.text.Text; +import net.minecraft.util.Util; import net.minecraft.util.math.BlockPos; import java.awt.*; @@ -164,8 +165,8 @@ public class CrystalsLocationsManager { } public static void update() { - if (client.player == null || client.getNetworkHandler() == null || !SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints.enabled) { - SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints.ActiveWaypoints= new HashMap<>(); //todo dose not seem to be working + if (client.player == null || client.getNetworkHandler() == null || !SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints.enabled || !Utils.isInCrystals()) { + SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints.ActiveWaypoints= new HashMap<>(); return; } //get if the player is in the crystals diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsWaypoint.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsWaypoint.java index 5445a68c..09eeb419 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsWaypoint.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsWaypoint.java @@ -31,13 +31,6 @@ import java.util.function.ToDoubleFunction; public class CrystalsWaypoint extends Waypoint { private static final Logger LOGGER = LoggerFactory.getLogger(CrystalsWaypoint.class); - public static final Codec<CrystalsWaypoint> CODEC = RecordCodecBuilder.create(instance -> instance.group( - Category.CODEC.fieldOf("category").forGetter(crystalsWaypoint -> crystalsWaypoint.category), - TextCodecs.CODEC.fieldOf("name").forGetter(crystalsWaypoint -> crystalsWaypoint.name), - BlockPos.CODEC.fieldOf("pos").forGetter(crystalsWaypoint -> crystalsWaypoint.pos) - ).apply(instance, CrystalsWaypoint::new)); - - private static final Supplier<SkyblockerConfig.CrystalsWaypoints> CONFIG = () -> SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints; static final Supplier<Type> TYPE_SUPPLIER = () -> CONFIG.get().waypointType; @@ -137,18 +130,5 @@ public class CrystalsWaypoint extends Waypoint { return name; } - static class CategoryArgumentType extends EnumArgumentType<Category> { - CategoryArgumentType() { - super(Category.CODEC, Category::values); - } - - static CategoryArgumentType category() { - return new CategoryArgumentType(); - } - - static <S> Category getCategory(CommandContext<S> context, String name) { - return context.getArgument(name, Category.class); - } - } } } |