From a7bd9736571616085b285c5b2f02a54342414ebf Mon Sep 17 00:00:00 2001 From: msg-programs Date: Sun, 8 Oct 2023 17:27:49 +0200 Subject: Initial commit for creeper beam solver. --- .../java/me/xmrvizzy/skyblocker/SkyblockerMod.java | 1 + .../skyblocker/skyblock/dungeon/CreeperBeams.java | 186 +++++++++++++++++++++ 2 files changed, 187 insertions(+) create mode 100644 src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/CreeperBeams.java (limited to 'src/main') diff --git a/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java b/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java index 07a5be76..129c4774 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java +++ b/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java @@ -101,6 +101,7 @@ public class SkyblockerMod implements ClientModInitializer { QuiverWarning.init(); SpecialEffects.init(); ItemProtection.init(); + CreeperBeams.init(); containerSolverManager.init(); statusBarTracker.init(); Scheduler.INSTANCE.scheduleCyclic(Utils::update, 20); diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/CreeperBeams.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/CreeperBeams.java new file mode 100644 index 00000000..399aa365 --- /dev/null +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/CreeperBeams.java @@ -0,0 +1,186 @@ +package me.xmrvizzy.skyblocker.skyblock.dungeon; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.tuple.Triple; +import org.joml.Intersectiond; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.architectury.event.events.client.ClientTooltipEvent.Render; +import me.xmrvizzy.skyblocker.utils.Utils; +import me.xmrvizzy.skyblocker.utils.render.RenderHelper; +import me.xmrvizzy.skyblocker.utils.scheduler.Scheduler; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.entity.mob.CreeperEntity; +import net.minecraft.predicate.entity.EntityPredicates; +import net.minecraft.text.Text; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; +import net.minecraft.util.math.Vec3d; + +public class CreeperBeams { + + private static final Logger LOGGER = LoggerFactory.getLogger(CreeperBeams.class.getName()); + + // "missing, this palette looks like you stole it from a 2018 bootstrap webapp!" + private static final float[][] COLORS = { + { (float) 0xC6 / 0xFF, (float) 0xA1 / 0xFF, (float) 0x5B / 0xFF }, + { (float) 0x6D / 0xFF, (float) 0x59 / 0xFF, (float) 0x7A / 0xFF }, + { (float) 0xB5 / 0xFF, (float) 0x65 / 0xFF, (float) 0x76 / 0xFF }, + { (float) 0xE5 / 0xFF, (float) 0x6B / 0xFF, (float) 0x6F / 0xFF }, + }; + + private static final int FLOOR_Y = 68; + private static final int BASE_Y = 74; + + private static ArrayList lines = new ArrayList<>(); + + public static void init() { + Scheduler.INSTANCE.scheduleCyclic(CreeperBeams::update, 20); + WorldRenderEvents.BEFORE_DEBUG_RENDER.register(CreeperBeams::render); + } + + private static void update() { + + if (!Utils.isInDungeons()) { + lines.clear(); + return; + } + + MinecraftClient client = MinecraftClient.getInstance(); + ClientWorld world = client.world; + ClientPlayerEntity player = client.player; + + if (world == null || player == null) { + return; + } + + if (lines.size() == 0) { + + BlockPos basePos = findCreeperBase(player, world); + + if (basePos == null) { + return; + } + + ArrayList targets = findTargets(player, world, basePos); + Vec3d creeperPos = new Vec3d(basePos.getX() + 0.5, BASE_Y + 3.5, basePos.getZ() + 0.5); + + lines = findLines(player, world, creeperPos, targets); + } + + } + + private static BlockPos findCreeperBase(ClientPlayerEntity player, ClientWorld world) { + + // find all creepers + List creepers = world.getEntitiesByClass( + CreeperEntity.class, + player.getBoundingBox().expand(50D), + EntityPredicates.VALID_ENTITY); + + if (creepers.size() == 0) { + return null; + } + + // (sanity) check: + // if the creeper isn't above a sea lantern, it's not the target. + for (CreeperEntity ce : creepers) { + Vec3d creeperPos = ce.getPos(); + BlockPos potentialBase = BlockPos.ofFloored(creeperPos.x, BASE_Y, creeperPos.z); + Block block = world.getBlockState(potentialBase).getBlock(); + if (block == Blocks.SEA_LANTERN || block == Blocks.PRISMARINE) { + player.sendMessage(Text.of(String.format("Base found at %s", potentialBase.toString()))); + return potentialBase; + } + } + + player.sendMessage(Text.of("Base not found")); + return null; + + } + + // search for sea lanterns (and the ONE prismarine ty hypixel) and calculate + // solutions + private static ArrayList findTargets(ClientPlayerEntity player, ClientWorld world, BlockPos basePos) { + ArrayList targets = new ArrayList<>(); + + BlockPos start = new BlockPos(basePos.getX() - 15, BASE_Y + 12, basePos.getZ() - 15); + BlockPos end = new BlockPos(basePos.getX() + 16, FLOOR_Y, basePos.getZ() + 16); + + for (BlockPos bp : BlockPos.iterate(start, end)) { + Block b = world.getBlockState(bp).getBlock(); + if (b == Blocks.SEA_LANTERN || b == Blocks.PRISMARINE) { + targets.add(new Vec3d(bp.getX() + 0.5, bp.getY() + 0.5, bp.getZ() + 0.5)); + player.sendMessage(Text.of(String.format("Found a target at %s", bp.toString()))); + } + } + return targets; + } + + private static ArrayList findLines(ClientPlayerEntity player, ClientWorld world, Vec3d creeperPos, + ArrayList targets) { + + ArrayList> allLines = new ArrayList<>(); + + // optimize this a little bit by + // only generating lines "one way", i.e. 1->2 but not 2->1 + for (int i = 0; i < targets.size(); i++) { + for (int j = i + 1; j < targets.size(); j++) { + Vec3d one = targets.get(i); + Vec3d two = targets.get(j); + double dist = Intersectiond.distancePointLine( + creeperPos.x, creeperPos.y, creeperPos.z, + one.x, one.y, one.z, + two.x, two.y, two.z); + allLines.add(Triple.of(dist, i, j)); + } + } + + // this still feels a bit heavy-handed, but it works for now. + + ArrayList result = new ArrayList<>(); + + allLines.sort((a, b) -> Double.compare(a.getLeft(), b.getLeft())); + + while (result.size() < 4 && !allLines.isEmpty()) { + int idxA = allLines.get(0).getMiddle(); + int idxB = allLines.get(0).getRight(); + result.add(new Vec3d[] { targets.get(idxA), targets.get(idxB) }); + player.sendMessage(Text.of(String.format("Drawing line from %s to %s", targets.get(idxA).toString(), + targets.get(idxB).toString()))); + + // remove the line we just added and other lines that use blocks we're using for + // that line + allLines.remove(0); + allLines.removeIf(line -> line.getMiddle() == idxA + || line.getRight() == idxA + || line.getMiddle() == idxB + || line.getRight() == idxB); + } + + if (result.size() != 4) { + LOGGER.error("Not enough solutions found. This is bad..."); + } + + return result; + } + + private static void render(WorldRenderContext wrc) { + + // lines.size() is always <= so no issues OOB issues here. + for (int i = 0; i < lines.size(); i++) { + Vec3d[] line = lines.get(i); + RenderHelper.renderLinesFromPoints(wrc, line, COLORS[i], 1, 3); + } + } + +} -- cgit From 1abbfd2fb04030cd3b7b3280326e169890c65900 Mon Sep 17 00:00:00 2001 From: msg-programs Date: Sun, 8 Oct 2023 21:37:36 +0200 Subject: Rewrite most of the thing to make it more pretty (code-/visual-wise) --- .../skyblocker/skyblock/dungeon/CreeperBeams.java | 174 ++++++++++++++------- 1 file changed, 120 insertions(+), 54 deletions(-) (limited to 'src/main') diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/CreeperBeams.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/CreeperBeams.java index 399aa365..d514a2f3 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/CreeperBeams.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/CreeperBeams.java @@ -3,13 +3,11 @@ package me.xmrvizzy.skyblocker.skyblock.dungeon; import java.util.ArrayList; import java.util.List; -import org.apache.commons.lang3.tuple.Triple; import org.joml.Intersectiond; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import dev.architectury.event.events.client.ClientTooltipEvent.Render; -import me.xmrvizzy.skyblocker.utils.Utils; +import it.unimi.dsi.fastutil.objects.ObjectDoublePair; import me.xmrvizzy.skyblocker.utils.render.RenderHelper; import me.xmrvizzy.skyblocker.utils.scheduler.Scheduler; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; @@ -32,16 +30,18 @@ public class CreeperBeams { // "missing, this palette looks like you stole it from a 2018 bootstrap webapp!" private static final float[][] COLORS = { - { (float) 0xC6 / 0xFF, (float) 0xA1 / 0xFF, (float) 0x5B / 0xFF }, - { (float) 0x6D / 0xFF, (float) 0x59 / 0xFF, (float) 0x7A / 0xFF }, - { (float) 0xB5 / 0xFF, (float) 0x65 / 0xFF, (float) 0x76 / 0xFF }, - { (float) 0xE5 / 0xFF, (float) 0x6B / 0xFF, (float) 0x6F / 0xFF }, + { 0.33f, 1f, 1f }, + { 1f, 0.33f, 0.33f }, + { 1f, 0.66f, 0f }, + { 1f, 0.33f, 1f }, }; - private static final int FLOOR_Y = 68; - private static final int BASE_Y = 74; + private static final int FLOOR_Y = -24; // 68; + private static final int BASE_Y = -16; // 74; - private static ArrayList lines = new ArrayList<>(); + private static ArrayList beams = new ArrayList<>(); + private static BlockPos base = null; + private static boolean solved = false; public static void init() { Scheduler.INSTANCE.scheduleCyclic(CreeperBeams::update, 20); @@ -50,35 +50,51 @@ public class CreeperBeams { private static void update() { - if (!Utils.isInDungeons()) { - lines.clear(); - return; - } - MinecraftClient client = MinecraftClient.getInstance(); ClientWorld world = client.world; ClientPlayerEntity player = client.player; - if (world == null || player == null) { + // clear state if not in dungeon + if (world == null || player == null /* || !Utils.isInDungeons() */) { + beams.clear(); + base = null; + solved = false; return; } - if (lines.size() == 0) { - - BlockPos basePos = findCreeperBase(player, world); + // don't do anything if the room is solved + if (solved) { + player.sendMessage(Text.of("Room is solved")); + return; + } - if (basePos == null) { + // try to find base if not found + if (base == null) { + base = findCreeperBase(player, world); + if (base == null) { return; } + } - ArrayList targets = findTargets(player, world, basePos); - Vec3d creeperPos = new Vec3d(basePos.getX() + 0.5, BASE_Y + 3.5, basePos.getZ() + 0.5); + // try to solve if we haven't already + if (beams.size() == 0) { - lines = findLines(player, world, creeperPos, targets); + Vec3d creeperPos = new Vec3d(base.getX() + 0.5, BASE_Y + 3.5, base.getZ() + 0.5); + ArrayList targets = findTargets(player, world, base); + LOGGER.info("targets2 = {}", targets); + beams = findLines(player, world, creeperPos, targets); } + // check if the room is solved + if (world.getBlockState(base).getBlock() != Blocks.SEA_LANTERN) { + solved = true; + } + + // update the beam states + beams.forEach(b -> b.updateShouldRender(world)); } + // find the sea lantern block beneath the creeper private static BlockPos findCreeperBase(ClientPlayerEntity player, ClientWorld world) { // find all creepers @@ -108,10 +124,9 @@ public class CreeperBeams { } - // search for sea lanterns (and the ONE prismarine ty hypixel) and calculate - // solutions - private static ArrayList findTargets(ClientPlayerEntity player, ClientWorld world, BlockPos basePos) { - ArrayList targets = new ArrayList<>(); + // find the sea lanterns (and the ONE prismarine ty hypixel) in the room + private static ArrayList findTargets(ClientPlayerEntity player, ClientWorld world, BlockPos basePos) { + ArrayList targets = new ArrayList<>(); BlockPos start = new BlockPos(basePos.getX() - 15, BASE_Y + 12, basePos.getZ() - 15); BlockPos end = new BlockPos(basePos.getX() + 16, FLOOR_Y, basePos.getZ() + 16); @@ -119,52 +134,53 @@ public class CreeperBeams { for (BlockPos bp : BlockPos.iterate(start, end)) { Block b = world.getBlockState(bp).getBlock(); if (b == Blocks.SEA_LANTERN || b == Blocks.PRISMARINE) { - targets.add(new Vec3d(bp.getX() + 0.5, bp.getY() + 0.5, bp.getZ() + 0.5)); + targets.add(new BlockPos(bp)); player.sendMessage(Text.of(String.format("Found a target at %s", bp.toString()))); } } + LOGGER.info("targets = {}", targets); return targets; } - private static ArrayList findLines(ClientPlayerEntity player, ClientWorld world, Vec3d creeperPos, - ArrayList targets) { + // generate lines between targets and finally find the solution + private static ArrayList findLines(ClientPlayerEntity player, ClientWorld world, Vec3d creeperPos, + ArrayList targets) { + + LOGGER.info("targets3 = {}", targets); - ArrayList> allLines = new ArrayList<>(); + ArrayList> allLines = new ArrayList<>(); // optimize this a little bit by - // only generating lines "one way", i.e. 1->2 but not 2->1 + // only generating lines "one way", i.e. 1 -> 2 but not 2 -> 1 for (int i = 0; i < targets.size(); i++) { for (int j = i + 1; j < targets.size(); j++) { - Vec3d one = targets.get(i); - Vec3d two = targets.get(j); + Beam beam = new Beam(targets.get(i), targets.get(j)); double dist = Intersectiond.distancePointLine( creeperPos.x, creeperPos.y, creeperPos.z, - one.x, one.y, one.z, - two.x, two.y, two.z); - allLines.add(Triple.of(dist, i, j)); + beam.line[0].x, beam.line[0].y, beam.line[0].z, + beam.line[1].x, beam.line[1].y, beam.line[1].z); + allLines.add(ObjectDoublePair.of(beam, dist)); + player.sendMessage(Text.of(String.format("Adding line from %s to %s", beam.blockOne, beam.blockTwo))); } } - // this still feels a bit heavy-handed, but it works for now. + // this feels a bit heavy-handed, but it works for now. - ArrayList result = new ArrayList<>(); - - allLines.sort((a, b) -> Double.compare(a.getLeft(), b.getLeft())); + ArrayList result = new ArrayList<>(); + allLines.sort((a, b) -> Double.compare(a.rightDouble(), b.rightDouble())); while (result.size() < 4 && !allLines.isEmpty()) { - int idxA = allLines.get(0).getMiddle(); - int idxB = allLines.get(0).getRight(); - result.add(new Vec3d[] { targets.get(idxA), targets.get(idxB) }); - player.sendMessage(Text.of(String.format("Drawing line from %s to %s", targets.get(idxA).toString(), - targets.get(idxB).toString()))); + Beam solution = allLines.get(0).left(); + result.add(solution); + player.sendMessage( + Text.of(String.format("Drawing line from %s to %s", solution.blockOne, solution.blockTwo))); // remove the line we just added and other lines that use blocks we're using for // that line allLines.remove(0); - allLines.removeIf(line -> line.getMiddle() == idxA - || line.getRight() == idxA - || line.getMiddle() == idxB - || line.getRight() == idxB); + player.sendMessage(Text.of(String.format("Deduplicating pre, %d left", allLines.size()))); + allLines.removeIf(beam -> solution.containsComponentOf(beam.left())); + player.sendMessage(Text.of(String.format("Deduplicating post, %d left", allLines.size()))); } if (result.size() != 4) { @@ -176,11 +192,61 @@ public class CreeperBeams { private static void render(WorldRenderContext wrc) { - // lines.size() is always <= so no issues OOB issues here. - for (int i = 0; i < lines.size(); i++) { - Vec3d[] line = lines.get(i); - RenderHelper.renderLinesFromPoints(wrc, line, COLORS[i], 1, 3); + // don't render if solved + if (solved) { + return; } + + // lines.size() is always <= 4 so no issues OOB issues with the colors here. + for (int i = 0; i < beams.size(); i++) { + beams.get(i).render(wrc, COLORS[i]); + } + } + + private static class Beam { + + public BlockPos blockOne; + public BlockPos blockTwo; + public Vec3d[] line = new Vec3d[2]; + public Box outlineOne; + public Box outlineTwo; + + private boolean toDo = true; + + public Beam(BlockPos a, BlockPos b) { + blockOne = a; + blockTwo = b; + line[0] = new Vec3d(a.getX() + 0.5, a.getY() + 0.5, a.getZ() + 0.5); + line[1] = new Vec3d(b.getX() + 0.5, b.getY() + 0.5, b.getZ() + 0.5); + outlineOne = new Box(a); + outlineTwo = new Box(b); + } + + public boolean containsComponentOf(Beam other) { + return this.blockOne.equals(other.blockOne) + || this.blockOne.equals(other.blockTwo) + || this.blockTwo.equals(other.blockOne) + || this.blockTwo.equals(other.blockTwo); + + } + + public void updateShouldRender(ClientWorld world) { + toDo = !(world.getBlockState(blockOne).getBlock() == Blocks.PRISMARINE + && world.getBlockState(blockTwo).getBlock() == Blocks.PRISMARINE); + } + + public void render(WorldRenderContext wrc, float[] color) { + if (toDo) { + RenderHelper.renderOutline(wrc, outlineOne, color, 3); + RenderHelper.renderOutline(wrc, outlineTwo, color, 3); + RenderHelper.renderLinesFromPoints(wrc, line, color, 1, 2); + } else { + RenderHelper.renderOutline(wrc, outlineOne, new float[] { 0.33f, 1f, 0.33f }, 1); + RenderHelper.renderOutline(wrc, outlineTwo, new float[] { 0.33f, 1f, 0.33f }, 1); + RenderHelper.renderLinesFromPoints(wrc, line, new float[] { 0.33f, 1f, 0.33f }, 0.75f, 1); + } + } + } } -- cgit From 3655b0380908bf91248991c79fcdd56bc442ba5c Mon Sep 17 00:00:00 2001 From: msg-programs Date: Sun, 8 Oct 2023 21:42:14 +0200 Subject: Add comments, change debug values to actual values --- .../skyblocker/skyblock/dungeon/CreeperBeams.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/main') diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/CreeperBeams.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/CreeperBeams.java index d514a2f3..28678e19 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/CreeperBeams.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/CreeperBeams.java @@ -36,8 +36,8 @@ public class CreeperBeams { { 1f, 0.33f, 1f }, }; - private static final int FLOOR_Y = -24; // 68; - private static final int BASE_Y = -16; // 74; + private static final int FLOOR_Y = 68; + private static final int BASE_Y = 74; private static ArrayList beams = new ArrayList<>(); private static BlockPos base = null; @@ -91,7 +91,7 @@ public class CreeperBeams { } // update the beam states - beams.forEach(b -> b.updateShouldRender(world)); + beams.forEach(b -> b.updateState(world)); } // find the sea lantern block beneath the creeper @@ -203,14 +203,21 @@ public class CreeperBeams { } } + // helper class to hold all the things needed to render a beam private static class Beam { + // raw block pos of target public BlockPos blockOne; public BlockPos blockTwo; + + // middle of targets used for rendering the line public Vec3d[] line = new Vec3d[2]; + + // boxes used for rendering the block outline public Box outlineOne; public Box outlineTwo; + // state: is this beam created/inputted or not? private boolean toDo = true; public Beam(BlockPos a, BlockPos b) { @@ -222,19 +229,21 @@ public class CreeperBeams { outlineTwo = new Box(b); } + // used to filter the list of all beams so that no two beams share a target public boolean containsComponentOf(Beam other) { return this.blockOne.equals(other.blockOne) || this.blockOne.equals(other.blockTwo) || this.blockTwo.equals(other.blockOne) || this.blockTwo.equals(other.blockTwo); - } - public void updateShouldRender(ClientWorld world) { + // update the state: is the beam created or not? + public void updateState(ClientWorld world) { toDo = !(world.getBlockState(blockOne).getBlock() == Blocks.PRISMARINE && world.getBlockState(blockTwo).getBlock() == Blocks.PRISMARINE); } + // render either in a color if not created or faintly green if created public void render(WorldRenderContext wrc, float[] color) { if (toDo) { RenderHelper.renderOutline(wrc, outlineOne, color, 3); -- cgit From 87983958dcebd98f73c6971a5ea82c80871a12af Mon Sep 17 00:00:00 2001 From: msg-programs Date: Mon, 9 Oct 2023 21:58:06 +0200 Subject: It works! Remove debug logging. --- .../skyblocker/skyblock/dungeon/CreeperBeams.java | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/main') diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/CreeperBeams.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/CreeperBeams.java index 28678e19..9ed5d1ae 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/CreeperBeams.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/CreeperBeams.java @@ -8,6 +8,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import it.unimi.dsi.fastutil.objects.ObjectDoublePair; +import me.xmrvizzy.skyblocker.utils.Utils; import me.xmrvizzy.skyblocker.utils.render.RenderHelper; import me.xmrvizzy.skyblocker.utils.scheduler.Scheduler; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; @@ -55,7 +56,7 @@ public class CreeperBeams { ClientPlayerEntity player = client.player; // clear state if not in dungeon - if (world == null || player == null /* || !Utils.isInDungeons() */) { + if (world == null || player == null || !Utils.isInDungeons()) { beams.clear(); base = null; solved = false; @@ -64,7 +65,6 @@ public class CreeperBeams { // don't do anything if the room is solved if (solved) { - player.sendMessage(Text.of("Room is solved")); return; } @@ -81,7 +81,6 @@ public class CreeperBeams { Vec3d creeperPos = new Vec3d(base.getX() + 0.5, BASE_Y + 3.5, base.getZ() + 0.5); ArrayList targets = findTargets(player, world, base); - LOGGER.info("targets2 = {}", targets); beams = findLines(player, world, creeperPos, targets); } @@ -114,12 +113,10 @@ public class CreeperBeams { BlockPos potentialBase = BlockPos.ofFloored(creeperPos.x, BASE_Y, creeperPos.z); Block block = world.getBlockState(potentialBase).getBlock(); if (block == Blocks.SEA_LANTERN || block == Blocks.PRISMARINE) { - player.sendMessage(Text.of(String.format("Base found at %s", potentialBase.toString()))); return potentialBase; } } - player.sendMessage(Text.of("Base not found")); return null; } @@ -135,10 +132,8 @@ public class CreeperBeams { Block b = world.getBlockState(bp).getBlock(); if (b == Blocks.SEA_LANTERN || b == Blocks.PRISMARINE) { targets.add(new BlockPos(bp)); - player.sendMessage(Text.of(String.format("Found a target at %s", bp.toString()))); } } - LOGGER.info("targets = {}", targets); return targets; } @@ -146,8 +141,6 @@ public class CreeperBeams { private static ArrayList findLines(ClientPlayerEntity player, ClientWorld world, Vec3d creeperPos, ArrayList targets) { - LOGGER.info("targets3 = {}", targets); - ArrayList> allLines = new ArrayList<>(); // optimize this a little bit by @@ -160,7 +153,6 @@ public class CreeperBeams { beam.line[0].x, beam.line[0].y, beam.line[0].z, beam.line[1].x, beam.line[1].y, beam.line[1].z); allLines.add(ObjectDoublePair.of(beam, dist)); - player.sendMessage(Text.of(String.format("Adding line from %s to %s", beam.blockOne, beam.blockTwo))); } } @@ -172,15 +164,11 @@ public class CreeperBeams { while (result.size() < 4 && !allLines.isEmpty()) { Beam solution = allLines.get(0).left(); result.add(solution); - player.sendMessage( - Text.of(String.format("Drawing line from %s to %s", solution.blockOne, solution.blockTwo))); // remove the line we just added and other lines that use blocks we're using for // that line allLines.remove(0); - player.sendMessage(Text.of(String.format("Deduplicating pre, %d left", allLines.size()))); allLines.removeIf(beam -> solution.containsComponentOf(beam.left())); - player.sendMessage(Text.of(String.format("Deduplicating post, %d left", allLines.size()))); } if (result.size() != 4) { -- cgit From c6d54983cf944207cb3a7be38a448bca1f1d09a9 Mon Sep 17 00:00:00 2001 From: msg-programs Date: Tue, 10 Oct 2023 22:14:44 +0200 Subject: It did, infact, not work. Now it should --- .../skyblocker/skyblock/dungeon/CreeperBeams.java | 51 +++++++++++----------- 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'src/main') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java index 7c668948..b495bd3e 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java @@ -11,6 +11,7 @@ import it.unimi.dsi.fastutil.objects.ObjectDoublePair; import de.hysky.skyblocker.utils.Utils; import de.hysky.skyblocker.utils.render.RenderHelper; import de.hysky.skyblocker.utils.scheduler.Scheduler; +import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; import net.minecraft.block.Block; @@ -46,50 +47,49 @@ public class CreeperBeams { public static void init() { Scheduler.INSTANCE.scheduleCyclic(CreeperBeams::update, 20); WorldRenderEvents.BEFORE_DEBUG_RENDER.register(CreeperBeams::render); + ClientPlayConnectionEvents.JOIN.register(((handler, sender, client) -> reset())); + } + + private static void reset() { + beams.clear(); + base = null; + solved = false; } private static void update() { + // don't do anything if the room is solved + if (solved) { + return; + } + MinecraftClient client = MinecraftClient.getInstance(); ClientWorld world = client.world; ClientPlayerEntity player = client.player; // clear state if not in dungeon - if (world == null || player == null || !Utils.isInDungeons()) { - beams.clear(); - base = null; - solved = false; + if (world == null || player == null || !Utils.isInDungeons()) { return; } - // don't do anything if the room is solved - if (solved) { - return; - } - - // try to find base if not found + // try to find base if not found and solve if (base == null) { base = findCreeperBase(player, world); if (base == null) { return; } - } - - // try to solve if we haven't already - if (beams.size() == 0) { - Vec3d creeperPos = new Vec3d(base.getX() + 0.5, BASE_Y + 3.5, base.getZ() + 0.5); ArrayList targets = findTargets(player, world, base); beams = findLines(player, world, creeperPos, targets); } + // update the beam states + beams.forEach(b -> b.updateState(world)); + // check if the room is solved - if (world.getBlockState(base).getBlock() != Blocks.SEA_LANTERN) { + if (!isTarget(world, base)) { solved = true; } - - // update the beam states - beams.forEach(b -> b.updateState(world)); } // find the sea lantern block beneath the creeper @@ -110,8 +110,7 @@ public class CreeperBeams { for (CreeperEntity ce : creepers) { Vec3d creeperPos = ce.getPos(); BlockPos potentialBase = BlockPos.ofFloored(creeperPos.x, BASE_Y, creeperPos.z); - Block block = world.getBlockState(potentialBase).getBlock(); - if (block == Blocks.SEA_LANTERN || block == Blocks.PRISMARINE) { + if (isTarget(world, potentialBase)) { return potentialBase; } } @@ -128,8 +127,7 @@ public class CreeperBeams { BlockPos end = new BlockPos(basePos.getX() + 16, FLOOR_Y, basePos.getZ() + 16); for (BlockPos bp : BlockPos.iterate(start, end)) { - Block b = world.getBlockState(bp).getBlock(); - if (b == Blocks.SEA_LANTERN || b == Blocks.PRISMARINE) { + if (isTarget(world, bp)) { targets.add(new BlockPos(bp)); } } @@ -190,6 +188,11 @@ public class CreeperBeams { } } + private static boolean isTarget(ClientWorld world, BlockPos pos) { + Block block = world.getBlockState(pos).getBlock(); + return block == Blocks.SEA_LANTERN || block == Blocks.PRISMARINE; + } + // helper class to hold all the things needed to render a beam private static class Beam { @@ -242,7 +245,5 @@ public class CreeperBeams { RenderHelper.renderLinesFromPoints(wrc, line, new float[] { 0.33f, 1f, 0.33f }, 0.75f, 1); } } - } - } -- cgit From 05aedd82de412e8373d1f241e9dad927924a6780 Mon Sep 17 00:00:00 2001 From: msg-programs Date: Sat, 14 Oct 2023 11:19:32 +0200 Subject: Add config option to turn the thing on/off --- src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java | 3 +++ .../hysky/skyblocker/config/categories/DungeonsCategory.java | 10 +++++++++- .../de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java | 5 +++-- src/main/resources/assets/skyblocker/lang/de_de.json | 2 ++ src/main/resources/assets/skyblocker/lang/en_us.json | 2 ++ 5 files changed, 19 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index cb51afdc..430fb5f0 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -527,6 +527,9 @@ public class SkyblockerConfig { @SerialEntry public boolean blazesolver = true; + + @SerialEntry + public boolean creepersolver = true; @SerialEntry public boolean solveTrivia = true; diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java index ffd979eb..eb39e498 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java @@ -247,6 +247,14 @@ public class DungeonsCategory { newValue -> config.locations.dungeons.blazesolver = newValue) .controller(ConfigUtils::createBooleanController) .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.creepersolver")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.creepersolver.@Tooltip"))) + .binding(defaults.locations.dungeons.creepersolver, + () -> config.locations.dungeons.creepersolver, + newValue -> config.locations.dungeons.creepersolver = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) .option(Option.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.solveTrivia")) .binding(defaults.locations.dungeons.solveTrivia, @@ -262,7 +270,7 @@ public class DungeonsCategory { newValue -> config.locations.dungeons.solveTicTacToe = newValue) .controller(ConfigUtils::createBooleanController) .build()) - + //Livid Color .group(OptionGroup.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.lividColor")) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java index b495bd3e..1cad2980 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java @@ -8,6 +8,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import it.unimi.dsi.fastutil.objects.ObjectDoublePair; +import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.utils.Utils; import de.hysky.skyblocker.utils.render.RenderHelper; import de.hysky.skyblocker.utils.scheduler.Scheduler; @@ -177,8 +178,8 @@ public class CreeperBeams { private static void render(WorldRenderContext wrc) { - // don't render if solved - if (solved) { + // don't render if solved or disabled + if (solved || !SkyblockerConfigManager.get().locations.dungeons.creepersolver) { return; } diff --git a/src/main/resources/assets/skyblocker/lang/de_de.json b/src/main/resources/assets/skyblocker/lang/de_de.json index ccc958d0..dd8de99e 100644 --- a/src/main/resources/assets/skyblocker/lang/de_de.json +++ b/src/main/resources/assets/skyblocker/lang/de_de.json @@ -15,6 +15,8 @@ "text.autoconfig.skyblocker.option.locations.dungeons.enableMap": "Karte aktivieren", "text.autoconfig.skyblocker.option.locations.dungeons.solveThreeWeirdos": "Drei Verrückte Rätsel lösen", "text.autoconfig.skyblocker.option.locations.dungeons.blazesolver": "Blaze Rätsel lösen", + "text.autoconfig.skyblocker.option.locations.dungeons.creepersolver": "Creeper Beams lösen", + "text.autoconfig.skyblocker.option.locations.dungeons.creepersolver.@Tooltip": "Zeigt an, welche Strahlen die besten sind und welche Ziele man dafür treffen muss.", "text.autoconfig.skyblocker.option.locations.dungeons.solveTrivia": "Rätsel lösen", "text.autoconfig.skyblocker.option.locations.dungeons.terminals": "Terminal Löser", "text.autoconfig.skyblocker.option.locations.dungeons.terminals.solveColor": "Wähle die richtige Farbe", diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index f889595e..69f79359 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -267,6 +267,8 @@ "text.autoconfig.skyblocker.option.locations.dungeons.solveThreeWeirdos": "Solve Three Weirdos Puzzle", "text.autoconfig.skyblocker.option.locations.dungeons.blazesolver": "Solve Blaze Puzzle", "text.autoconfig.skyblocker.option.locations.dungeons.blazesolver.@Tooltip": "Boxes the correct blaze in green, also draws a line to and boxes the next blaze to kill in white.", + "text.autoconfig.skyblocker.option.locations.dungeons.creepersolver": "Solve Creeper Beams Puzzle", + "text.autoconfig.skyblocker.option.locations.dungeons.creepersolver.@Tooltip": "Highlights the best beams to make and the targets to hit.", "text.autoconfig.skyblocker.option.locations.dungeons.solveTrivia": "Solve Trivia Puzzle", "text.autoconfig.skyblocker.option.locations.dungeons.solveTicTacToe": "Solve Tic Tac Toe Puzzle", "text.autoconfig.skyblocker.option.locations.dungeons.solveTicTacToe.@Tooltip": "Puts a red box around the next best move for you to make!", -- cgit From 8385880ebc152a946f62a42d788e298f2b179794 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sat, 14 Oct 2023 16:05:14 -0400 Subject: Refactor CreeperBeams --- .../hysky/skyblocker/config/SkyblockerConfig.java | 4 +- .../config/categories/DungeonsCategory.java | 20 ++++---- .../skyblocker/skyblock/dungeon/CreeperBeams.java | 53 +++++++++++----------- .../skyblocker/skyblock/dungeon/DungeonBlaze.java | 2 +- .../resources/assets/skyblocker/lang/de_de.json | 6 +-- .../resources/assets/skyblocker/lang/en_us.json | 8 ++-- .../resources/assets/skyblocker/lang/es_es.json | 2 +- .../resources/assets/skyblocker/lang/fr_fr.json | 2 +- .../resources/assets/skyblocker/lang/id_id.json | 2 +- .../resources/assets/skyblocker/lang/ja_jp.json | 2 +- .../resources/assets/skyblocker/lang/ko_kr.json | 2 +- .../resources/assets/skyblocker/lang/nb_no.json | 2 +- .../resources/assets/skyblocker/lang/ru_ru.json | 2 +- .../resources/assets/skyblocker/lang/zh_cn.json | 4 +- 14 files changed, 56 insertions(+), 55 deletions(-) (limited to 'src/main') diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 430fb5f0..b673a9db 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -526,10 +526,10 @@ public class SkyblockerConfig { public boolean solveThreeWeirdos = true; @SerialEntry - public boolean blazesolver = true; + public boolean blazeSolver = true; @SerialEntry - public boolean creepersolver = true; + public boolean creeperSolver = true; @SerialEntry public boolean solveTrivia = true; diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java index eb39e498..066d8b8c 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java @@ -240,19 +240,19 @@ public class DungeonsCategory { .controller(ConfigUtils::createBooleanController) .build()) .option(Option.createBuilder() - .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.blazesolver")) - .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.blazesolver.@Tooltip"))) - .binding(defaults.locations.dungeons.blazesolver, - () -> config.locations.dungeons.blazesolver, - newValue -> config.locations.dungeons.blazesolver = newValue) + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver.@Tooltip"))) + .binding(defaults.locations.dungeons.blazeSolver, + () -> config.locations.dungeons.blazeSolver, + newValue -> config.locations.dungeons.blazeSolver = newValue) .controller(ConfigUtils::createBooleanController) .build()) .option(Option.createBuilder() - .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.creepersolver")) - .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.creepersolver.@Tooltip"))) - .binding(defaults.locations.dungeons.creepersolver, - () -> config.locations.dungeons.creepersolver, - newValue -> config.locations.dungeons.creepersolver = newValue) + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.creeperSolver")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.creeperSolver.@Tooltip"))) + .binding(defaults.locations.dungeons.creeperSolver, + () -> config.locations.dungeons.creeperSolver, + newValue -> config.locations.dungeons.creeperSolver = newValue) .controller(ConfigUtils::createBooleanController) .build()) .option(Option.createBuilder() diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java index 1cad2980..5356658e 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java @@ -1,17 +1,10 @@ package de.hysky.skyblocker.skyblock.dungeon; -import java.util.ArrayList; -import java.util.List; - -import org.joml.Intersectiond; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import it.unimi.dsi.fastutil.objects.ObjectDoublePair; import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.utils.Utils; import de.hysky.skyblocker.utils.render.RenderHelper; import de.hysky.skyblocker.utils.scheduler.Scheduler; +import it.unimi.dsi.fastutil.objects.ObjectDoublePair; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; @@ -22,9 +15,17 @@ import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.mob.CreeperEntity; import net.minecraft.predicate.entity.EntityPredicates; +import net.minecraft.util.DyeColor; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; +import org.joml.Intersectiond; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; public class CreeperBeams { @@ -32,11 +33,12 @@ public class CreeperBeams { // "missing, this palette looks like you stole it from a 2018 bootstrap webapp!" private static final float[][] COLORS = { - { 0.33f, 1f, 1f }, - { 1f, 0.33f, 0.33f }, - { 1f, 0.66f, 0f }, - { 1f, 0.33f, 1f }, + DyeColor.LIGHT_BLUE.getColorComponents(), + DyeColor.PINK.getColorComponents(), + DyeColor.ORANGE.getColorComponents(), + DyeColor.MAGENTA.getColorComponents(), }; + private static final float[] LIME_COLOR_COMPONENTS = DyeColor.LIME.getColorComponents(); private static final int FLOOR_Y = 68; private static final int BASE_Y = 74; @@ -80,8 +82,8 @@ public class CreeperBeams { return; } Vec3d creeperPos = new Vec3d(base.getX() + 0.5, BASE_Y + 3.5, base.getZ() + 0.5); - ArrayList targets = findTargets(player, world, base); - beams = findLines(player, world, creeperPos, targets); + ArrayList targets = findTargets(world, base); + beams = findLines(creeperPos, targets); } // update the beam states @@ -102,7 +104,7 @@ public class CreeperBeams { player.getBoundingBox().expand(50D), EntityPredicates.VALID_ENTITY); - if (creepers.size() == 0) { + if (creepers.isEmpty()) { return null; } @@ -121,23 +123,22 @@ public class CreeperBeams { } // find the sea lanterns (and the ONE prismarine ty hypixel) in the room - private static ArrayList findTargets(ClientPlayerEntity player, ClientWorld world, BlockPos basePos) { + private static ArrayList findTargets(ClientWorld world, BlockPos basePos) { ArrayList targets = new ArrayList<>(); BlockPos start = new BlockPos(basePos.getX() - 15, BASE_Y + 12, basePos.getZ() - 15); BlockPos end = new BlockPos(basePos.getX() + 16, FLOOR_Y, basePos.getZ() + 16); - for (BlockPos bp : BlockPos.iterate(start, end)) { - if (isTarget(world, bp)) { - targets.add(new BlockPos(bp)); + for (BlockPos pos : BlockPos.iterate(start, end)) { + if (isTarget(world, pos)) { + targets.add(new BlockPos(pos)); } } return targets; } // generate lines between targets and finally find the solution - private static ArrayList findLines(ClientPlayerEntity player, ClientWorld world, Vec3d creeperPos, - ArrayList targets) { + private static ArrayList findLines(Vec3d creeperPos, ArrayList targets) { ArrayList> allLines = new ArrayList<>(); @@ -157,7 +158,7 @@ public class CreeperBeams { // this feels a bit heavy-handed, but it works for now. ArrayList result = new ArrayList<>(); - allLines.sort((a, b) -> Double.compare(a.rightDouble(), b.rightDouble())); + allLines.sort(Comparator.comparingDouble(ObjectDoublePair::rightDouble)); while (result.size() < 4 && !allLines.isEmpty()) { Beam solution = allLines.get(0).left(); @@ -179,7 +180,7 @@ public class CreeperBeams { private static void render(WorldRenderContext wrc) { // don't render if solved or disabled - if (solved || !SkyblockerConfigManager.get().locations.dungeons.creepersolver) { + if (solved || !SkyblockerConfigManager.get().locations.dungeons.creeperSolver) { return; } @@ -241,9 +242,9 @@ public class CreeperBeams { RenderHelper.renderOutline(wrc, outlineTwo, color, 3); RenderHelper.renderLinesFromPoints(wrc, line, color, 1, 2); } else { - RenderHelper.renderOutline(wrc, outlineOne, new float[] { 0.33f, 1f, 0.33f }, 1); - RenderHelper.renderOutline(wrc, outlineTwo, new float[] { 0.33f, 1f, 0.33f }, 1); - RenderHelper.renderLinesFromPoints(wrc, line, new float[] { 0.33f, 1f, 0.33f }, 0.75f, 1); + RenderHelper.renderOutline(wrc, outlineOne, LIME_COLOR_COMPONENTS, 1); + RenderHelper.renderOutline(wrc, outlineTwo, LIME_COLOR_COMPONENTS, 1); + RenderHelper.renderLinesFromPoints(wrc, line, LIME_COLOR_COMPONENTS, 0.75f, 1); } } } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonBlaze.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonBlaze.java index 044949db..cfb16b4d 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonBlaze.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonBlaze.java @@ -106,7 +106,7 @@ public class DungeonBlaze { */ public static void blazeRenderer(WorldRenderContext wrc) { try { - if (highestBlaze != null && lowestBlaze != null && highestBlaze.isAlive() && lowestBlaze.isAlive() && SkyblockerConfigManager.get().locations.dungeons.blazesolver) { + if (highestBlaze != null && lowestBlaze != null && highestBlaze.isAlive() && lowestBlaze.isAlive() && SkyblockerConfigManager.get().locations.dungeons.blazeSolver) { if (highestBlaze.getY() < 69) { renderBlazeOutline(highestBlaze, nextHighestBlaze, wrc); } diff --git a/src/main/resources/assets/skyblocker/lang/de_de.json b/src/main/resources/assets/skyblocker/lang/de_de.json index dd8de99e..5fc389ee 100644 --- a/src/main/resources/assets/skyblocker/lang/de_de.json +++ b/src/main/resources/assets/skyblocker/lang/de_de.json @@ -14,9 +14,9 @@ "text.autoconfig.skyblocker.option.locations.dungeons": "Dungeons", "text.autoconfig.skyblocker.option.locations.dungeons.enableMap": "Karte aktivieren", "text.autoconfig.skyblocker.option.locations.dungeons.solveThreeWeirdos": "Drei Verrückte Rätsel lösen", - "text.autoconfig.skyblocker.option.locations.dungeons.blazesolver": "Blaze Rätsel lösen", - "text.autoconfig.skyblocker.option.locations.dungeons.creepersolver": "Creeper Beams lösen", - "text.autoconfig.skyblocker.option.locations.dungeons.creepersolver.@Tooltip": "Zeigt an, welche Strahlen die besten sind und welche Ziele man dafür treffen muss.", + "text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver": "Blaze Rätsel lösen", + "text.autoconfig.skyblocker.option.locations.dungeons.creeperSolver": "Creeper Beams lösen", + "text.autoconfig.skyblocker.option.locations.dungeons.creeperSolver.@Tooltip": "Zeigt an, welche Strahlen die besten sind und welche Ziele man dafür treffen muss.", "text.autoconfig.skyblocker.option.locations.dungeons.solveTrivia": "Rätsel lösen", "text.autoconfig.skyblocker.option.locations.dungeons.terminals": "Terminal Löser", "text.autoconfig.skyblocker.option.locations.dungeons.terminals.solveColor": "Wähle die richtige Farbe", diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 69f79359..3d0c010f 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -265,10 +265,10 @@ "text.autoconfig.skyblocker.option.locations.dungeons.starredMobGlow": "Starred Mob Glow", "text.autoconfig.skyblocker.option.locations.dungeons.starredMobGlow.@Tooltip": "Applies the glowing effect to starred mobs that are visible.", "text.autoconfig.skyblocker.option.locations.dungeons.solveThreeWeirdos": "Solve Three Weirdos Puzzle", - "text.autoconfig.skyblocker.option.locations.dungeons.blazesolver": "Solve Blaze Puzzle", - "text.autoconfig.skyblocker.option.locations.dungeons.blazesolver.@Tooltip": "Boxes the correct blaze in green, also draws a line to and boxes the next blaze to kill in white.", - "text.autoconfig.skyblocker.option.locations.dungeons.creepersolver": "Solve Creeper Beams Puzzle", - "text.autoconfig.skyblocker.option.locations.dungeons.creepersolver.@Tooltip": "Highlights the best beams to make and the targets to hit.", + "text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver": "Solve Blaze Puzzle", + "text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver.@Tooltip": "Boxes the correct blaze in green, also draws a line to and boxes the next blaze to kill in white.", + "text.autoconfig.skyblocker.option.locations.dungeons.creeperSolver": "Solve Creeper Beams Puzzle", + "text.autoconfig.skyblocker.option.locations.dungeons.creeperSolver.@Tooltip": "Highlights the best beams to make and the targets to hit.", "text.autoconfig.skyblocker.option.locations.dungeons.solveTrivia": "Solve Trivia Puzzle", "text.autoconfig.skyblocker.option.locations.dungeons.solveTicTacToe": "Solve Tic Tac Toe Puzzle", "text.autoconfig.skyblocker.option.locations.dungeons.solveTicTacToe.@Tooltip": "Puts a red box around the next best move for you to make!", diff --git a/src/main/resources/assets/skyblocker/lang/es_es.json b/src/main/resources/assets/skyblocker/lang/es_es.json index 5b2a9807..faa77b85 100644 --- a/src/main/resources/assets/skyblocker/lang/es_es.json +++ b/src/main/resources/assets/skyblocker/lang/es_es.json @@ -75,7 +75,7 @@ "text.autoconfig.skyblocker.option.locations.dungeons.enableMap": "Habilitar Mapa", "text.autoconfig.skyblocker.option.locations.dungeons.mapScaling": "Escala del Mapa", "text.autoconfig.skyblocker.option.locations.dungeons.solveThreeWeirdos": "Resuelve el Acertijo de \"Los Tres Chiflados\"", - "text.autoconfig.skyblocker.option.locations.dungeons.blazesolver": "Resuelve el Acertijo del Blaze", + "text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver": "Resuelve el Acertijo del Blaze", "text.autoconfig.skyblocker.option.locations.dungeons.solveTrivia": "Resuelve el Acertijo de Trivia", "text.autoconfig.skyblocker.option.locations.dwarvenMines": "Minas Dwarven", "text.autoconfig.skyblocker.option.locations.dwarvenMines.enableDrillFuel": "Habilitar Combustible del Taladro", diff --git a/src/main/resources/assets/skyblocker/lang/fr_fr.json b/src/main/resources/assets/skyblocker/lang/fr_fr.json index a2084fc2..8da7809a 100644 --- a/src/main/resources/assets/skyblocker/lang/fr_fr.json +++ b/src/main/resources/assets/skyblocker/lang/fr_fr.json @@ -39,7 +39,7 @@ "text.autoconfig.skyblocker.option.locations.dungeons.croesusHelper.@Tooltip": "Griser les coffres qui ont déjà été ouverts.", "text.autoconfig.skyblocker.option.locations.dungeons.enableMap": "Activer la carte", "text.autoconfig.skyblocker.option.locations.dungeons.solveThreeWeirdos": "Résoudre le puzzle des trois PNJ « Three Weirdos »", - "text.autoconfig.skyblocker.option.locations.dungeons.blazesolver": "Résoudre le puzzle des blazes « Higher or Lower »", + "text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver": "Résoudre le puzzle des blazes « Higher or Lower »", "text.autoconfig.skyblocker.option.locations.dungeons.solveTrivia": "Résoudre le quiz", "text.autoconfig.skyblocker.option.locations.dungeons.terminals": "Solveurs des terminaux", "text.autoconfig.skyblocker.option.locations.dungeons.terminals.solveColor": "Résoudre le puzzle des couleurs « Color »", diff --git a/src/main/resources/assets/skyblocker/lang/id_id.json b/src/main/resources/assets/skyblocker/lang/id_id.json index 90c0a281..52a6f9bb 100644 --- a/src/main/resources/assets/skyblocker/lang/id_id.json +++ b/src/main/resources/assets/skyblocker/lang/id_id.json @@ -9,7 +9,7 @@ "text.autoconfig.skyblocker.option.locations.dungeons": "Dungeons", "text.autoconfig.skyblocker.option.locations.dungeons.enableMap": "Aktifkan Peta", "text.autoconfig.skyblocker.option.locations.dungeons.solveThreeWeirdos": "Pecahkan Teka Teki \"Tiga Orang Aneh\"", - "text.autoconfig.skyblocker.option.locations.dungeons.blazesolver": "Pecahkan Teka Teki \"Blaze\"", + "text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver": "Pecahkan Teka Teki \"Blaze\"", "text.autoconfig.skyblocker.category.messages": "Pesan", "text.autoconfig.skyblocker.option.messages.hideAbility": "Sembunyikan Cooldown Kemampuan", "text.autoconfig.skyblocker.option.messages.hideHeal": "Sembunyikan Pesan Penyembuhan", diff --git a/src/main/resources/assets/skyblocker/lang/ja_jp.json b/src/main/resources/assets/skyblocker/lang/ja_jp.json index 9a4b7a1d..a0456936 100644 --- a/src/main/resources/assets/skyblocker/lang/ja_jp.json +++ b/src/main/resources/assets/skyblocker/lang/ja_jp.json @@ -36,7 +36,7 @@ "text.autoconfig.skyblocker.option.locations.dungeons": "ダンジョン", "text.autoconfig.skyblocker.option.locations.dungeons.enableMap": "ダンジョンのマップ表示を有効にする", "text.autoconfig.skyblocker.option.locations.dungeons.solveThreeWeirdos": "嘘つきを当てるパズルのソルバー", - "text.autoconfig.skyblocker.option.locations.dungeons.blazesolver": "ブレイズパズルのソルバー", + "text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver": "ブレイズパズルのソルバー", "text.autoconfig.skyblocker.option.locations.dungeons.solveTrivia": "クイズのソルバー", "text.autoconfig.skyblocker.option.locations.dungeons.terminals": "F7のターミナルソルバー", "text.autoconfig.skyblocker.option.locations.dungeons.terminals.solveColor": "select Coloredのソルバー", diff --git a/src/main/resources/assets/skyblocker/lang/ko_kr.json b/src/main/resources/assets/skyblocker/lang/ko_kr.json index cfb4e556..4cfbab47 100644 --- a/src/main/resources/assets/skyblocker/lang/ko_kr.json +++ b/src/main/resources/assets/skyblocker/lang/ko_kr.json @@ -148,7 +148,7 @@ "text.autoconfig.skyblocker.option.locations.dungeons.enableMap": "지도 활성화", "text.autoconfig.skyblocker.option.locations.dungeons.mapScaling": "지도 크기", "text.autoconfig.skyblocker.option.locations.dungeons.solveThreeWeirdos": "Three Weirdos 퍼즐 해결", - "text.autoconfig.skyblocker.option.locations.dungeons.blazesolver": "블레이즈 퍼즐 해결", + "text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver": "블레이즈 퍼즐 해결", "text.autoconfig.skyblocker.option.locations.dungeons.solveTrivia": "Trivia 퍼즐 해결", "text.autoconfig.skyblocker.option.locations.dungeons.terminals": "터미널 해결", "text.autoconfig.skyblocker.option.locations.dungeons.terminals.solveColor": "색상 선택 해결", diff --git a/src/main/resources/assets/skyblocker/lang/nb_no.json b/src/main/resources/assets/skyblocker/lang/nb_no.json index 897379c2..e44d492f 100644 --- a/src/main/resources/assets/skyblocker/lang/nb_no.json +++ b/src/main/resources/assets/skyblocker/lang/nb_no.json @@ -87,7 +87,7 @@ "text.autoconfig.skyblocker.option.quickNav.button10.clickEvent": "Klikk hendelse", "text.autoconfig.skyblocker.option.quickNav.button12.item": "Gjenstand", "text.autoconfig.skyblocker.option.general.itemList.enableItemList": "Aktiver gjenstad liste", - "text.autoconfig.skyblocker.option.locations.dungeons.blazesolver": "Løs Blaze-puslespillet", + "text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver": "Løs Blaze-puslespillet", "text.autoconfig.skyblocker.option.quickNav.button5.uiTitle": "UI Tittel", "text.autoconfig.skyblocker.option.quickNav.button5.clickEvent": "Klikk hendelse", "text.autoconfig.skyblocker.option.quickNav.button6": "Knapp 6", diff --git a/src/main/resources/assets/skyblocker/lang/ru_ru.json b/src/main/resources/assets/skyblocker/lang/ru_ru.json index e6fa0600..5ef92494 100644 --- a/src/main/resources/assets/skyblocker/lang/ru_ru.json +++ b/src/main/resources/assets/skyblocker/lang/ru_ru.json @@ -9,7 +9,7 @@ "text.autoconfig.skyblocker.option.locations.dungeons": "Dungeons (Подземелья)", "text.autoconfig.skyblocker.option.locations.dungeons.enableMap": "Включить Карту", "text.autoconfig.skyblocker.option.locations.dungeons.solveThreeWeirdos": "Решать Головоломку Three Weirdos", - "text.autoconfig.skyblocker.option.locations.dungeons.blazesolver": "Решать Головоломку Blaze", + "text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver": "Решать Головоломку Blaze", "text.autoconfig.skyblocker.option.locations.dungeons.solveTrivia": "Решать Головоломку Trivia", "text.autoconfig.skyblocker.option.locations.dwarvenMines": "Гномьи Шахты", "text.autoconfig.skyblocker.option.locations.dwarvenMines.enableDrillFuel": "Показывать Топливо Дрели", diff --git a/src/main/resources/assets/skyblocker/lang/zh_cn.json b/src/main/resources/assets/skyblocker/lang/zh_cn.json index d9d8d180..d322b371 100644 --- a/src/main/resources/assets/skyblocker/lang/zh_cn.json +++ b/src/main/resources/assets/skyblocker/lang/zh_cn.json @@ -66,7 +66,7 @@ "text.autoconfig.skyblocker.option.locations.dungeons.croesusHelper.@Tooltip": "将打开过的箱子标记为灰色。", "text.autoconfig.skyblocker.option.locations.dungeons.enableMap": "启用地牢地图", "text.autoconfig.skyblocker.option.locations.dungeons.solveThreeWeirdos": "解决三怪人迷题", - "text.autoconfig.skyblocker.option.locations.dungeons.blazesolver": "烈焰人迷题助手", + "text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver": "烈焰人迷题助手", "text.autoconfig.skyblocker.option.locations.dungeons.solveTrivia": "常识问答谜题助手", "text.autoconfig.skyblocker.option.locations.dungeons.terminals": "终端助手", "text.autoconfig.skyblocker.option.locations.dungeons.terminals.solveColor": "选色终端助手", @@ -227,7 +227,7 @@ "text.autoconfig.skyblocker.option.general.shortcuts.enableCommandArgShortcuts": "启用带参命令别名", "text.autoconfig.skyblocker.option.general.tabHud.nameSorting": "玩家名排列顺序", "text.autoconfig.skyblocker.option.general.etherwarpOverlay": "Etherwarp 技能目标位置显示", - "text.autoconfig.skyblocker.option.locations.dungeons.blazesolver.@Tooltip": "以绿色边框标记正确的烈焰人,并将下一个烈焰人以白色线条与边框一同标记.", + "text.autoconfig.skyblocker.option.locations.dungeons.blazeSolver.@Tooltip": "以绿色边框标记正确的烈焰人,并将下一个烈焰人以白色线条与边框一同标记.", "text.autoconfig.skyblocker.option.general.tabHud.plainPlayerNames.@Tooltip": "开启后在公共岛屿显示玩家名时不显示任何特殊效果。", "text.autoconfig.skyblocker.option.messages.hideShowOff.@Tooltip": "过滤来自 /show 命令的消息", "text.autoconfig.skyblocker.option.locations.dungeons.starredMobGlow": "使星标怪物发光", -- cgit From 87f8ee2c0be3d87f800fa09064ea80de61812970 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sat, 14 Oct 2023 18:46:43 -0400 Subject: Fix indents --- .../hysky/skyblocker/config/SkyblockerConfig.java | 26 +++++++++++----------- .../config/categories/DungeonsCategory.java | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/main') diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index b673a9db..189c6af7 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -47,8 +47,8 @@ public class SkyblockerConfig { /* REGEX Explanation * "Pets" : simple match on letters - * "(?: \\(\\d+\\/\\d+\\))?" : optional match on the non-capturing group for the page in the format " ($number/$number)" - */ + * "(?: \\(\\d+\\/\\d+\\))?" : optional match on the non-capturing group for the page in the format " ($number/$number)" + */ @SerialEntry public QuickNavItem button3 = new QuickNavItem(true, new ItemData("bone"), "Pets(:? \\(\\d+\\/\\d+\\))?", "/pets"); @@ -332,16 +332,16 @@ public class SkyblockerConfig { public boolean enableCommandArgShortcuts = true; } - public static class QuiverWarning { - @SerialEntry - public boolean enableQuiverWarning = true; - - @SerialEntry - public boolean enableQuiverWarningInDungeons = true; - - @SerialEntry - public boolean enableQuiverWarningAfterDungeon = true; - } + public static class QuiverWarning { + @SerialEntry + public boolean enableQuiverWarning = true; + + @SerialEntry + public boolean enableQuiverWarningInDungeons = true; + + @SerialEntry + public boolean enableQuiverWarningAfterDungeon = true; + } public static class Hitbox { @SerialEntry @@ -528,7 +528,7 @@ public class SkyblockerConfig { @SerialEntry public boolean blazeSolver = true; - @SerialEntry + @SerialEntry public boolean creeperSolver = true; @SerialEntry diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java index 066d8b8c..a9c0c26b 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java @@ -247,7 +247,7 @@ public class DungeonsCategory { newValue -> config.locations.dungeons.blazeSolver = newValue) .controller(ConfigUtils::createBooleanController) .build()) - .option(Option.createBuilder() + .option(Option.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.creeperSolver")) .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.creeperSolver.@Tooltip"))) .binding(defaults.locations.dungeons.creeperSolver, -- cgit