Skip to content

Commit

Permalink
chore: use TyphonSounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex4386 committed Jun 20, 2024
1 parent 8616d2a commit 9134f55
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.alex4386.plugin.typhon.volcano.dome;

import me.alex4386.plugin.typhon.TyphonPlugin;
import me.alex4386.plugin.typhon.TyphonSounds;
import me.alex4386.plugin.typhon.TyphonUtils;
import me.alex4386.plugin.typhon.volcano.VolcanoComposition;
import me.alex4386.plugin.typhon.volcano.bomb.VolcanoBombListener;
Expand All @@ -10,6 +11,7 @@

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.SoundCategory;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.json.simple.JSONObject;
Expand Down Expand Up @@ -143,6 +145,10 @@ public void ooze() {
this.vent.lavaFlow.flowLava(TyphonUtils.getHighestRocklikes(
TyphonUtils.getRandomBlockInRange(this.baseLocation.getBlock(), (int) distance)
).getRelative(BlockFace.UP));

if (Math.random() < 0.1) {
TyphonSounds.LAVA_FLOW_FRAGMENTING.play(this.baseLocation.getBlock().getLocation(), SoundCategory.BLOCKS, 1, 1);
}
}

public void explode() {
Expand All @@ -152,6 +158,8 @@ public void explode() {
for (int i = 0; i < 5; i++) {
this.vent.bombs.generateRandomBomb(targetLocation);
}

TyphonSounds.DISTANT_EXPLOSION.play(targetLocation, SoundCategory.BLOCKS, 2f, 0f);
}

public JSONObject importConfig(JSONObject json) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1468,15 +1468,6 @@ private void autoFlowLava() {

int flowedBlocks = 0;
if (this.vent.erupt.getStyle().lavaMultiplier > 0) {
if (!ventBlocks.isEmpty()) {
TyphonSounds.LAVA_ERUPTION.play(
ventBlocks.get(0).getLocation(),
SoundCategory.BLOCKS,
2f,
1f
);
}

int flowableCounts = 0;
for (Block whereToFlow : whereToFlows) {
if (TyphonUtils.isBlockFlowable(whereToFlow)) {
Expand Down Expand Up @@ -1545,6 +1536,16 @@ private void autoFlowLava() {
}
}
}


if (flowedBlocks > 0) {
TyphonSounds.LAVA_ERUPTION.play(
ventBlocks.get(0).getLocation(),
SoundCategory.BLOCKS,
2f,
1f
);
}
} else if (this.vent.erupt.getStyle() == VolcanoEruptStyle.LAVA_DOME) {
int count = whereToFlows.size();
for (int i = 0; i < count; i++) {
Expand Down

0 comments on commit 9134f55

Please sign in to comment.