T

CaveWorld Plugin Specification (Part 1/4) Overview Create a Paper 1.21.8 (Paper Build 26.1.2) plugin named CaveWorld.

The plugin adds a new survival experience where every player owns a personal underground cave instead of living in the normal Overworld.

Players may only own one cave.

The plugin must be modular, optimized, configurable, and easy to expand. All custom systems (structures, ores, mobs, loot, items, recipes, bosses, etc.) should be separated into configuration files whenever possible instead of being hardcoded.

The plugin should support multiplayer without performance issues.

Cave Allocation For optimization, every player's cave should exist inside one single generated world instead of creating thousands of separate worlds.

Each cave is:

1000×1000 blocks

separated from every other cave by bedrock walls

arranged in a grid

impossible to escape

Players should never notice this optimization.

Commands Player Commands /cave create Creates the player's cave if they do not already own one.

The command:

reserves an unused cave location

generates the cave

generates structures

generates ores

sets the default spawn

teleports the player there

Cannot be used twice.

/cave go Alias:

/cg Teleports the player to their cave spawn.

/cave setspawn Sets the cave spawn to the player's current position.

/cave visit <player> Teleports the player to another player's cave.

Requirements:

target owns a cave

visits are enabled

target is online (configurable)

/cave settings Opens a INVENTORY GUI containing settings such as:

Visits ON/OFF

Cave biome

Spawn particle effect

Future options

The INVENTORY GUI must be easy to expand.

Suggested Commands /cave info Displays:

Cave owner

Coordinates

Layer

Visits enabled

Structures discovered

/cave home Alias of /cave go.

Admin Commands /caveadmin give <item>

/caveadmin spawnmob <mob>

/caveadmin place <specialBlock>

/caveadmin reload

/caveadmin regenerate <player>

/caveadmin reset <player> These commands should allow testing every custom mechanic.

Cave Generation Every cave consists of three vertical layers.

The player always spawns near the center of the Stone Layer inside a configurable starter structure.

Layer order:

Stone (top)

↓

Deepslate (middle)

↓

Blackstone (bottom)

Each layer should have:

unique blocks

unique ores

unique structures

unique monsters

unique atmosphere

Everything must be configurable.

Stone Layer This is the safest layer.

Blocks:

Stone

Andesite

Granite

Diorite

Ores:

Coal

Copper

Iron

Petrified Wood

Only normal cave mobs may naturally spawn.

Examples:

Zombie

Skeleton

Spider

Creeper

Witch

Slime

No advanced variants appear here.

Petrified Wood Instead of introducing a custom block model, use:

Pale Oak Log

with custom model data.

Breaking it drops:

Petrified Wood Scraps

(base item: Phantom Membrane)

The scraps:

smelt like charcoal

burn as long as charcoal

Recipes must only accept the custom scraps.

Petrification Amulet Crafted using Petrified Wood.

When right-clicked:

consumed permanently

grants the player +2 maximum hearts forever

Can only be consumed once.

Further uses should display a chat message explaining it has already been used.

Cave Compass Every player starts with a Cave Compass.

The compass cannot be crafted.

It displays:

Current layer

Current Y level

Direction toward the nearest undiscovered structure

Distance to that structure

If every structure has been discovered:

"No undiscovered structures nearby."

Update automatically while held.

Structures Every structure is stored as an NBT file.

The plugin should automatically load every structure found inside:

plugins/CaveWorld/structures/ Each structure is registered through a JSON configuration.

Example:

{ "name":"RuinedTemple", "layer":"STONE", "weight":15 } No Java code should be required to add or remove structures.

Stone Structures Create empty placeholder NBT files for:

Ruined Temple

Ancient Portal

Shrine

Solar Shrine

Farm

Small Dungeon

Small Base

Medium Base

Garden

The plugin should simply load them once the player provides the finished NBT files.

Ore Generation Each layer has independent ore settings.

Every ore should define:

minimum Y

maximum Y

vein size

veins per chunk

rarity

inside configuration files.

This allows easy balancing without recompiling the plugin.

Sounds & Feedback Custom mechanics should always provide feedback.

Examples:

Unique sounds

Action bar messages

Chat messages

Particles

Using an item should feel satisfying.

Examples:

"Petrification complete."

"Not enough experience."

"This item cannot be empowered."

Design Goals The plugin should prioritize:

Modular code

Easy future expansion

High performance

Multiplayer support

Data-driven configuration

Minimal hardcoded values

Clean APIs for future layers, bosses, structures, and items

Kodari AI
KodariJun 27 at 4:03 pm 3

I’ll build the CaveWorld plugin — a complete Paper 1.21.8 plugin where every player owns a personal underground cave. This is a from-scratch project with ~28 files.

CaveWorld
A Paper 1.21.8 survival plugin where each player owns a personal underground cave instead of living in the Overworld. Features include procedural 1000×1000 caves arranged in a grid with three distinct layers (Stone, Deepslate, Blackstone), each with unique ores, structures, and mobs. Includes custom items (Petrified Wood, Petrification Amulet, Cave Compass), configurable structure loading from NBT files, ore generation settings per layer, settings GUI, and comprehensive player/admin commands. All mechanics are data-driven through configuration files.

All 28 files created. Here’s the project summary:

CaveWorld — A Paper 1.21.8 plugin giving every player a personal underground cave.

Architecture (28 files)

Plain Text
CaveWorld/
├── build.gradle
├── src/main/resources/
│   ├── plugin.yml
│   ├── config.yml
│   ├── layers.yml
│   ├── ores.yml
│   ├── structures.json
│   └── messages.yml
├── src/main/java/com/caveworld/
│   ├── CaveWorldPlugin.java              — Main class, initializes all systems
│   ├── util/
│   │   ├── ColorUtil.java                — MiniMessage color formatting
│   │   └── NoiseGenerator.java           — 3D Perlin noise for cave generation
│   ├── config/
│   │   └── ConfigManager.java            — Loads all YAML/JSON configs
│   ├── data/
│   │   ├── PlayerData.java               — Per-player data (cave ID, spawn, settings)
│   │   └── PlayerDataManager.java        — Loads/saves player YAML files
│   ├── world/
│   │   ├── CaveGrid.java                 — 1008-block grid layout, cave→coordinate math
│   │   ├── CaveChunkGenerator.java       — Lazy chunk-based terrain + ore generation
│   │   └── CaveManager.java              — Cave creation, teleportation, regeneration
│   ├── structure/
│   │   ├── Structure.java                — NBT structure with fallback placeholder
│   │   └── StructureManager.java         — Loads structure definitions from JSON
│   ├── item/
│   │   ├── ItemManager.java              — Central item registry + admin helpers
│   │   ├── CaveCompass.java              — Shows layer, Y, nearest structure distance
│   │   ├── PetrifiedWoodScrap.java       — Pale Oak log drops → smeltable scraps
│   │   └── PetrificationAmulet.java      — Grants +2 permanent hearts (once)
│   ├── gui/
│   │   ├── InventoryGUI.java             — Abstract button-based GUI framework
│   │   ├── GUIManager.java               — Tracks active inventories
│   │   ├── GUIListener.java              — Routes click/open/close events
│   │   └── SettingsGUI.java              — Visits toggle, particle/biome (extensible)
│   ├── command/
│   │   ├── CaveCommand.java              — /cave create|go|setspawn|visit|settings|info
│   │   └── CaveAdminCommand.java         — /caveadmin give|spawnmob|place|reload|regenerate|reset
│   └── listener/
│       └── PlayerListener.java           — Join, respawn, block break, compass, amulet

Key Design Decisions

Decision
Approach
Cave grid
1000-block interior + 8-block bedrock walls = 1008 blocks per cave (126×126 chunk regions)
World
Single
caveworld
void world with custom
CaveChunkGenerator
for lazy terrain
Generation
3D Perlin noise carves tunnels; ores placed via per-chunk random; walls at grid boundaries
Structures
NBT files in
plugins/CaveWorld/structures/
loaded at runtime; JSON config per structure
Data
Per-player YAML files in
plugins/CaveWorld/players/
Layers
Stone (y=0…60), Deepslate (y=-20…-1), Blackstone (y=-60…-21) — all configurable in
layers.yml
Items
Cave Compass (auto-updates lore), Petrified Wood Scrap (Pale Oak log drop), Petrification Amulet (shaped recipe)
Commands
/cave
(7 subcommands) +
/cg
shortcut +
/caveadmin
(6 subcommands) + tab completion
GUI
Extensible
InventoryGUI
framework — add new settings by adding buttons to
SettingsGUI
T

CaveWorld Plugin Specification (Part 2/4) Deepslate Layer The Deepslate Layer is the middle section of every cave and marks the beginning of mid-game progression. Compared to the Stone Layer, it is significantly more dangerous and introduces new mechanics, stronger enemies, and valuable resources.

Natural terrain primarily consists of Deepslate with normal cave generation.

Ores Vanilla Ores Generate the following Deepslate variants:

Coal (rare)

Copper

Iron

Gold

Redstone

Emerald

Diamond (rare)

Custom Ores Opal

Carbon

Ore generation values (vein size, rarity, height, etc.) must be configurable.

Opal Opal is one of the most important resources in the plugin.

Every Opal item belongs to one of five purity tiers:

Flawed

Impure

Pure

Refined

Perfect

Purity is displayed in the item's lore.

Mining Fortune increases the amount of Opal obtained.

Silk Touch does not increase drops, but significantly increases the chance of obtaining higher-purity Opal.

Looting has no effect on Opal.

Opal Block Crafted from 9 Opals.

Used in advanced crafting recipes and boss progression.

Opal Prism Crafting recipe:

1 Opal Block

4 Pure-or-better Opals

4 Diamonds

The recipe must only accept plugin Opals.

Ability The Opal Prism can capture hostile mobs from the Stone Layer only.

Rules:

Maximum of 5 stored mobs.

Costs 5 XP levels per capture.

If the player lacks XP, cancel the action and display a chat message.

Only valid mobs may be captured.

The INVENTORY GUI should clearly show stored mobs and remaining uses.

Total durability: 5 captures before the prism breaks.

Item Empowerment System Players can permanently enhance equipment using Opal.

This system takes place inside the Abandoned Altar structure.

The structure contains:

1 central altar

3 surrounding pedestals

Pedestals Pedestals visually display the inserted Opal:

floating item

slow rotation

decorative particles

The central altar displays the equipment being upgraded.

Empowerment Process Place equipment on the altar.

Insert Opal into all three pedestals.

Activate the altar.

If the item cannot be empowered:

do not consume the Opal

display an explanatory chat message

Empowerments Each empowerment grants a small passive bonus while the item is equipped or held.

Examples:

+Attack Damage

+Attack Speed

+Armor

+Armor Toughness

+Movement Speed

+Mining Speed

+Luck

+Knockback Resistance

The exact bonus depends on the average Opal purity used.

Higher purity = stronger bonus.

Restrictions Every item may only receive one empowerment.

Netherite equipment may receive two empowerments.

Empowerments are permanent.

They cannot be removed or replaced.

Opal Renewal Natural Opal ore is finite.

Renewable Opal comes from Opal Sentinels.

Opal Sentinel A rare custom enemy found inside specific structures.

After being defeated, it leaves behind a Growing Opal Cluster.

The cluster functions similarly to Amethyst.

Properties:

slowly grows Opal

renewable resource

naturally grown Opal can never become Perfect quality

Carbon Carbon is another custom ore.

Uses:

Furnace fuel equal to a Lava Bucket.

Can be crushed by a falling anvil into a Diamond.

Used for taming Skeleton Dogs.

Carbon generation should be uncommon.

Skeleton Captain A stronger Skeleton variant.

Properties:

Increased health

Improved AI

Wears Chainmail, Copper, Iron or Gold armor

Uses matching weapons

All equipment has Level I enchantments

Equipment never drops

Copper equipment should use custom textures/models.

Skeleton Dogs Skeleton Captains spawn with Skeleton Dogs.

Dogs:

defend their captain

attack nearby players

cannot be tamed while the captain lives

After the captain dies:

dogs become neutral

can be tamed using Carbon

Once tamed:

behave like wolves

retain skeleton appearance

use normal wolf mechanics

Enhanced Monsters Beginning in the Deepslate Layer, Zombies and Skeletons become much stronger.

Possible armor:

Chainmail

Copper

Iron

Gold

Possible weapons:

Stone

Copper

Iron

Gold

Equipment is randomly enchanted with low-level enchantments.

Equipment never drops.

Attribute Modifiers Each monster may randomly receive up to three modifiers.

Examples:

Increased Health

Increased Speed

Increased Damage

Increased Knockback Resistance

Fire Resistance

Regeneration

Faster Attack Speed

Modifiers should be configurable.

Zombie Leaders Approximately 50% of Zombies become Leaders.

Leader bonuses include:

more health

higher damage

larger detection radius

Leader Zombies may occasionally buff nearby Zombies with temporary Strength or Speed effects.

Mini-Boss Variants Starting in the Deepslate Layer, any hostile mob may rarely spawn as a Mini-Boss.

Mini-Boss properties:

1.5× size

3× Health

3× Damage

3× Armor

Increased movement speed

Unique particle aura

Boss health bar

Possible weapons:

Sword

Axe

Crossbow

Mini-Bosses should drop additional loot and experience.

Spawn chance should be configurable.

Deepslate Structures Provide empty placeholder NBT files for:

Abandoned Altar

Ancient Statue

Ocean Ruin 1

Ocean Ruin 2

Ocean Ruin 3

Warden Shrine

Prison

NPC House

Ruined End Portal

Old Forge

All structures must be loaded automatically through the structure registration system from Part 1.

Progression Goals The Deepslate Layer introduces the player to:

permanent equipment upgrades

renewable Opal farming

Carbon

Skeleton Dogs

stronger enemies

Mini-Bosses

preparation for the Blackstone Layer

Players should feel a noticeable increase in difficulty while gaining access to powerful new mechanics and resources.

Kodari AI
KodariJun 27 at 4:18 pm 6

I’ll read the existing project files to understand the current state, then implement all Part 2 systems.

I have a full picture of the codebase. Now I’ll implement all Part 2 Deepslate Layer systems. Let me proceed task by task.

Plan:

  1. Update resource configs (ores.yml, structures.json, config.yml, messages.yml)

  2. Create new item classes (OpalItem, CarbonItem, OpalPrism)

  3. Create mob manager (CaveMobManager)

  4. Create empowerment system (EmpowermentManager)

  5. Create OpalPrismGUI

  6. Modify existing Java files (CaveChunkGenerator, PlayerListener, PlayerData, ItemManager, CaveWorldPlugin, etc.)

Starting with resource files + new file creations

Now I’ll implement all Part 2 systems. Starting with new files, then patching existing ones.

New files (11):

  1. OpalItem.java - 5-tier opal system

  2. CarbonItem.java - carbon drops

  3. OpalPrism.java - mob capture item

  4. OpalPrismGUI.java - prism inventory

  5. EmpowermentData.java - stored empowerment

  6. CaveMobManager.java - enhanced mobs, leaders, mini-bosses, captains, dogs

  7. MobModifier.java - configurable modifiers

  8. SkeletonDogTameListener.java - tame dogs with carbon

  9. EmpowermentAltarHandler.java - altar/pedestal interaction

Then patch existing files.

I’ll use inline tags for new files since they don’t exist yet. Let me create the 11 new files, then patch existing ones.

<operation path="src/main/java/com/caveworld/item/OpalItem.java">full file content</operation>

<operation path="src/main/java/com/caveworld/item/CarbonItem.java">full file content</operation>

<operation path="src/main/java/com/caveworld/item/OpalPrism.java">full file content</operation>

<operation path="src/main/java/com/caveworld/gui/OpalPrismGUI.java">full file content</operation>

<operation path="src/main/java/com/caveworld/empowerment/EmpowermentData.java">full file content</operation>

<operation path="src/main/java/com/caveworld/empowerment/EmpowermentManager.java">full file content</operation>

<operation path="src/main/java/com/caveworld/mob/MobModifier.java">full file content</operation>

<operation path="src/main/java/com/caveworld/mob/CaveMobManager.java">full file content</operation>

<operation path="src/main/java/com/caveworld/mob/SkeletonDogManager.java">full file content</operation>

<operation path="src/main/java/com/caveworld/empowerment/EmpowermentAltarHandler.java">full file content</operation>

<operation path="src/main/java/com/caveworld/empowerment/AltarSession.java">full file content</operation>

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
29 2,885
src/main/java/com/caveworld/CaveWorldPlugin.java
package com.caveworld;

import com.caveworld.command.CaveAdminCommand;
import com.caveworld.command.CaveCommand;
import com.caveworld.config.ConfigManager;
import com.caveworld.data.PlayerData;
import com.caveworld.data.PlayerDataManager;
import com.caveworld.gui.GUIListener;
import com.caveworld.gui.GUIManager;
import com.caveworld.item.ItemManager;
import com.caveworld.listener.PlayerListener;
import com.caveworld.structure.StructureManager;
import com.caveworld.util.ColorUtil;
import com.caveworld.world.CaveGrid;
import com.caveworld.world.CaveManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Objects;

public class CaveWorldPlugin extends JavaPlugin {
    private static CaveWorldPlugin instance;

    private ConfigManager configManager;
    private PlayerDataManager playerDataManager;
    private CaveGrid caveGrid;
    private StructureManager structureManager;
    private CaveManager caveManager;
    private ItemManager itemManager;
    private GUIManager guiManager;

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

        // Initialize config
        this.configManager = new ConfigManager(this);
        this.configManager.loadConfigs();

        // Initialize managers
        this.playerDataManager = new PlayerDataManager(this);
        this.caveGrid = new CaveGrid(this);
        this.structureManager = new StructureManager(this);
        this.structureManager.loadStructures();
        this.caveManager = new CaveManager(this, structureManager);
        this.itemManager = new ItemManager(this);
        this.itemManager.registerRecipes();
        this.guiManager = new GUIManager();

        // Initialize cave world
        this.caveManager.getOrCreateWorld();

        // Register listeners
        Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this);
        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);

        // Register commands
        Objects.requireNonNull(getCommand("cave")).setExecutor(new CaveCommand(this));
        Objects.requireNonNull(getCommand("cave")).setTabCompleter(new CaveCommand(this));
        Objects.requireNonNull(getCommand("caveadmin")).setExecutor(new CaveAdminCommand(this));
        Objects.requireNonNull(getCommand("caveadmin")).setTabCompleter(new CaveAdminCommand(this));
        Objects.requireNonNull(getCommand("cg")).setExecutor((sender, cmd, label, args) -> {
            if (sender instanceof org.bukkit.entity.Player) {
                caveManager.teleportToCave((org.bukkit.entity.Player) sender);
                return true;
            }
            sender.sendMessage(org.bukkit.ChatColor.RED + "Players only.");
            return true;
        });

        // Register /cg alias for tab completion
        Objects.requireNonNull(getCommand("cg")).setTabCompleter((sender, cmd, label, args) -> java.util.Collections.emptyList());

        getLogger().info("CaveWorld v" + getDescription().getVersion() + " enabled!");
        getLogger().info("Players can use /cave create to start their underground adventure!");
    }

    @Override
    public void onDisable() {
        if (playerDataManager != null) {
            playerDataManager.saveAll();
        }
        getLogger().info("CaveWorld disabled. Player data saved.");
    }

    public static CaveWorldPlugin getInstance() { return instance; }

    public ConfigManager getConfigManager() { return configManager; }
    public PlayerDataManager getPlayerDataManager() { return playerDataManager; }
    public CaveGrid getCaveGrid() { return caveGrid; }
    public StructureManager getStructureManager() { return structureManager; }
    public CaveManager getCaveManager() { return caveManager; }
    public ItemManager getItemManager() { return itemManager; }
    public GUIManager getGuiManager() { return guiManager; }

    public int getCaveOctaves() {
        return configManager.getConfig().getInt("generation.cave-octaves", 3);
    }
}