diff options
| author | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2023-06-26 02:24:56 -0400 |
|---|---|---|
| committer | Aaron <51387595+AzureAaron@users.noreply.github.com> | 2023-06-26 02:24:56 -0400 |
| commit | 384f75a5aec98713d719f01662fc95464bed84f3 (patch) | |
| tree | f54f93cfe2b34e8a2537b0e550681c3c6b9bc8b9 /src/main/java/me/xmrvizzy/skyblocker/skyblock | |
| parent | dc312c8db05bc9e9cd3f4fd8c039274270a4661b (diff) | |
| download | Skyblocker-384f75a5aec98713d719f01662fc95464bed84f3.tar.gz Skyblocker-384f75a5aec98713d719f01662fc95464bed84f3.tar.bz2 Skyblocker-384f75a5aec98713d719f01662fc95464bed84f3.zip | |
Add Mirrorverse Waypoints + Rift Fixes
Diffstat (limited to 'src/main/java/me/xmrvizzy/skyblocker/skyblock')
4 files changed, 118 insertions, 3 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java index 6af06e6d..8e0d43da 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/FancyStatusBars.java @@ -2,6 +2,8 @@ package me.xmrvizzy.skyblocker.skyblock; import me.xmrvizzy.skyblocker.SkyblockerMod; import me.xmrvizzy.skyblocker.config.SkyblockerConfig; +import me.xmrvizzy.skyblocker.skyblock.rift.TheRift; +import me.xmrvizzy.skyblocker.utils.Utils; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; @@ -9,6 +11,7 @@ import net.minecraft.util.Identifier; public class FancyStatusBars { private static final Identifier BARS = new Identifier(SkyblockerMod.NAMESPACE, "textures/gui/bars.png"); + private static final String RIFT_LOCATION = "rift"; private final MinecraftClient client = MinecraftClient.getInstance(); private final StatusBarTracker statusBarTracker = SkyblockerMod.getInstance().statusBarTracker; @@ -39,7 +42,7 @@ public class FancyStatusBars { public boolean render(DrawContext context, int scaledWidth, int scaledHeight) { var player = client.player; - if (!SkyblockerConfig.get().general.bars.enableBars || player == null) + if (!SkyblockerConfig.get().general.bars.enableBars || player == null || Utils.getLocationRaw().equals(TheRift.LOCATION)) return false; anchorsX[0] = scaledWidth / 2 - 91; anchorsY[0] = scaledHeight - 33; diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Trivia.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Trivia.java index 10a2e413..f7598af5 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Trivia.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/Trivia.java @@ -69,7 +69,7 @@ public class Trivia extends ChatPatternListener { answers.put("What is the status of Storm?", new String[]{"The Wither Lords"}); answers.put("What is the status of Necron?", new String[]{"The Wither Lords"}); answers.put("What is the status of Maxor, Storm, Goldor and Necron?", new String[]{"The Wither Lords"}); - answers.put("How many total Fairy Souls are there?", new String[]{"240 Fairy Souls"}); + answers.put("How many total Fairy Souls are there?", new String[]{"242 Fairy Souls"}); answers.put("How many Fairy Souls are there in Spider's Den?", new String[]{"19 Fairy Souls"}); answers.put("How many Fairy Souls are there in The End?", new String[]{"12 Fairy Souls"}); answers.put("How many Fairy Souls are there in The Farming Islands?", new String[]{"20 Fairy Souls"}); @@ -87,7 +87,7 @@ public class Trivia extends ChatPatternListener { answers.put("What is the name of the person that upgrades pets?", new String[]{"Kat"}); answers.put("What is the name of the lady of the Nether?", new String[]{"Elle"}); answers.put("Which villager in the Village gives you a Rogue Sword?", new String[]{"Jamie"}); - answers.put("How many unique minions are there?", new String[]{"58 Minions"}); + answers.put("How many unique minions are there?", new String[]{"59 Minions"}); answers.put("Which of these enemies does not spawn in the Spider's Den?", new String[]{"Zombie Spider", "Cave Spider", "Wither Skeleton", "Dashing Spooder", "Broodfather", "Night Spider"}); answers.put("Which of these monsters only spawns at night?", new String[]{"Zombie Villager", "Ghast"}); diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/rift/MirrorverseWaypoints.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/rift/MirrorverseWaypoints.java new file mode 100644 index 00000000..c0493d18 --- /dev/null +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/rift/MirrorverseWaypoints.java @@ -0,0 +1,101 @@ +package me.xmrvizzy.skyblocker.skyblock.rift; + +import java.awt.Color; +import java.io.BufferedReader; +import java.io.IOException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +import me.x150.renderer.render.Renderer3d; +import me.xmrvizzy.skyblocker.config.SkyblockerConfig; +import me.xmrvizzy.skyblocker.mixin.accessor.FrustumInvoker; +import me.xmrvizzy.skyblocker.utils.FrustumUtils; +import me.xmrvizzy.skyblocker.utils.Utils; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; +import net.minecraft.client.MinecraftClient; +import net.minecraft.util.DyeColor; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; + +public class MirrorverseWaypoints { + private static final Logger LOGGER = LoggerFactory.getLogger("skyblocker"); + private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); + private static final Identifier WAYPOINTS_JSON = new Identifier("skyblocker", "mirrorverse_waypoints.json"); + private static final BlockPos[] LAVA_PATH_WAYPOINTS = new BlockPos[107]; + private static final BlockPos[] UPSIDE_DOWN_WAYPOINTS = new BlockPos[66]; + private static final BlockPos[] TURBULATOR_WAYPOINTS = new BlockPos[27]; + private static final float[] COLOR_COMPONENTS = DyeColor.RED.getColorComponents(); + private static final Vec3d ONE = new Vec3d(1, 1, 1); + + static { + loadWaypoints(); + } + + /** + * Loads the waypoint locations into memory + */ + public static void loadWaypoints() { + try(BufferedReader reader = CLIENT.getResourceManager().openAsReader(WAYPOINTS_JSON)) { + JsonObject file = JsonParser.parseReader(reader).getAsJsonObject(); + JsonArray sections = file.get("sections").getAsJsonArray(); + + /// Lava Path + JsonArray lavaPathWaypoints = sections.get(0).getAsJsonObject().get("waypoints").getAsJsonArray(); + + for(int i = 0; i < lavaPathWaypoints.size(); i++) { + JsonObject point = lavaPathWaypoints.get(i).getAsJsonObject(); + LAVA_PATH_WAYPOINTS[i] = new BlockPos(point.get("x").getAsInt(), point.get("y").getAsInt(), point.get("z").getAsInt()); + } + + /// Upside Down Parkour + JsonArray upsideDownParkourWaypoints = sections.get(1).getAsJsonObject().get("waypoints").getAsJsonArray(); + + for(int i = 0; i < upsideDownParkourWaypoints.size(); i++) { + JsonObject point = upsideDownParkourWaypoints.get(i).getAsJsonObject(); + UPSIDE_DOWN_WAYPOINTS[i] = new BlockPos(point.get("x").getAsInt(), point.get("y").getAsInt(), point.get("z").getAsInt()); + } + + /// Turbulator Parkour + JsonArray turbulatorParkourWaypoints = sections.get(2).getAsJsonObject().get("waypoints").getAsJsonArray(); + + for(int i = 0; i < turbulatorParkourWaypoints.size(); i++) { + JsonObject point = turbulatorParkourWaypoints.get(i).getAsJsonObject(); + TURBULATOR_WAYPOINTS[i] = new BlockPos(point.get("x").getAsInt(), point.get("y").getAsInt(), point.get("z").getAsInt()); + } + + } catch (IOException e) { + LOGGER.info("[Skyblocker] Mirrorverse Waypoints failed to load ;("); + e.printStackTrace(); + } + } + + public static void render(WorldRenderContext wrc) { + FrustumInvoker frustum = ((FrustumInvoker) FrustumUtils.getFrustum()); + //I would also check for the mirrorverse location but the scoreboard stuff is not performant at all... + if(Utils.getLocationRaw().equals(TheRift.LOCATION) && SkyblockerConfig.get().locations.rift.mirrorverseWaypoints) { + for(BlockPos pos : LAVA_PATH_WAYPOINTS) { + if(frustum.isVisible(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1)) { + Renderer3d.renderFilled(wrc.matrixStack(), new Color(COLOR_COMPONENTS[0], COLOR_COMPONENTS[1], COLOR_COMPONENTS[2], 0.5f), Vec3d.of(pos), ONE); + }; + } + + for(BlockPos pos : UPSIDE_DOWN_WAYPOINTS) { + if(frustum.isVisible(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1)) { + Renderer3d.renderFilled(wrc.matrixStack(), new Color(COLOR_COMPONENTS[0], COLOR_COMPONENTS[1], COLOR_COMPONENTS[2], 0.5f), Vec3d.of(pos), ONE); + }; + } + + for(BlockPos pos : TURBULATOR_WAYPOINTS) { + if(frustum.isVisible(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1)) { + Renderer3d.renderFilled(wrc.matrixStack(), new Color(COLOR_COMPONENTS[0], COLOR_COMPONENTS[1], COLOR_COMPONENTS[2], 0.5f), Vec3d.of(pos), ONE); + }; + } + } + } +} diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/rift/TheRift.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/rift/TheRift.java new file mode 100644 index 00000000..24f92238 --- /dev/null +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/rift/TheRift.java @@ -0,0 +1,11 @@ +package me.xmrvizzy.skyblocker.skyblock.rift; + +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; + +public class TheRift { + public static final String LOCATION = "rift"; + + public static void init() { + WorldRenderEvents.AFTER_TRANSLUCENT.register(MirrorverseWaypoints::render); + } +} |
