import { world, EquipmentSlot } from "@minecraft/server";
import { runInterval } from "./eternal/utils";

const blocks = ["minecraft:ice", "minecraft:packed_ice", "minecraft:blue_ice", "minecraft:snow", "minecraft:powder_snow", "minecraft:snow_layer"];

runInterval(() => {
  for (const player of world.players) {
    const item = player.getEquipment(EquipmentSlot.Feet);

    if (item && item.typeId === "ecbl_bc:fur_boots") {
      const loc = player.location;
      loc.y--;
      const block = player.dimension.getBlock(loc);
      const block2 = player.dimension.getBlock(player.location);

      if (blocks.includes(block.typeId) || blocks.includes(block2.typeId)) {
        player.addEffect("speed", 10, { amplifier: 1.5, showParticles: false });
      }
    }
  }
});
