aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de
diff options
context:
space:
mode:
authorviciscat <51047087+viciscat@users.noreply.github.com>2024-05-15 20:26:41 +0200
committerviciscat <51047087+viciscat@users.noreply.github.com>2024-08-21 12:31:17 +0200
commit9a8591fe3f21bd889b8cc12c7d0cea3b05cdf74c (patch)
treede47a265a4297144a81f1131459e5fff4a438288 /src/main/java/de
parent7a9fbebc41d55fa0bb3275c79eaba2ba3604b916 (diff)
downloadSkyblocker-9a8591fe3f21bd889b8cc12c7d0cea3b05cdf74c.tar.gz
Skyblocker-9a8591fe3f21bd889b8cc12c7d0cea3b05cdf74c.tar.bz2
Skyblocker-9a8591fe3f21bd889b8cc12c7d0cea3b05cdf74c.zip
quick and dirty
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/waypoint/MythologicalRitual.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/waypoint/MythologicalRitual.java b/src/main/java/de/hysky/skyblocker/skyblock/waypoint/MythologicalRitual.java
index 2b064770..83546194 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/waypoint/MythologicalRitual.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/waypoint/MythologicalRitual.java
@@ -36,6 +36,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
+import org.apache.commons.math3.geometry.euclidean.twod.Line;
+import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
import org.apache.commons.math3.stat.regression.SimpleRegression;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -50,6 +52,7 @@ import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.lit
public class MythologicalRitual {
private static final Pattern GRIFFIN_BURROW_DUG = Pattern.compile("(?<message>You dug out a Griffin Burrow!|You finished the Griffin burrow chain!) \\((?<index>\\d)/4\\)");
private static final float[] ORANGE_COLOR_COMPONENTS = ColorUtils.getFloatComponents(DyeColor.ORANGE);
+ private static final float[] RED_COLOR_COMPONENTS = DyeColor.RED.getColorComponents();
private static long lastEchoTime;
private static final Map<BlockPos, GriffinBurrow> griffinBurrows = new HashMap<>();
@Nullable
@@ -109,6 +112,16 @@ public class MythologicalRitual {
if (burrow.nextBurrowLine == null) {
burrow.nextBurrowLine = new Vec3d[1001];
}
+ if (burrow.echoBurrowDirection != null && burrow.echoBurrowDirection[0] != null && burrow.echoBurrowDirection[1] != null) {
+ Vector2D p = new Vector2D(pos.getX() + 0.5, pos.getZ() + 0.5);
+ burrow.nextLine = new Line(p, p.add(new Vector2D(nextBurrowDirection.x, nextBurrowDirection.z)), 0.0001);
+ Line line = new Line(
+ new Vector2D(burrow.echoBurrowDirection[0].x, burrow.echoBurrowDirection[0].z),
+ new Vector2D(burrow.echoBurrowDirection[1].x, burrow.echoBurrowDirection[1].z),
+ 0.0001);
+ Vector2D intersection = line.intersection(burrow.nextLine);
+ burrow.estimatedPos = BlockPos.ofFloored(intersection.getX(), 100, intersection.getY());
+ }
fillLine(burrow.nextBurrowLine, Vec3d.ofCenter(pos.up()), nextBurrowDirection);
} else if (ParticleTypes.DRIPPING_LAVA.equals(packet.getParameters().getType()) && packet.getCount() == 2) {
if (System.currentTimeMillis() > lastEchoTime + 10_000) {
@@ -126,6 +139,15 @@ public class MythologicalRitual {
if (previousBurrow.echoBurrowLine == null) {
previousBurrow.echoBurrowLine = new Vec3d[1001];
}
+ if (previousBurrow.nextLine != null) {
+ Vector2D intersection = previousBurrow.nextLine.intersection(new Line(
+ new Vector2D(previousBurrow.echoBurrowDirection[0].x, previousBurrow.echoBurrowDirection[0].z),
+ new Vector2D(previousBurrow.echoBurrowDirection[1].x, previousBurrow.echoBurrowDirection[1].z),
+ 0.0001
+ ));
+ previousBurrow.estimatedPos = BlockPos.ofFloored(intersection.getX(), 100, intersection.getY());
+
+ }
fillLine(previousBurrow.echoBurrowLine, previousBurrow.echoBurrowDirection[0], echoBurrowDirection);
}
}
@@ -154,6 +176,9 @@ public class MythologicalRitual {
if (burrow.echoBurrowLine != null) {
RenderHelper.renderLinesFromPoints(context, burrow.echoBurrowLine, ORANGE_COLOR_COMPONENTS, 0.5F, 5F, false);
}
+ if (burrow.estimatedPos != null && !burrow.shouldRender()) {
+ RenderHelper.renderFilledWithBeaconBeam(context, burrow.estimatedPos, RED_COLOR_COMPONENTS, 0.5f, true);
+ }
}
}
}
@@ -216,6 +241,10 @@ public class MythologicalRitual {
private Vec3d[] echoBurrowDirection;
@Nullable
private Vec3d[] echoBurrowLine;
+ @Nullable
+ private BlockPos estimatedPos;
+ @Nullable
+ private Line nextLine; // The echo line could be stored, but it is easily computed so eh
private GriffinBurrow(BlockPos pos) {
super(pos, Type.WAYPOINT, ORANGE_COLOR_COMPONENTS, 0.25F);