Am I missing something here? Essentially the gas mask is reducing its durability every tick and whenever it reaches or goes below 0, it doesn't get removed or cleraed from the player head slot.
onEvent('player.tick', event => {
if (!event.player.isAlive()) return
if (event.player.headArmorItem.id == "apocalypsenow:gasmask_helmet")
{
if (event.entity.block.biomeId == "biomesoplenty:wasteland" ||
event.entity.block.biomeId == "biomesoplenty:wooded_wasteland")
{
let item = event.player.headArmorItem
item.nbt.Damage++;
if (item.nbt.Damage >= item.maxDamage)
{
player.inventory.clear(item);
}
}
}
})


Could be that maxDamage does not exist on the wrapper

