add sounds to fast easy place and material grabber

This commit is contained in:
ForestOfLight
2025-06-08 00:34:45 -07:00
Unverified
parent c94d12347c
commit 87b5882cd8
3 changed files with 6361 additions and 5 deletions
+10 -1
View File
@@ -4,8 +4,9 @@ import { bannedBlocks, bannedToValidBlockMap, whitelistedBlockStates, resetToBlo
blockIdToItemStackMap } from '../data';
import { Raycaster } from '../classes/Raycaster';
import { Builders } from '../classes/Builder/Builders';
import { blocks } from '../blocks';
const PROCESS_INTERVAL = 2;
const PROCESS_INTERVAL = 2; // Fast Easy Place will attempt to place twice when at an interval of 1.
const builderOption = new BuilderOption({
identifier: 'fastEasyPlace',
@@ -167,6 +168,7 @@ function placeBlock(player, block, structureBlock, itemSlot) {
if (itemSlot)
consumeItem(itemSlot);
block.setPermutation(structureBlock);
playSoundEffect(player, structureBlock);
});
}
@@ -183,4 +185,11 @@ function consumeItem(itemSlot) {
function consumeSpecial(itemSlot) {
itemSlot.setItem(new ItemStack(specialItemPlacementConversions[itemSlot.typeId.replace('minecraft:', '')]));
}
function playSoundEffect(player, structureBlock) {
const blockId = structureBlock.type.id.replace('minecraft:', '');
const blockData = blocks[blockId];
const blockSound = blockData['sound'] || 'stone';
player.dimension.playSound('dig.' + blockSound, player.location);
}