This commit is contained in:
Pyritie 2025-12-14 19:20:40 +00:00
commit e77519aa59

View file

@ -503,18 +503,19 @@ BlockEvents.rightClicked(event => {
}); });
// Makes scythes, hoes, and knives take damage when cutting grass // Makes scythes, hoes, and knives take damage when cutting grass
BlockEvents.broken('tfc:mineable_with_sharp_tool', event => { BlockEvents.broken(event => {
let player = event.player; const { server, item, player, block } = event;
let toolUsed = player.mainHandItem;
if (!toolUsed.hasTag('tfc:sharp_tools')) { if (!block.hasTag('tfc:mineable_with_sharp_tool') || !toolUsed.hasTag('tfc:sharp_tools')) {
return; return;
} }
let toolUsed = player.mainHandItem;
if (!player.isCreative()) { if (!player.isCreative()) {
toolUsed.damageValue++; toolUsed.damageValue++;
if (toolUsed.damageValue >= toolUsed.maxDamage) { if (toolUsed.damageValue >= toolUsed.maxDamage) {
event.server.runCommandSilent(`playsound minecraft:item.shield.break player ${player.username} ${player.x} ${player.y} ${player.z} 1 1 1`); server.runCommandSilent(`playsound minecraft:item.shield.break player ${player.username} ${player.x} ${player.y} ${player.z} 1 1 1`);
toolUsed.count--; toolUsed.count--;
} }
} }