promotional bannermobile promotional banner

UnlimitedShield

Gives every living thing a shield that is very nearly impossible to break through.

Gives every living thing a shield that is very nearly impossible to break through. Its magnitude is stored in scientific notation, so a single shield can reach far beyond anything a floating point number could hold.

How a shield is built

A shield is written as z = x × 10^y, where y is a 64-bit integer:

  • y (the count shield) — active while y ≥ 0; each settlement takes the magnitude of the damage off it.
  • x (the fallback pool) — takes over once y falls below zero, where damage is summed rather than scaled and subtracted from x.

The shield only disappears when y < 0 and x is spent too. While it holds, the entity's health is frozen and almost nothing gets through.

Settlement

Every 20 ticks (configurable) everything taken during that window is settled at once.

Damage settlement never multiplies the batch. It sums the binary exponents of the damage values and converts the total to decimal, which cannot overflow, underflow or produce a NaN, and costs less floating point work.

Hit-count settlement is driven by the entity's hitsY, and the two stack:

hitsY What settles
0 damage only
1..127 damage and hit count
-1..-127 hit count only
-128 y switched off; the shield becomes a pure fallback pool

Special values never enter the maths and apply a fixed change instead: 0 → y += 256, ∞ → y -= 384, NaN → y -= 512.

What it resists

While the shield holds the entity cannot die, drops no loot or experience, and is not knocked back. Beyond ordinary attack damage that covers direct health writes, instant healing, health that overflows or goes negative, and instant-kill effects.

How shields are obtained

  • Hostile creatures — granted on spawn, shaped by the config.
  • Neutral and passive creatures — never granted one.
  • Players — never granted one; use the commands.

Commands

Requires permission level 2.

/shield add <targets> <x> <y> [hitsY]   set a shield
/shield remove <targets>                remove it
/shield query <targets>                 read it back
/shield addnear <x> <y> <radius>        shield everything within a radius
/shield removenear <radius>             unshield everything within a radius

Reading a shield

V toggles shield inspection. While it is on, aiming at a shielded creature locks on: the value refreshes live and stays on screen even after you look away, until you aim at something else. A creature without a shield is only shown while you are actually looking at it.

Shield values also appear in tooltip-style overlays, independently of the keybind.

Enchantments

Enchantment Levels Effect
Bit Shield Removal 1–255 Applies to any item. Cuts the shield by whole powers of sixteen, taking off an order of magnitude at a time
Combo Shield Break 1–5 Main hand. The creature you hit counts as 2^level hits for that settlement
Combo Vulnerability 1 Main hand. Pushes the target's count shield one step further from zero
Shield Restoration Curse 1 Curse. Whatever you hit has its shield exponent doubled for that settlement

Setting the level of Bit Shield Removal: put a nether star and the enchanted item in a crafting grid. With the item as the origin (+y up, +x right), the star's offset sets the change:

          x=-2  x=-1   x=0  x=+1  x=+2
 y=-2      -32   -8    -2    -5    -7
 y=-1      -16   -4    -1    -3    -6
 y= 0       -2   -1     ·    +1    +2
 y=+1      +16   +4    +1    +3    +6
 y=+2      +32   +8    +2    +5    +7

Configuration

config/xmly_unlimitshield-common.toml. Every x / y value follows the same rule: positive is the value itself, negative is a multiplier of the entity's max health.

Key Default Meaning
mobSpawnX / mobSpawnY -7 / -1 Shape of a naturally spawned shield
mobMaxX / mobMaxY 1e10 Creatures' x / y caps
playerMaxX / playerMaxY 1e10 / 1 Players' x / y caps
defaultHitsY 0 Default hitsY
settleInterval 20 Settlement interval, in ticks
lockHealth true Freeze health while shielded; healing is folded into the shield
grantToMonsters true Shield hostile creatures on spawn
blockKnockback true Immune to knockback while shielded
blockDirectRemoval false Refuse outright deletion of a shielded entity
debugSettlementLog false Log every shield change

For modpacks

A naturally spawned shield has a fixed shape from the config. To scale it with progression or quest completion:

  • listen for ShieldGrantEvent, which fires before a shield is handed out and allows changing x and y or cancelling it entirely;
  • or call the static methods on UnlimitedShieldApi at any time to read or rewrite a shield.

UnlimitedShield Team

profile avatar
Owner
  • 3
    Projects
  • 170
    Downloads

More from xmlySUM