deatheclairyt
📎 1 file 1,550 chars
📄
pasted-code-1781383306910.txt
txt 44 lines
▶
Crée un système Minecraft (Paper / plugin Java 1.21.x) qui rend le monde plus vivant et rempli de secrets.

Le plugin doit ajouter deux systèmes principaux :

🌲 1. Monde vivant (AI + événements dynamiques)
Les animaux ne spawn pas seuls mais en groupes / troupeaux
Chaque groupe a un comportement réaliste :
déplacement en groupe
fuite en cas de danger
regroupement pour protection
Ajoute des événements naturels dynamiques :
migrations d’animaux visibles dans certaines zones du monde
invasions de mobs hostiles dans des biomes spécifiques
variations de rareté des animaux selon le temps et la zone
Le système de spawn doit être intelligent :
basé sur biome
basé sur densité de joueurs
basé sur heure / cycle du monde
Donner une sensation de monde vivant et imprévisible
🏚️ 2. Ruines & Secrets (structures rares + exploration)

Génère des structures rares et immersives dans le monde :

cabanes abandonnées
camps de bandits
tours en ruine
temples cachés partiellement enfouis

Chaque structure doit contenir :

un mini lore immersif (livres, signs, ambiance, messages)
un loot équilibré (récompense correcte mais pas OP)
une génération naturelle intégrée au terrain (pas posée en bloc brut)
une rareté élevée pour encourager l’exploration
⚙️ Objectif global

Créer un monde Minecraft :

plus vivant et dynamique
basé sur l’exploration et la découverte
avec des événements aléatoires et rares
avec des structures secrètes et du lore environnemental

Le résultat doit être optimisé, compatible Paper 1.21.x, et pensé pour serveur survie multijoueur.
Kodari AI
KodariJun 13 at 8:55 pm 71
LivingWorld
A deep immersion plugin that transforms Minecraft into a living, breathing world. Features a herd AI system where animals move in groups, flee predators, and regroup — plus dynamic world events including animal migrations and biome-specific hostile invasions. A ruins system procedurally generates abandoned cabins, bandit camps, ruined towers, and hidden temples with immersive lore, balanced loot, and natural terrain integration.

Plan:

  1. Core plugin class + config

  2. Herd AI system (state machine, manager, listener)

  3. Dynamic events (migrations, invasions)

  4. Smart spawn control

  5. Ruins system (structure base, loot/lore helpers, 4 structure implementations, chunk listener)


Here’s a summary of what was built:


🌿 LivingWorld — Complete

🐄 Herd AI System

  • HerdManager — state machine ticking every 2s; tracks all herds and entity → herd mappings

  • Herd — holds members list, current state (GRAZING / FLEEING / REGROUPING / MIGRATING), center, target, threat location

  • Behaviors: IDLE wanders slowly in random directions → FLEE applies pathfinding away from threat for 10s → REGROUP rallies to herd center → IDLE. Cohesion enforcement pulls stragglers back if spread > max-spread

  • HerdListener — natural spawns auto-join or create herds; damage events trigger whole-herd flee; deaths purge membership

⚡ Dynamic Events

  • Migration — every ~10 min, spawns 10–18 animals behind a player, pathfinds them across the region; nearby players see the message

  • Invasion — every ~15 min, picks a biome-appropriate mob pack (Husks in deserts, Witches in swamps, Pillagers on plains…), spawns 5–12 around a player with targeting, plays a wither ambient sound alert

  • /lw event triggers immediately for testing

🧟 Smart Spawn Control

  • Cancels natural spawns if max-animals-per-area (default 8) are already within a 48-block radius per species

🏚️ Ruins & Secrets (generated on chunk populate, 0.3% chance)

Structure
Key Features
Abandoned Cabin
Decayed oak walls, partial slab roof, chest + crafting table + furnace, cobwebs, lore journal & sign
Bandit Camp
Broken fence perimeter, campfire with log seats, 2 wool tents, barrels, loot chest + field notes
Ruined Tower
9–13 blocks tall, arrow slits, crumbling top 3 floors, ladder wall, mid-floor platform, enchanted book loot
Hidden Temple
3 blocks underground, chiseled stone brick altar, enchanting table + bookshelves, pressure plate entry, best loot pool

All structures include lore books (written by named characters with a dark narrative) and atmospheric signs. Chunk generation is overworld-only with ground validity checks.

deatheclairyt

corrige moi sa pour que les structure soit toute sur le sol

1 image attached
Kodari can make mistakes. Review important code before using.
Files
src
Code
17 1,626
src/main/java/com/kodari/livingworld/LivingWorldPlugin.java
package com.kodari.livingworld;

import com.kodari.livingworld.events.DynamicEventManager;
import com.kodari.livingworld.herd.HerdListener;
import com.kodari.livingworld.herd.HerdManager;
import com.kodari.livingworld.ruins.RuinListener;
import com.kodari.livingworld.spawn.SmartSpawnListener;
import lombok.Getter;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class LivingWorldPlugin extends JavaPlugin {

    @Getter private static LivingWorldPlugin instance;
    @Getter private HerdManager herdManager;
    @Getter private DynamicEventManager dynamicEventManager;

    @Override
    public void onEnable() {
        instance = this;
        saveDefaultConfig();

        herdManager = new HerdManager(this);
        dynamicEventManager = new DynamicEventManager(this);

        if (getConfig().getBoolean("herd.enabled", true)) {
            getServer().getPluginManager().registerEvents(new HerdListener(this), this);
            herdManager.startTicking();
        }

        if (getConfig().getBoolean("spawn.enabled", true)) {
            getServer().getPluginManager().registerEvents(new SmartSpawnListener(this), this);
        }

        if (getConfig().getBoolean("events.enabled", true)) {
            dynamicEventManager.start();
        }

        if (getConfig().getBoolean("ruins.enabled", true)) {
            getServer().getPluginManager().registerEvents(new RuinListener(this), this);
        }

        getLogger().info("LivingWorld activated — the world breathes again.");
    }

    @Override
    public void onDisable() {
        if (herdManager != null) herdManager.stopTicking();
        if (dynamicEventManager != null) dynamicEventManager.stop();
        getLogger().info("LivingWorld disabled.");
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!sender.hasPermission("livingworld.admin")) {
            sender.sendMessage("§cYou don't have permission.");
            return true;
        }

        if (args.length == 0) {
            sender.sendMessage("§6LivingWorld §8| §aActive");
            sender.sendMessage("§7Usage: §f/lw reload §8| §fstatus §8| §fherd §8| §fevent");
            return true;
        }

        switch (args[0].toLowerCase()) {
            case "reload" -> {
                reloadConfig();
                sender.sendMessage("§aConfiguration reloaded.");
            }
            case "status" -> {
                sender.sendMessage("§6== LivingWorld Status ==");
                sender.sendMessage("§7Active herds: §f" + herdManager.getHerdCount());
                sender.sendMessage("§7Total herd members: §f" + herdManager.getTotalMembers());
            }
            case "herd" -> {
                if (sender instanceof Player p) {
                    herdManager.createHerd(p.getLocation(), EntityType.COW, 5);
                    sender.sendMessage("§aSummoned a cow herd nearby.");
                } else {
                    sender.sendMessage("§cThis command requires a player.");
                }
            }
            case "event" -> {
                dynamicEventManager.triggerRandomEvent();
                sender.sendMessage("§aTriggered a random dynamic event.");
            }
            default -> sender.sendMessage("§cUnknown subcommand. Use: reload, status, herd, event");
        }

        return true;
    }
}