Skip to content

Commit b4c6f13

Browse files
committed
fix sharp tools not taking damage when cutting grass
1 parent 125efd9 commit b4c6f13

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

kubejs/server_scripts/tfg/events.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,4 +526,23 @@ BlockEvents.rightClicked(event => {
526526
transformBlockWithItem(event, `tfc:rock/mossy_cobble/${stone}_wall`, `tfc:rock/cobble/${stone}_wall`, 'tfc:groundcover/pumice', true, 1, 'minecraft:item.axe.wax_off', 'minecraft:item_slime', true);
527527
});
528528
});
529-
//#endregion
529+
530+
// Makes scythes, hoes, and knives take damage when cutting grass
531+
BlockEvents.broken('tfc:mineable_with_sharp_tool', event => {
532+
let player = event.player;
533+
let toolUsed = player.mainHandItem;
534+
535+
if (!toolUsed.hasTag('tfc:sharp_tools')) {
536+
return;
537+
}
538+
539+
if (!player.isCreative()) {
540+
toolUsed.damageValue++;
541+
if (toolUsed.damageValue >= toolUsed.maxDamage) {
542+
event.server.runCommandSilent(`playsound minecraft:item.shield.break player ${player.username} ${player.x} ${player.y} ${player.z} 1 1 1`);
543+
toolUsed.count--;
544+
}
545+
}
546+
});
547+
548+
//#endregion

0 commit comments

Comments
 (0)