aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorolim <bobq4582@gmail.com>2024-07-15 19:45:19 +0100
committerolim <bobq4582@gmail.com>2024-08-02 20:31:34 +0100
commite53e56c18788a02c1f99c226ec5905ce1958325c (patch)
tree7bede0acf24f7c29b2591c5b3a70e49d08deb191 /src/main/java
parentaa242a88b0111431aeec79bf2dc5c856a66dc805 (diff)
downloadSkyblocker-e53e56c18788a02c1f99c226ec5905ce1958325c.tar.gz
Skyblocker-e53e56c18788a02c1f99c226ec5905ce1958325c.tar.bz2
Skyblocker-e53e56c18788a02c1f99c226ec5905ce1958325c.zip
clean code
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsChestHighlighter.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsChestHighlighter.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsChestHighlighter.java
index 1103008f..8cd75428 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsChestHighlighter.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsChestHighlighter.java
@@ -14,7 +14,6 @@ import net.minecraft.network.packet.s2c.play.ParticleS2CPacket;
import net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.text.Text;
-import net.minecraft.util.Formatting;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
@@ -82,12 +81,12 @@ public class CrystalsChestHighlighter {
waitingForChest -= 1;
} else if (state.isAir() && activeChests.contains(pos)) {
currentLockCount = 0;
- activeChests.remove(pos);
+ activeChests.remove(pos);
}
}
/**
- * When a particle is spawned add that particle to active particles
+ * When a particle is spawned add that particle to active particles if correct for lock picking
*
* @param packet particle spawn packet
*/
@@ -101,18 +100,24 @@ public class CrystalsChestHighlighter {
}
/**
- * When sound is created to tell the user that they have done a stage of picking remove all old particles
+ * Updates {@link CrystalsChestHighlighter#currentLockCount} and clears {@link CrystalsChestHighlighter#activeParticles} based on lock pick related sound events.
*
* @param packet sound packet
*/
public static void onSound(PlaySoundS2CPacket packet) {
+ if (!Utils.isInCrystalHollows() || !SkyblockerConfigManager.get().mining.crystalHollows.chestHighlighter) {
+ return;
+ }
String path = packet.getSound().value().getId().getPath();
+ //lock picked sound
if (path.equals("entity.experience_orb.pickup") && packet.getPitch() == 1) {
currentLockCount += 1;
activeParticles.clear();
+ //lock pick fail sound
} else if (path.equals("entity.villager.no")) {
currentLockCount = 0;
activeParticles.clear();
+ //lock pick finish sound
} else if (path.equals("block.chest.open")) {
//set the needed lock count to the current, so we know how many locks a chest has
neededLockCount = currentLockCount;
@@ -120,7 +125,6 @@ public class CrystalsChestHighlighter {
}
}
-
/**
* If enabled, renders a box around active treasure chests, taking the color from the config.
* Additionally, calculates and displaces the highlight to indicate lock-picking spots on chests.