CastleForge gameplay/control mod for managing vanilla generated spawner blocks, existing spawner activation, and random vanilla loot block generation in CastleMiner Z.
Current mod version shown in source: 0.0.1.0
- Overview
- Why this mod exists
- Features at a glance
- Requirements
- Installation
- Quick start
- Command reference
- Configuration
- Recommended setups
- Behavior notes
- Important ModLoaderExtensions note
- Technical overview
- Known limitations
- Development notes
- Credits
- License
VanillaSpawners is a CastleForge / ModLoader mod that brings the dedicated-server VanillaSpawners style controls into normal CastleForge-hosted CastleMiner Z sessions.
The goal is simple: let a host decide whether newly generated terrain should keep placing vanilla monster spawners and vanilla loot blocks, while also allowing existing spawner blocks to be made non-clickable without deleting them from the world.
At its core, the mod can:
- prevent new vanilla cave / alien / hell / boss spawner blocks from generating,
- prevent existing vanilla spawner blocks from being activated,
- prevent new vanilla
LootBlock/LuckyLootBlockblocks from generating, - keep existing worlds safe by not deleting saved chunks automatically,
- create a simple per-mod INI file under
!Mods\VanillaSpawners, - reload that INI in-game with a slash command.
This makes it useful for CastleForge players who want cleaner world generation, reduced vanilla spawner clutter, or server-style control while hosting through the regular CastleMiner Z game.
The dedicated server plugin version of VanillaSpawners controls vanilla spawner and loot generation for dedicated server worlds.
This CastleForge mod recreates that idea for the normal CastleForge mod ecosystem. Instead of relying on the dedicated server plugin API, this version uses Harmony patches inside the local game/host process.
That means it is best suited for:
- local CastleForge worlds,
- hosted multiplayer sessions where the host runs CastleForge,
- testing world-generation behavior without using the dedicated server plugin system,
- players who want the same feature split as the dedicated-server
VanillaSpawnersplugin.
| Feature | What it does |
|---|---|
| New spawner generation toggle | Allows or blocks newly generated vanilla cave / alien / hell / boss spawner blocks |
| Existing spawner activation toggle | Lets existing vanilla spawners remain in the world but prevents click activation when disabled |
| New loot block generation toggle | Allows or blocks newly generated vanilla LootBlock and LuckyLootBlock blocks |
| Safe existing-world behavior | Does not automatically delete or edit already-saved chunks |
| Simple INI config | Creates VanillaSpawners.Config.ini on first launch |
| Runtime reload | Reloads config with /vanillaspawners reload |
| Status command | Prints the active runtime values in chat/feedback |
| ModLoaderExtensions commands | Uses CastleForge's shared command infrastructure |
| Harmony patches | Hooks the vanilla generation and clickable-spawner paths directly |
| Vanilla fallback behavior | Setting Enabled=false returns the patched behavior to vanilla defaults |
VanillaSpawners is built for the CastleForge ecosystem and requires:
- CastleMiner Z
- CastleForge ModLoader
- ModLoaderExtensions
The mod declares ModLoaderExtensions as a required dependency because it uses the shared CastleForge command infrastructure.
Recommended target environment:
| Item | Recommended value |
|---|---|
| Game version | 1.9.9.8 |
| Framework | CastleForge / ModLoader setup |
| Dependency | ModLoaderExtensions |
| Mod version | 0.0.1.0 |
| Platform | x86 / .NET Framework 4.8.1 project setup |
- Install and verify CastleForge ModLoader.
- Install ModLoaderExtensions.
- Build or download
VanillaSpawners.dll. - Place the DLL in the CastleMiner Z
!Modsfolder. - Launch the game once.
- The mod will create its config folder and default INI file.
- Enter a world and test the status command.
Expected DLL placement:
CastleMiner Z\!Mods\VanillaSpawners.dll
Expected config folder after first launch:
CastleMiner Z\!Mods\VanillaSpawners\
Expected config file:
CastleMiner Z\!Mods\VanillaSpawners\VanillaSpawners.Config.ini
Depending on your packaging flow, the main
VanillaSpawners.dllmay sit directly in!Mods, while the config file lives under!Mods\VanillaSpawners\.
Check the currently active settings:
/vanillaspawners
or:
/vanillaspawners status
Reload the INI after editing it:
/vanillaspawners reload
Short alias:
/vspawners
A common setup to stop new vanilla spawner blocks while keeping vanilla loot blocks enabled:
[General]
Enabled=true
GenerateSpawnerBlocks=false
AllowSpawnerActivation=true
GenerateLootBlocks=true
LogBlockedActivation=false| Command | Usage | What it does |
|---|---|---|
/vanillaspawners |
/vanillaspawners |
Shows the active VanillaSpawners config values |
/vanillaspawners status |
/vanillaspawners status |
Same as /vanillaspawners; prints current runtime state |
/vanillaspawners reload |
/vanillaspawners reload |
Reloads VanillaSpawners.Config.ini without restarting the game |
/vspawners |
/vspawners |
Short alias for /vanillaspawners |
/vspawners status |
/vspawners status |
Alias status command |
/vspawners reload |
/vspawners reload |
Alias reload command |
VanillaSpawners creates this config on first launch:
!Mods\VanillaSpawners\VanillaSpawners.Config.ini
; VanillaSpawners - Configuration
; Lines starting with ';' or '#' are comments.
[General]
; Master toggle for the entire mod.
; true = VanillaSpawners patches use the options below.
; false = Vanilla behavior; this mod does not block vanilla spawner or loot generation.
Enabled=true
; Allows new vanilla cave / alien / hell / boss spawner blocks to generate.
; false prevents NEW spawner blocks from being placed in newly generated terrain.
; Existing chunks and saves are not deleted or modified.
GenerateSpawnerBlocks=true
; Allows existing vanilla spawner blocks to be activated.
; false makes existing vanilla spawner blocks non-clickable for the patched host/game instance.
AllowSpawnerActivation=true
; Allows new vanilla LootBlock / LuckyLootBlock blocks to generate.
; false prevents NEW loot blocks from being placed in newly generated terrain.
; Existing chunks and saves are not deleted or modified.
GenerateLootBlocks=true
; Logs blocked spawner activation checks.
; Useful for debugging, but noisy if players keep trying old spawners.
LogBlockedActivation=false| Section | Key | Default | What it controls |
|---|---|---|---|
General |
Enabled |
true |
Master toggle for the mod's behavior |
General |
GenerateSpawnerBlocks |
true |
Allows new vanilla cave / alien / hell / boss spawner blocks to generate |
General |
AllowSpawnerActivation |
true |
Allows existing vanilla spawner blocks to be treated as clickable spawners |
General |
GenerateLootBlocks |
true |
Allows new vanilla LootBlock and LuckyLootBlock blocks to generate |
General |
LogBlockedActivation |
false |
Logs blocked spawner activation checks when activation is disabled |
Enabled=false means the mod should behave like vanilla.
When disabled, the runtime values intentionally fall back to:
GenerateSpawnerBlocks = true
AllowSpawnerActivation = true
GenerateLootBlocks = true
LogBlockedActivation = false
So this:
[General]
Enabled=false
GenerateSpawnerBlocks=false
AllowSpawnerActivation=false
GenerateLootBlocks=false
LogBlockedActivation=truestill behaves like vanilla because the master toggle is off.
Use this if you want to keep the mod installed but temporarily stop it from changing gameplay.
[General]
Enabled=false
GenerateSpawnerBlocks=true
AllowSpawnerActivation=true
GenerateLootBlocks=true
LogBlockedActivation=falseUse this if you only want to stop future terrain from placing new vanilla spawner blocks.
[General]
Enabled=true
GenerateSpawnerBlocks=false
AllowSpawnerActivation=true
GenerateLootBlocks=true
LogBlockedActivation=falseUse this if you want already-existing spawners to stay in the world but stop being clickable.
[General]
Enabled=true
GenerateSpawnerBlocks=true
AllowSpawnerActivation=false
GenerateLootBlocks=true
LogBlockedActivation=falseUse this if you want spawners untouched but want newly generated random loot blocks disabled.
[General]
Enabled=true
GenerateSpawnerBlocks=true
AllowSpawnerActivation=true
GenerateLootBlocks=false
LogBlockedActivation=falseUse this for cleaner new terrain generation.
[General]
Enabled=true
GenerateSpawnerBlocks=false
AllowSpawnerActivation=true
GenerateLootBlocks=false
LogBlockedActivation=falseUse this if you want no new vanilla spawners and do not want old vanilla spawners to be activated.
[General]
Enabled=true
GenerateSpawnerBlocks=false
AllowSpawnerActivation=false
GenerateLootBlocks=true
LogBlockedActivation=falseEnable logging only when debugging:
LogBlockedActivation=trueLogBlockedActivation=true can get noisy if players repeatedly click old spawner blocks.
VanillaSpawners does not scan your save and remove old blocks from already-generated chunks.
The generation toggles affect new terrain generation after the mod is loaded and the relevant config option is disabled.
This means:
- old spawner blocks can still exist,
- old loot blocks can still exist,
- already-saved chunks are not automatically rewritten,
- disabling activation can make old spawners non-clickable without deleting them.
When GenerateSpawnerBlocks=false, the mod blocks the vanilla paths that place new cave, alien, hell, and boss spawner blocks.
For normal cave/alien/hell spawner generation, the mod replaces the generated enemy block result with BlockTypeEnum.Empty.
For hell floor boss spawner generation, the mod skips the boss-spawner generation method entirely.
When AllowSpawnerActivation=false, the mod patches the vanilla clickable-spawner check so spawner block types are not treated as clickable.
This does not remove the spawner block from the world. It only prevents the patched game/host instance from treating the block as a clickable spawner.
When GenerateLootBlocks=false, the mod blocks two vanilla loot paths:
- ore-deposit generated loot blocks,
- cave-column generated
LootBlock/LuckyLootBlockblocks.
The cave-column patch scans the generated column and changes newly placed loot blocks back to BlockTypeEnum.Empty.
After editing the INI, run:
/vanillaspawners reload
The reload command updates the runtime values used by the Harmony patches. You do not need to restart the game just to change these config values.
If you rebuild the DLL or change C# code, restart the game after replacing the DLL.
Some CastleForge setups may already include VanillaSpawners-style options inside ModLoaderExtensions.
If you use this standalone mod, do not let two different configs fight over the same generation/clickable-spawner behavior.
Recommended standalone-mod setup for ModLoaderExtensions.ini:
[VanillaSpawners]
GenerateSpawnerBlocks = true
AllowSpawnerActivation = true
GenerateLootBlocks = trueThen control the feature from this mod's config instead:
!Mods\VanillaSpawners\VanillaSpawners.Config.ini
If you prefer the integrated ModLoaderExtensions version, do not install this standalone DLL.
VanillaSpawners works by applying focused Harmony patches to vanilla CastleMiner Z generation and block-interaction methods.
On load, the mod:
- initializes the embedded resolver,
- creates the command dispatcher,
- extracts embedded resources if needed,
- loads or creates
VanillaSpawners.Config.ini, - applies Harmony patches,
- registers chat commands through ModLoaderExtensions,
- registers its help entries.
Config values are loaded into a config snapshot and then applied to static runtime switches:
VanillaSpawnerRuntime.Enabled
VanillaSpawnerRuntime.GenerateSpawnerBlocks
VanillaSpawnerRuntime.AllowSpawnerActivation
VanillaSpawnerRuntime.GenerateLootBlocks
VanillaSpawnerRuntime.LogBlockedActivation
The Harmony patches read those runtime switches instead of reading the config file directly.
| Vanilla method | Patch type | Purpose |
|---|---|---|
CaveBiome.GetEnemyBlock(...) |
Prefix | Blocks normal cave / alien / hell spawner block generation when disabled |
HellFloorBiome.CheckForBossSpawns(...) |
Prefix | Blocks hell floor boss spawner generation when disabled |
BlockType.IsSpawnerClickable(...) |
Prefix | Makes existing spawner blocks non-clickable when activation is disabled |
OreDepositer.GenerateLootBlock(...) |
Prefix | Blocks ore-deposit generated loot blocks when disabled |
CaveBiome.BuildColumn(...) |
Postfix | Removes cave-column LootBlock / LuckyLootBlock placements when disabled |
The activation logging helper recognizes these vanilla clickable spawner types:
EnemySpawnOff
EnemySpawnRareOff
AlienSpawnOff
HellSpawnOff
BossSpawnOff
Some cave loot blocks are placed directly inside CaveBiome.BuildColumn(...) rather than through OreDepositer.GenerateLootBlock(...).
Because of that, the mod includes a postfix that scans the newly built vertical column and changes any new LootBlock or LuckyLootBlock entries back to empty blocks when loot generation is disabled.
- The mod does not retroactively clean existing saves.
- Already-generated spawners and loot blocks can still exist in old chunks.
- The mod only controls the patched local game/host instance.
- Multiplayer behavior is safest when the host runs the mod and players are using the same CastleForge setup.
- If another mod patches the same generation methods, load order and patch behavior may matter.
- If ModLoaderExtensions also has integrated VanillaSpawners controls enabled, you may get confusing behavior from two configs controlling similar logic.
LogBlockedActivation=truecan produce a lot of log output.- The mod does not add new items, mobs, models, textures, recipes, or world-cleanup commands.
- Changes to generation settings only affect newly generated terrain after the config is active.
Important files:
VanillaSpawners.cs
Startup\VanillaSpawnersConfig.cs
Patching\GamePatches.cs
Important project details:
Target framework: .NET Framework 4.8.1
Platform target: x86
Language version: C# 7.3
Output path: $(BuildOutputRoot)\$(Configuration)\!Mods\
Expected project layout:
VanillaSpawners/
├─ Embedded/
│ ├─ 0Harmony.dll
│ ├─ EmbeddedExporter.cs
│ └─ EmbeddedResolver.cs
├─ Patching/
│ └─ GamePatches.cs
├─ Properties/
│ └─ AssemblyInfo.cs
├─ Startup/
│ └─ VanillaSpawnersConfig.cs
├─ README.md
├─ VanillaSpawners.cs
└─ VanillaSpawners.csproj
To add the project to the CastleForge solution:
- Open the CastleForge solution in Visual Studio.
- Right-click the
Modssolution folder. - Select Add > Existing Project...
- Choose:
CastleForge\Mods\VanillaSpawners\VanillaSpawners.csproj
The mod was based on the CastleForge Example mod foundation, with the Example-style embedded resolver/exporter and command registration pattern preserved.
- RussDev7 - CastleForge / VanillaSpawners mod implementation
- CastleForge ModLoader - runtime mod loading and Harmony patch support
- ModLoaderExtensions - shared command infrastructure
- Harmony - runtime method patching
- DigitalDNA Games / CastleMiner Z - original CastleMiner Z game
This project is open source and licensed under the GPL-3.0-or-later.
See the repository LICENSE file for full details.
