forked from jzitnik/twodcraft
feat(sounds): Added sounds
This currently doesn't work idk why. Will fix later.
This commit is contained in:
parent
94abddef81
commit
8c161180e6
@ -23,6 +23,7 @@ import cz.jzitnik.game.config.Configuration;
|
|||||||
import cz.jzitnik.game.core.autotransient.AutoTransientSupport;
|
import cz.jzitnik.game.core.autotransient.AutoTransientSupport;
|
||||||
import cz.jzitnik.game.core.autotransient.initilizers.GameMiningInitializer;
|
import cz.jzitnik.game.core.autotransient.initilizers.GameMiningInitializer;
|
||||||
import cz.jzitnik.game.core.autotransient.initilizers.GameWindowInitializer;
|
import cz.jzitnik.game.core.autotransient.initilizers.GameWindowInitializer;
|
||||||
|
import cz.jzitnik.game.core.sound.SoundKey;
|
||||||
import cz.jzitnik.game.ui.Window;
|
import cz.jzitnik.game.ui.Window;
|
||||||
import cz.jzitnik.game.ui.Inventory;
|
import cz.jzitnik.game.ui.Inventory;
|
||||||
import cz.jzitnik.game.handlers.rightclick.RightClickHandlerProvider;
|
import cz.jzitnik.game.handlers.rightclick.RightClickHandlerProvider;
|
||||||
@ -157,6 +158,7 @@ public class Game extends AutoTransientSupport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Block> mobs = world[y][x].stream().filter(Block::isMob).toList();
|
List<Block> mobs = world[y][x].stream().filter(Block::isMob).toList();
|
||||||
|
gameStates.dependencies.sound.playSound(configuration, SoundKey.HIT, null);
|
||||||
|
|
||||||
for (Block mob : mobs) {
|
for (Block mob : mobs) {
|
||||||
int dealDamage = inventory.getItemInHand().map(Item::getDealDamage).orElse(1);
|
int dealDamage = inventory.getItemInHand().map(Item::getDealDamage).orElse(1);
|
||||||
|
@ -10,4 +10,5 @@ public enum SoundKey {
|
|||||||
WOOD,
|
WOOD,
|
||||||
|
|
||||||
HURT,
|
HURT,
|
||||||
|
HIT,
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package cz.jzitnik.game.core.sound.registry;
|
||||||
|
|
||||||
|
import cz.jzitnik.game.annotations.SoundRegistry;
|
||||||
|
import cz.jzitnik.game.core.sound.SoundKey;
|
||||||
|
|
||||||
|
@SoundRegistry(key = SoundKey.HIT, resourceLocation = {
|
||||||
|
"hit/hit1.ogg",
|
||||||
|
"hit/hit2.ogg",
|
||||||
|
"hit/hit3.ogg",
|
||||||
|
"hit/hit4.ogg",
|
||||||
|
})
|
||||||
|
public class HitSound {
|
||||||
|
}
|
@ -7,9 +7,14 @@ import cz.jzitnik.game.annotations.BreakableByWater;
|
|||||||
import cz.jzitnik.game.annotations.BreaksByPlace;
|
import cz.jzitnik.game.annotations.BreaksByPlace;
|
||||||
import cz.jzitnik.game.annotations.BreaksFalling;
|
import cz.jzitnik.game.annotations.BreaksFalling;
|
||||||
import cz.jzitnik.game.annotations.CustomDrop;
|
import cz.jzitnik.game.annotations.CustomDrop;
|
||||||
|
import cz.jzitnik.game.annotations.MineSound;
|
||||||
import cz.jzitnik.game.annotations.PlaceOnSolid;
|
import cz.jzitnik.game.annotations.PlaceOnSolid;
|
||||||
|
import cz.jzitnik.game.annotations.PlaceSound;
|
||||||
|
import cz.jzitnik.game.core.sound.SoundKey;
|
||||||
import cz.jzitnik.game.entities.Block;
|
import cz.jzitnik.game.entities.Block;
|
||||||
|
|
||||||
|
@MineSound(SoundKey.GRASS)
|
||||||
|
@PlaceSound(SoundKey.GRASS)
|
||||||
@PlaceOnSolid
|
@PlaceOnSolid
|
||||||
@BreakableByWater
|
@BreakableByWater
|
||||||
@BreaksFalling
|
@BreaksFalling
|
||||||
|
BIN
src/main/resources/sounds/hit/hit1.ogg
Normal file
BIN
src/main/resources/sounds/hit/hit1.ogg
Normal file
Binary file not shown.
BIN
src/main/resources/sounds/hit/hit2.ogg
Normal file
BIN
src/main/resources/sounds/hit/hit2.ogg
Normal file
Binary file not shown.
BIN
src/main/resources/sounds/hit/hit3.ogg
Normal file
BIN
src/main/resources/sounds/hit/hit3.ogg
Normal file
Binary file not shown.
BIN
src/main/resources/sounds/hit/hit4.ogg
Normal file
BIN
src/main/resources/sounds/hit/hit4.ogg
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user