fix sharp tools not taking damage when cutting grass (#1614)
Co-authored-by: Redeix <brayden.j.m.ford@gmail.com>
This commit is contained in:
parent
ea9fa54021
commit
7fb821dae9
1 changed files with 20 additions and 1 deletions
|
|
@ -526,4 +526,23 @@ BlockEvents.rightClicked(event => {
|
|||
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);
|
||||
});
|
||||
});
|
||||
//#endregion
|
||||
|
||||
// Makes scythes, hoes, and knives take damage when cutting grass
|
||||
BlockEvents.broken('tfc:mineable_with_sharp_tool', event => {
|
||||
let player = event.player;
|
||||
let toolUsed = player.mainHandItem;
|
||||
|
||||
if (!toolUsed.hasTag('tfc:sharp_tools')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.isCreative()) {
|
||||
toolUsed.damageValue++;
|
||||
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`);
|
||||
toolUsed.count--;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//#endregion
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue