premium banner
Place a Magic Sloth Guard cauldron - three Slothian warriors spawn, patrol the area and attack hostile mobs in a configurable radius. Owner-only block, auto-respawn after restarts, no commands needed.

Description

GlymeraSlothGuard - Magic Sloth Guard Cauldron

Place a Magic Sloth Guard cauldron and three loyal Slothian warriors spawn around it. They patrol the area and attack any hostile mob that wanders too close. The cauldron is owner-protected - only you can pick it back up.


What is GlymeraSlothGuard?

GlymeraSlothGuard adds a single craftable block - the Magic Sloth Guard cauldron - that turns any spot in your world into a defended zone. Place the cauldron, and a small team of Slothian warriors spawns and starts patrolling. They will detect hostile NPCs in a configurable radius, lock onto them, run them down and attack until the threat is gone. Break the cauldron and the warriors despawn instantly.

Designed as a stationary, low-maintenance defence: no taming, no commands, no upkeep. Place, defend, retrieve.

Includes its own asset pack with the custom Magic Sloth Guard block (a glowing alchemy cauldron with bubbling sound and particles) and the Slothian warrior NPC role.


Features

Stationary Guard System

  • Place a Magic Sloth Guard cauldron, three Slothian warriors spawn around it
  • Warriors continuously patrol within a small radius around the cauldron
  • Warriors are friendly to all players (they cannot be damaged by player attacks)
  • Warriors take normal damage from hostile NPCs and can be killed in combat
  • When all warriors die they automatically respawn while the cauldron is still placed

Combat AI

  • Hostile-mob scan every second within actionRadius blocks of the cauldron
  • Round-robin target distribution across all warriors of one cauldron
  • Warriors lock onto a target and run it down using native Hytale chase AI
  • Melee attacks at attackRange with configurable damage and swing interval
  • Built-in stuck-detection nudges any warrior that has not moved for 3 seconds

Owner-Only Block Protection

  • The cauldron block cannot be damaged, broken or interacted with by other players
  • Three layers of protection: DamageBlockEvent + BreakBlockEvent + UseBlockEvent.Pre
  • OPs can always interact (admin override)
  • Only the owner gets the cauldron back as an item when breaking it

Auto Spawn / Auto Despawn

  • Placing the cauldron auto-detects the placement on the next scan tick (~5 seconds) - no commands needed
  • Breaking the cauldron auto-despawns all spawned warriors
  • Warriors respawn automatically after a server restart while the cauldron is still placed
  • Anti-duplication sweep every 10 seconds removes stray warriors near the cauldron that are not in the active tracking list

Per-Player Limit

  • Each player can have a configurable number of active Magic Sloth Guard cauldrons (default: 3)
  • When the limit is reached, placing another shows a chat notice and the placement is reverted

Persistence

  • Cauldron data is stored as JSON under plugins/GlymeraSlothGuard/data/blocks.json
  • Owner UUID, world, coordinates of every active cauldron survive server restarts
  • Warriors are respawned on chunk-load after a restart

Crafting Recipe

  • Recipe is opt-in via config (craftingEnabled, default true)
  • Bench: Alchemy Bench, category: Alchemy
  • Inputs: 1 × Alchemy Cauldron Big + 50 × Ingredient Life Essence
  • Output: 1 × Magic Sloth Guard
  • Essence quantity is configurable

Configuration

config.json (plugins/GlymeraSlothGuard/config.json)

maxBlocksPerPlayer       : 3
maxSlothsPerBlock        : 3
actionRadius             : 20
attackNeutral            : false
combatTickMs             : 1000
blockScanTickMs          : 5000
attackDamage             : 25.0
attackIntervalMs         : 1500
attackRange              : 2.5
craftingEnabled          : true
recipeEssenceQuantity    : 50
Field Description
maxBlocksPerPlayer Maximum simultaneous Magic Sloth Guards a single player may place
maxSlothsPerBlock Number of warriors that spawn per cauldron
actionRadius Radius in blocks around the cauldron in which hostile NPCs are detected
attackNeutral If true, warriors also attack currently-neutral NPCs that can turn hostile
combatTickMs How often the combat tick runs (target scan + melee attempt)
blockScanTickMs How often the block scan runs (auto-detect placements / removals)
attackDamage Damage per swing
attackIntervalMs Minimum delay between two swings of the same warrior
attackRange Distance in blocks at which a warrior can hit its target
craftingEnabled If true, generates the Alchemy-Bench recipe; if false, removes it
recipeEssenceQuantity How many Ingredient_Life_Essence are needed to craft one cauldron

Installation

  1. Place GlymeraSlothGuard-1.0.0.jar in your server's mods/ folder
  2. Start (or restart) the server
  3. Done. Config is auto-generated on first run.

How It Works

Placement Flow

  1. Player places a Magic Sloth Guard cauldron
  2. The block scan tick (every 5 seconds) finds the new block within 16 blocks of any online player
  3. Player limit is checked. If exceeded, the player is notified and the block is left untracked
  4. The block is registered with the player as owner and persisted to disk
  5. Three warriors are spawned in a circle 2 blocks around the cauldron at +1 Y

Removal Flow

  1. The owner (or an OP) breaks the cauldron - all other players are blocked by the 3-layer protection
  2. The block scan tick notices the block is gone and removes the entry
  3. All linked warriors are despawned in the same tick
  4. Persistence file is updated

Combat Flow

  1. Combat tick runs every 1 second
  2. For each cauldron with at least one warrior alive: scan every entity within actionRadius and collect hostile NPCs
  3. Hostiles are distributed round-robin across the warriors
  4. Each warrior gets its LockedTarget set to its assigned hostile and chases via native Hytale AI
  5. When the warrior is within attackRange, it deals attackDamage to the target via the ECS damage system
  6. When all hostiles are gone, locks are cleared and warriors return to patrolling

Anti-Duplication

Every 10 seconds, each cauldron sweeps a 30-block radius for any sloth-warrior NPCs that are not in its tracking list. These leftover entities (caused by chunk reloads, plugin restarts, or world edits) are removed. Combined with the auto-respawn logic, the warrior count stays exactly at maxSlothsPerBlock per cauldron under all server-state transitions.


Good to Know

  • The Magic Sloth Guard cauldron uses Hytale's existing Cauldron_Big model, so you'll see the familiar bubbling alchemy cauldron with the corrupted-bubbles particle and ambient sound
  • The warrior NPC reuses the Slothian Warrior appearance from Hytale's core assets - no custom skin work needed
  • Warriors are immune to player damage so neighbours can't grief by attacking them, but they still take full damage from hostile mobs and can be killed
  • Warriors only attack HOSTILE NPCs by default. Set attackNeutral to true if you want them to also engage neutral mobs that could turn hostile (less predictable - use with care)
  • Multiple cauldrons can safely overlap in radius. A hostile within range of two cauldrons will be engaged by warriors from both
  • Removing the cauldron drops it back as an item only for the owner. The 3-layer protection means non-owners cannot pick up or destroy it at all

Made with care by Glymera for the Hytale community