icevr181_

make me a game inspired by wonderland.jar horror Minecraft horror mod

Kodari AI
KodariTue at 1:08 pm 2
WonderlandHorror
A Fabric 1.20.4 horror mod inspired by wonderland.jar, transforming the overworld into a nightmarish Wonderland. Players encounter twisted, corrupted versions of familiar biomes, eerie soundscapes, and a relentless entity that stalks them through the distorted landscape. Features custom mobs with unique AI, sanity-based gameplay mechanics that alter visual and auditory perception, procedurally generated nightmare structures, and a progression system where players must collect scattered memory fragments to escape the cursed dimension. Includes configurable difficulty settings, immersive visual effects like vignette and chromatic aberration, and a haunting ambient soundtrack that intensifies as the entity draws near.

Created The Unquiet, a survival horror mod with intermittent whispers, unsettling sounds, darkness and spectral particles. The hauntings begin automatically in survival or adventure mode; there’s nothing to craft or obtain.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
5 145
src/main/java/dev/kodari/unquiet/TheUnquiet.java
package dev.kodari.unquiet;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text;

public class TheUnquiet implements ModInitializer {
    private final Map<UUID, Integer> countdowns = new HashMap<>();

    @Override
    public void onInitialize() {
        ServerTickEvents.END_SERVER_TICK.register(server -> {
            Set<UUID> online = new HashSet<>();
            for (ServerPlayerEntity player : server.getPlayerManager().getPlayerList()) {
                UUID id = player.getUuid();
                online.add(id);
                if (!player.isAlive() || player.isCreative() || player.isSpectator()) {
                    countdowns.remove(id);
                    continue;
                }
                int remaining = countdowns.computeIfAbsent(id, ignored -> nextDelay()) - 1;
                if (remaining <= 0) {
                    haunt(player);
                    remaining = nextDelay();
                }
                countdowns.put(id, remaining);
            }
            countdowns.keySet().retainAll(online);
        });
    }

    private static int nextDelay() {
        return ThreadLocalRandom.current().nextInt(1800, 4201);
    }

    private static void haunt(ServerPlayerEntity player) {
        ThreadLocalRandom random = ThreadLocalRandom.current();
        switch (random.nextInt(4)) {
            case 0 -> {
                player.playSound(SoundEvents.ENTITY_ENDERMAN_STARE, SoundCategory.AMBIENT, 0.55f, 0.65f);
                player.sendMessage(Text.literal("You feel watched."), true);
            }
            case 1 -> {
                player.playSound(SoundEvents.ENTITY_WARDEN_HEARTBEAT, SoundCategory.AMBIENT, 0.8f, 0.8f);
                player.addStatusEffect(new StatusEffectInstance(StatusEffects.DARKNESS, 100, 0, false, false, false));
            }
            case 2 -> {
                player.playSound(SoundEvents.ENTITY_WARDEN_TENDRIL_CLICKS, SoundCategory.AMBIENT, 0.65f, 0.7f);
                player.getServerWorld().spawnParticles(player, ParticleTypes.SCULK_SOUL, false,
                        player.getX(), player.getY() + 1.0, player.getZ(), 12, 2.0, 0.8, 2.0, 0.01);
            }
            default -> {
                player.playSound(SoundEvents.ENTITY_WARDEN_DIG, SoundCategory.AMBIENT, 0.45f, 1.2f);
                String[] whispers = {"Don't look behind you.", "It remembers you.", "You are not alone.", "Something is listening."};
                player.sendMessage(Text.literal(whispers[random.nextInt(whispers.length)]), true);
            }
        }
    }
}