hit and place sounds

This commit is contained in:
PeytonPlayz595 2023-12-17 00:05:20 -05:00
parent 14d6b9af89
commit ec43128696
2 changed files with 8 additions and 0 deletions

View File

@ -32,6 +32,8 @@ public final class SurvivalGameMode extends GameMode
spawner = new MobSpawner(level); spawner = new MobSpawner(level);
} }
int prevHit = 0;
@Override @Override
public void hitBlock(int x, int y, int z, int side) public void hitBlock(int x, int y, int z, int side)
{ {
@ -50,6 +52,10 @@ public final class SurvivalGameMode extends GameMode
block.spawnBlockParticles(minecraft.level, x, y, z, side, minecraft.particleManager); block.spawnBlockParticles(minecraft.level, x, y, z, side, minecraft.particleManager);
hits++; hits++;
if(hits > (prevHit + 3)) {
Minecraft.getMinecraft().level.playSound(block.stepsound.name, 0.1F);
prevHit = hits;
}
if(hits == hardness + 1) if(hits == hardness + 1)
{ {
@ -64,6 +70,7 @@ public final class SurvivalGameMode extends GameMode
// TODO: I think if I don't set hits to 0 you can continue breaking from where you left off. // TODO: I think if I don't set hits to 0 you can continue breaking from where you left off.
hits = 0; hits = 0;
prevHit = hits;
hitX = x; hitX = x;
hitY = y; hitY = y;
hitZ = z; hitZ = z;

View File

@ -399,6 +399,7 @@ public class Block
public void onPlace(Level level, int x, int y, int z) public void onPlace(Level level, int x, int y, int z)
{ {
Minecraft.getMinecraft().level.playSound(stepsound.name, 0.1F);
} }
public int getTickDelay() public int getTickDelay()