Skip to content

Commit

Permalink
Fix mother destruction sound
Browse files Browse the repository at this point in the history
  • Loading branch information
maxanier committed Sep 22, 2023
1 parent 8d884c0 commit 16881bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static void serverTick(Level level, BlockPos blockPos, BlockState blockSt
if (e.isFrozen && e.freezeTimer-- <= 0) {
e.unFreezeFight(level, blockPos, blockState);
}
if (!e.isFrozen && e.level != null) {
if (!e.isFrozen && e.level != null && e.isIntact()) {
if (e.level.getRandom().nextInt(50) == 0) {
e.updateFightStatus();
if (!e.bossEvent.getPlayers().isEmpty()) {
Expand All @@ -74,11 +74,15 @@ public static void serverTick(Level level, BlockPos blockPos, BlockState blockSt
if (level.getBlockState(p).getBlock() instanceof IRemainsBlock) {
level.setBlock(p, Blocks.AIR.defaultBlockState(), 3);
ModParticles.spawnParticlesServer(level, new DustParticleOptions(new Vector3f(0.7f, 0.7f, 0.7f), 1), p.getX() + 0.5, p.getY() + 0.5, p.getZ() + 0.5f, 20, 0.3, 0.3, 0.3, 0.01);
e.level.playSound(null, p, ModSounds.REMAINS_DESTROYED.get(), SoundSource.BLOCKS, 0.2f, 1f);
}
}
} else {
//Destruction complete
e.destructionTimer = -1;
if (e.level != null) {
e.level.playSound(null, blockPos, ModSounds.MOTHER_DEATH.get(), SoundSource.BLOCKS, 2f, 0.8f);
}
}
}
}
Expand Down Expand Up @@ -210,9 +214,6 @@ private MotherTreeStructure getTreeStructure(boolean forceRefresh) {
private void initiateDestruction() {
this.getTreeStructure(true);
this.destructionTimer = 1;
if (this.level != null) {
this.level.playSound(null, worldPosition, ModSounds.MOTHER_DEATH.get(), SoundSource.BLOCKS, 1f, 1f);
}
}

private void unFreezeFight(Level level, BlockPos blockPos, BlockState blockState) {
Expand Down
Binary file not shown.

0 comments on commit 16881bb

Please sign in to comment.