diff options
Diffstat (limited to 'src/main/java/de/hysky')
3 files changed, 31 insertions, 18 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/diana/MythologicalRitual.java b/src/main/java/de/hysky/skyblocker/skyblock/diana/MythologicalRitual.java index c407e911..e2962702 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/diana/MythologicalRitual.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/diana/MythologicalRitual.java @@ -6,6 +6,7 @@ import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.utils.ItemUtils; import de.hysky.skyblocker.utils.Utils; import de.hysky.skyblocker.utils.render.RenderHelper; +import de.hysky.skyblocker.utils.waypoint.Waypoint; import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; @@ -49,7 +50,7 @@ public class MythologicalRitual { private static final Map<BlockPos, GriffinBurrow> griffinBurrows = new HashMap<>(); @Nullable private static BlockPos lastDugBurrowPos; - private static GriffinBurrow previousBurrow = new GriffinBurrow(); + private static GriffinBurrow previousBurrow = new GriffinBurrow(BlockPos.ORIGIN); public static void init() { WorldRenderEvents.AFTER_TRANSLUCENT.register(MythologicalRitual::render); @@ -82,7 +83,7 @@ public class MythologicalRitual { if (MinecraftClient.getInstance().world == null || !MinecraftClient.getInstance().world.getBlockState(pos).isOf(Blocks.GRASS_BLOCK)) { return; } - GriffinBurrow burrow = griffinBurrows.computeIfAbsent(pos, pos1 -> new GriffinBurrow()); + GriffinBurrow burrow = griffinBurrows.computeIfAbsent(pos, GriffinBurrow::new); if (ParticleTypes.CRIT.equals(packet.getParameters().getType())) burrow.critParticle++; if (ParticleTypes.ENCHANT.equals(packet.getParameters().getType())) burrow.enchantParticle++; if (burrow.critParticle >= 5 && burrow.enchantParticle >= 5 && burrow.confirmed == TriState.FALSE) { @@ -133,10 +134,9 @@ public class MythologicalRitual { public static void render(WorldRenderContext context) { if (isActive()) { - for (Map.Entry<BlockPos, GriffinBurrow> burrowEntry : griffinBurrows.entrySet()) { - GriffinBurrow burrow = burrowEntry.getValue(); - if (burrow.confirmed == TriState.TRUE) { - RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, burrowEntry.getKey(), ORANGE_COLOR_COMPONENTS, 0.25F); + for (GriffinBurrow burrow : griffinBurrows.values()) { + if (burrow.shouldRender()) { + burrow.render(context); } if (burrow.confirmed != TriState.FALSE) { if (burrow.nextBurrowPlane != null) { @@ -186,7 +186,7 @@ public class MythologicalRitual { return SkyblockerConfigManager.get().general.mythologicalRitual.enableMythologicalRitualHelper && Utils.getLocationRaw().equals("hub"); } - private static class GriffinBurrow { + private static class GriffinBurrow extends Waypoint { private int critParticle; private int enchantParticle; private TriState confirmed = TriState.FALSE; @@ -196,9 +196,18 @@ public class MythologicalRitual { private Vec3d[] echoBurrowDirection; private Vec3d[] echoBurrowPlane; + private GriffinBurrow(BlockPos pos) { + super(pos, Type.WAYPOINT, ORANGE_COLOR_COMPONENTS, 0.25F); + } + private void init() { confirmed = TriState.TRUE; regression.clear(); } + + @Override + public boolean shouldRender() { + return super.shouldRender() && confirmed == TriState.TRUE; + } } } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java index 72cc5ad8..ab6d6f7d 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java @@ -44,7 +44,7 @@ public class SecretWaypoint extends Waypoint { } @Override - protected boolean shouldRender() { + public boolean shouldRender() { return super.shouldRender() && category.isEnabled(); } @@ -68,7 +68,7 @@ public class SecretWaypoint extends Waypoint { * Renders the secret waypoint, including a filled cube, a beacon beam, the name, and the distance from the player. */ @Override - protected void render(WorldRenderContext context) { + public void render(WorldRenderContext context) { //TODO In the future, shrink the box for wither essence and items so its more realistic super.render(context); diff --git a/src/main/java/de/hysky/skyblocker/utils/waypoint/Waypoint.java b/src/main/java/de/hysky/skyblocker/utils/waypoint/Waypoint.java index 2cb37e6b..26190d60 100644 --- a/src/main/java/de/hysky/skyblocker/utils/waypoint/Waypoint.java +++ b/src/main/java/de/hysky/skyblocker/utils/waypoint/Waypoint.java @@ -11,18 +11,22 @@ public class Waypoint { protected static final float DEFAULT_HIGHLIGHT_ALPHA = 0.5f; protected static final float DEFAULT_LINE_WIDTH = 5f; protected final BlockPos pos; - protected final Box box; - protected final Supplier<Type> typeSupplier; - protected final float[] colorComponents; - protected final float alpha; - protected final float lineWidth; - protected final boolean throughWalls; - protected boolean shouldRender; + private final Box box; + private final Supplier<Type> typeSupplier; + private final float[] colorComponents; + private final float alpha; + private final float lineWidth; + private final boolean throughWalls; + private boolean shouldRender; protected Waypoint(BlockPos pos, Supplier<Type> typeSupplier, float[] colorComponents) { this(pos, typeSupplier, colorComponents, DEFAULT_HIGHLIGHT_ALPHA); } + protected Waypoint(BlockPos pos, Type type, float[] colorComponents, float alpha) { + this(pos, () -> type, colorComponents, alpha); + } + protected Waypoint(BlockPos pos, Supplier<Type> typeSupplier, float[] colorComponents, float alpha) { this(pos, typeSupplier, colorComponents, alpha, DEFAULT_LINE_WIDTH); } @@ -46,7 +50,7 @@ public class Waypoint { this.shouldRender = shouldRender; } - protected boolean shouldRender() { + public boolean shouldRender() { return shouldRender; } @@ -58,7 +62,7 @@ public class Waypoint { this.shouldRender = true; } - protected void render(WorldRenderContext context) { + public void render(WorldRenderContext context) { switch (typeSupplier.get()) { case WAYPOINT -> RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, colorComponents, alpha); case OUTLINED_WAYPOINT -> { |