Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,15 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
.controller(ConfigUtils.createBooleanController())
.build())
.build())
//Power Orb Range
.option(Option.<Boolean>createBuilder()
.name(Component.translatable("skyblocker.config.helpers.showPowerOrbRange"))
.description(Component.translatable("skyblocker.config.helpers.showPowerOrbRange.@Tooltip"))
.binding(defaults.helpers.showPowerOrbRange,
() -> config.helpers.showPowerOrbRange,
newValue -> config.helpers.showPowerOrbRange = newValue)
.controller(ConfigUtils.createBooleanController())
.build())

.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
.description(Component.translatable("skyblocker.config.mining.dwarvenMines.enableCarpetHighlight.@Tooltip"))
.binding(defaults.mining.dwarvenMines.enableCarpetHighlighter,
() -> config.mining.dwarvenMines.enableCarpetHighlighter,
newValue -> config.mining.dwarvenMines.enableCarpetHighlighter = newValue)
newValue -> config.mining.dwarvenMines.enableCarpetHighlighter = newValue)
.controller(ConfigUtils.createBooleanController())
.build())
.option(Option.<Color>createBuilder()
Expand Down Expand Up @@ -185,9 +185,9 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
.binding(defaults.mining.crystalHollows.enablePowderTracker,
() -> config.mining.crystalHollows.enablePowderTracker,
newValue -> {
config.mining.crystalHollows.enablePowderTracker = newValue;
if (newValue) PowderMiningTracker.INSTANCE.recalculateAll();
})
config.mining.crystalHollows.enablePowderTracker = newValue;
if (newValue) PowderMiningTracker.INSTANCE.recalculateAll();
})
.controller(ConfigUtils.createBooleanController())
.build())
.option(ButtonOption.createBuilder()
Expand Down Expand Up @@ -343,8 +343,8 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
.name(Component.translatable("skyblocker.config.mining.glacite.fossilSolver"))
.description(Component.translatable("skyblocker.config.mining.glacite.fossilSolver.@Tooltip"))
.binding(defaults.mining.glacite.fossilSolver,
() -> config.mining.glacite.fossilSolver,
newValue -> config.mining.glacite.fossilSolver = newValue)
() -> config.mining.glacite.fossilSolver,
newValue -> config.mining.glacite.fossilSolver = newValue)
.controller(ConfigUtils.createBooleanController())
.build())
.option(Option.<Boolean>createBuilder()
Expand Down Expand Up @@ -417,7 +417,17 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.mining.blockBreakPrediction.playSound = newValue)
.controller(ConfigUtils.createBooleanController())
.build())

.build())
//Lantern Deploy Range
.option(Option.<Boolean>createBuilder()
.name(Component.translatable("skyblocker.config.mining.lanternDeployable.show"))
.description(Component.translatable("skyblocker.config.mining.lanternDeployable.show.@Tooltip"))
.binding(
defaults.mining.lanternDeployable.showDeployableRange,
() -> config.mining.lanternDeployable.showDeployableRange,
newValue -> config.mining.lanternDeployable.showDeployableRange = newValue
)
.controller(ConfigUtils.createBooleanController())
.build())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class HelperConfig {

public boolean enableAccessoriesHelperWidget = true;

public boolean showPowerOrbRange = true;

public BuildersWand buildersWand = new BuildersWand();

public MythologicalRitual mythologicalRitual = new MythologicalRitual();
Expand All @@ -47,6 +49,8 @@ public class HelperConfig {

public CenturyRaffle centuryRaffle = new CenturyRaffle();

public PowerOrbRange powerOrbRange = new PowerOrbRange();

public static class BuildersWand {
public boolean enableBuildersWandPreview = true;

Expand Down Expand Up @@ -183,4 +187,8 @@ public static class CenturyRaffle {

public boolean enableRaffleRewardHighlight = true;
}

public static class PowerOrbRange {
public boolean showPowerOrbRange = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class MiningConfig {

public Glacite glacite = new Glacite();

public LanternDeployable lanternDeployable = new LanternDeployable();

public BlockBreakPrediction blockBreakPrediction = new BlockBreakPrediction();

public static class PickobulusHelper {
Expand Down Expand Up @@ -174,6 +176,10 @@ public static class BlockBreakPrediction {

}

public static class LanternDeployable {
public boolean showDeployableRange = true;
}

/**
* @deprecated See {@link UIAndVisualsConfig.TabHudStyle}.
*/
Expand Down
78 changes: 78 additions & 0 deletions src/main/java/de/hysky/skyblocker/skyblock/LanternDeployable.java

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please find a better place to put this instead of a new module.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question is if we want to see others or not?
As on now you the lates one placed will be shown

Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package de.hysky.skyblocker.skyblock;

import de.hysky.skyblocker.annotations.Init;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.utils.render.LevelRenderExtractionCallback;
import de.hysky.skyblocker.utils.render.Renderable;
import de.hysky.skyblocker.utils.render.primitive.PrimitiveCollector;

import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.minecraft.client.Minecraft;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.decoration.ArmorStand;
import net.minecraft.world.phys.Vec3;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

public final class LanternDeployable implements Renderable {

public static final LanternDeployable INSTANCE = new LanternDeployable();

private static final float RANGE = 30f;
private static final int SEGMENTS = 128;
private static final int COLOR = 0x5500FFFF;
private static final float CIRCLE_HEIGHT = 3f;

private final List<Vec3> lanternPositions = new ArrayList<>();

@Init
public static void init() {

LevelRenderExtractionCallback.EVENT.register(INSTANCE::extractRendering);
ClientTickEvents.END_CLIENT_TICK.register(client -> {

if (client.level == null || client.player == null) {
INSTANCE.lanternPositions.clear();
return;
}
INSTANCE.findLantern();
});
}

@Override
public void extractRendering(PrimitiveCollector collector) {
if (lanternPositions.isEmpty()) return;

if (!SkyblockerConfigManager.get().mining.lanternDeployable.showDeployableRange) return;

for (Vec3 position : lanternPositions) {

Vec3 circlePosition = position.add(0, CIRCLE_HEIGHT, 0);

collector.submitCylinder(circlePosition, RANGE, 0.5f, SEGMENTS, COLOR);
}
}

private void findLantern() {
Minecraft mc = Minecraft.getInstance();
lanternPositions.clear();

for (Entity entity : mc.level.entitiesForRendering()) {
if (!(entity instanceof ArmorStand armorStand)) continue;

if (isLantern(armorStand)) {
lanternPositions.add(Vec3.atCenterOf(armorStand.blockPosition().below()));
}
}
}

private boolean isLantern(ArmorStand armorStand) {
if (!armorStand.hasCustomName()) return false;

String name = armorStand.getName().getString().replaceAll("§.", "").toLowerCase(Locale.ENGLISH);

return name.contains("lantern") || name.contains("wisp");
}
}
97 changes: 97 additions & 0 deletions src/main/java/de/hysky/skyblocker/skyblock/PowerOrbRange.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
package de.hysky.skyblocker.skyblock;

import de.hysky.skyblocker.annotations.Init;
import de.hysky.skyblocker.utils.render.LevelRenderExtractionCallback;
import de.hysky.skyblocker.utils.render.Renderable;
import de.hysky.skyblocker.utils.render.primitive.PrimitiveCollector;
import de.hysky.skyblocker.config.SkyblockerConfigManager;

import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.minecraft.client.Minecraft;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.decoration.ArmorStand;
import net.minecraft.world.phys.Vec3;

import java.util.Locale;

public final class PowerOrbRange implements Renderable {

public static final PowerOrbRange INSTANCE = new PowerOrbRange();

private static final float RANGE = 18f;
private static final float CIRCLE_HEIGHT = 2f;
private static final int SEGMENTS = 128;
private static final int COLOR = 0x5500FFFF;

private Vec3 orbPosition;

@Init
public static void init() {

LevelRenderExtractionCallback.EVENT.register(INSTANCE::extractRendering);

ClientTickEvents.END_CLIENT_TICK.register(client -> {

if (client.level == null || client.player == null) {

INSTANCE.clearPosition();
return;
}

INSTANCE.findOrb();
});
}

private void updatePosition(Vec3 pos) {
this.orbPosition = pos;
}

private void clearPosition() {
this.orbPosition = null;
}

@Override
public void extractRendering(PrimitiveCollector collector) {

if (orbPosition == null) {
return;
}

if (!SkyblockerConfigManager.get().helpers.showPowerOrbRange) {
return;
}

collector.submitCylinder(orbPosition, RANGE, 0.5f, SEGMENTS, COLOR);
}

private void findOrb() {

Minecraft mc = Minecraft.getInstance();

if (mc.level == null) return;

for (Entity entity : mc.level.entitiesForRendering()) {

if (!(entity instanceof ArmorStand armorStand)) continue;

if (isOrb(armorStand)) {

Vec3 pos = armorStand.position().add(0, CIRCLE_HEIGHT, 0);

updatePosition(pos);
return;
}
}

clearPosition();
}

private boolean isOrb(ArmorStand armorStand) {

if (!armorStand.hasCustomName()) return false;

String name = armorStand.getName().getString().replaceAll("§.", "").toLowerCase(Locale.ENGLISH);

return name.contains("radiant power orb") || name.contains("mana flux") || name.contains("manaflux") || name.contains("overflux") || name.contains("plasmaflux") || name.contains("plasma flux");
}
}