BlockEvents.rightClicked(event => {
  let { player, block, item } = event;

  if (!player.hasEffect("moderninhibited:inhibited")) return;

  let blockId = block.id;
  let itemId = item.id;

  let blockedItemsAndBlocks = [
    "minecraft:chiseled_bookshelf",
    "supplementaries:book_pile",
    "supplementaries:book_pile_horizontal",
    "minecraft:spruce_trapdoor",
    "minecraft:dark_oak_trapdoor",
    "minecraft:tnt"
  ];

  if (blockedItemsAndBlocks.includes(blockId) || blockedItemsAndBlocks.includes(itemId)) {
    event.cancel();
  }
});

ItemEvents.rightClicked(event => {
  let { player, item } = event;

  if (!player.hasEffect("moderninhibited:inhibited")) return;
  let itemId = item.id;

  let blockedItems = [
    "spelunkery:mineomite"
  ];

  if (blockedItems.includes(itemId)) {
    event.cancel();
  }
});

PlayerEvents.tick(event => {
  let player = event.player;
  if (player.level.isClientSide()) return;

  let helmet = player.inventory.getArmor(3);
  if (helmet && helmet.id === 'magistuarmory:crown_decoration') {
    player.potionEffects.add('minecraft:hero_of_the_village', 120, 0, false, false);
  }
});
