From 3bd212839e1d3c497a840221a0c149451967467e Mon Sep 17 00:00:00 2001 From: ThatGravyBoat Date: Tue, 13 Jul 2021 01:51:19 -0230 Subject: Added 2 new subcommands to crystal waypoints, Added medals shown in farmhouse, Added config option to stop auto flipping of rpg hud, Added option so if exp bar is still being rendered it should hide when holding drill to not overlay them and keep a consistent hud --- .../skyblockhud/location/FarmHouseHandler.java | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/main/java/com/thatgravyboat/skyblockhud/location/FarmHouseHandler.java (limited to 'src/main/java/com/thatgravyboat/skyblockhud/location') diff --git a/src/main/java/com/thatgravyboat/skyblockhud/location/FarmHouseHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/location/FarmHouseHandler.java new file mode 100644 index 0000000..432bfbb --- /dev/null +++ b/src/main/java/com/thatgravyboat/skyblockhud/location/FarmHouseHandler.java @@ -0,0 +1,42 @@ +package com.thatgravyboat.skyblockhud.location; + +import com.thatgravyboat.skyblockhud.api.events.ProfileSwitchedEvent; +import com.thatgravyboat.skyblockhud.api.events.SidebarLineUpdateEvent; +import java.util.Arrays; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class FarmHouseHandler { + + public enum Medal { + BRONZE, + SILVER, + GOLD + } + + private static final int[] medals = new int[Medal.values().length]; + + @SubscribeEvent + public void onSidebarLineUpdate(SidebarLineUpdateEvent event) { + if (event.formattedLine.contains("medals:")){ + for (Medal value : Medal.values()) { + if (event.formattedLine.contains(value.name())){ + try { + medals[value.ordinal()] = Integer.parseInt(event.formattedLine.replace("medals:", "").replace(value.name(), "").trim()); + }catch (Exception ignored){} + break; + } + } + } + } + + @SubscribeEvent + public void onProfileSwitch(ProfileSwitchedEvent event){ + Arrays.fill(medals, 0); + } + + public static String getFormattedMedals(Medal medal){ + if (medal == null) return "0"; + return String.valueOf(medals[medal.ordinal()]); + } + +} -- cgit