// ignored: true

const TASK_ID = "58871EA8BAAA7528";
const REQUIRED = 5;

const ServerPlayer = Java.loadClass("net.minecraft.server.level.ServerPlayer");

FTBQuestsEvents.customTask(TASK_ID, (e) => {
  e.maxProgress = REQUIRED;
});

NativeEvents.onEvent(
  "net.neoforged.neoforge.e.entity.living.BabyEntitySpawnEvent",
  (e) => {
    const player = e.getCausedByPlayer();
    if (!player) return;

    if (!(player instanceof ServerPlayer)) return;

    if (e.isCanceled && e.isCanceled()) return;

    FTBQuests.getServerDataFromPlayer(player).addProgress(TASK_ID, 1);
  }
);
