Skip to content

Commit

Permalink
Add a click sound when casting tables swap slots (#4880)
Browse files Browse the repository at this point in the history
Not the best solution, but honestly don't have a better one
  • Loading branch information
KnightMiner committed Sep 4, 2022
1 parent 8db3a55 commit a09a0f9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/java/slimeknights/tconstruct/common/Sounds.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public enum Sounds {
SAW("little_saw"),
ITEM_FRAME_CLICK,
CASTING_COOLS,
CASTING_CLICKS,

// earth crystals
EARTH_CRYSTAL_CHIME("block.earth_crystal.chime"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ public void swap() {
ItemStack output = getItem(OUTPUT);
setItem(OUTPUT, getItem(INPUT));
setItem(INPUT, output);
if (level != null) {
level.playSound(null, getBlockPos(), Sounds.CASTING_CLICKS.getSound(), SoundSource.BLOCKS, 1.0f, 1.0f);
}
}
}

Expand Down Expand Up @@ -293,13 +296,14 @@ private void serverTick(Level level, BlockPos pos) {
setItem(OUTPUT, getItem(INPUT));
}
setItem(INPUT, output);
level.playSound(null, getBlockPos(), Sounds.CASTING_CLICKS.getSound(), SoundSource.BLOCKS, 1.0f, 1.0f);
} else {
if (currentRecipe.isConsumed()) {
setItem(INPUT, ItemStack.EMPTY);
}
setItem(OUTPUT, output);
}
level.playSound(null, pos, Sounds.CASTING_COOLS.getSound(), SoundSource.AMBIENT, 0.5f, 4f);
level.playSound(null, pos, Sounds.CASTING_COOLS.getSound(), SoundSource.BLOCKS, 0.5f, 4f);
reset();
} else {
updateAnalogSignal();
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/tconstruct/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -2447,6 +2447,7 @@
"subtitles.tconstruct.little_saw": "Saw used",
"subtitles.tconstruct.item_frame_click": "Item Frame clock clicks",
"subtitles.tconstruct.casting_cools": "Cast item cools",
"subtitles.tconstruct.casting.click": "Casting block clicks",

"subtitles.tconstruct.slime_sling": "Slime Sling bounces",
"subtitles.tconstruct.slime_sling.teleport": "Slime Sling teleports",
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/assets/tconstruct/sounds.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
],
"subtitle": "subtitles.tconstruct.casting_cools"
},
"casting_clicks": {
"sounds": [
"random/click"
],
"subtitle": "subtitles.tconstruct.casting.click"
},

"slime_sling": {
"category": "player",
Expand Down

0 comments on commit a09a0f9

Please sign in to comment.