Wiki 9Minecraft Wiki 9Minecraft

How to Register Custom Shields Using KubeJS

Because Shield System Mod is a framework designed for modpack creators and custom worlds, it does not add shields to your world automatically. To get shields into your game, you need to register your own shield types using a KubeJS startup script.

Setting Up Your Script

1. Open your Minecraft instance folder and navigate to the kubejs/startup_scripts directory.

2. Open an existing script file or create a new .js file.

3. Add a registry event listener for shield_system:shield_type.

4. Inside the event block, define the types of shields you want in your world and save the file.

Choosing Shield Types

You can create four distinct behaviors when registering a shield inside the startup event:

  • Permanent Unit Shield: Use .createSimpleUnitShield() on your created event to make a basic shield that stays on the player or mob until knocked away by incoming attacks.
  • Shield Group: Use .createSimpleGroupShield() to register a structured pool that combines multiple unit shields together.
  • Timed Shield: Use .createTimeLimitedShield(ticks) to create a temporary buff that vanishes after a set duration. Because Minecraft runs at 20 ticks per second, entering 20 * 5 creates a shield that expires after 5 seconds.
  • Decaying Shield: Use .createDecayShield(ticks) to create an extra health layer that slowly drains away on its own over the specified number of ticks.