promotional bannermobile promotional banner

ProtectionBlocks

ProtectionBlocks allows players to secure their builds with customizable protection blocks and manage permissions with ease.
Back to Files

protectionblocks-1.0.7.jar

File nameprotectionblocks-1.0.7.jar
Uploader
ReaperFtxReaperFtx
Uploaded
Jul 2, 2026
Downloads
15
Size
8.4 MB
Mod Loaders
Forge
File ID
8358835
Type
R
Release
Supported game versions
  • 1.20.1

Curse Maven Snippet

Forge

implementation fg.deobf("curse.maven:protection-blocks-1351203:8358835")

Learn more aboutย Curse Maven

What's new

๐Ÿš€ v1.0.7 โ€” Currency mode, upgrade slots & modern GUI

Massive release. Protection blocks can now be tied to an economy item (any item from any installed mod) that they consume over time โ€” configurable per server. Each block also gets 4 upgrade slots to insert other protection blocks and extend its range, at the cost of extra fuel. The whole management GUI has been redesigned from scratch: modern dark theme, live search for allies, in-game HSV color picker, and the wireframe now goes x-ray so you can inspect the real protected volume through walls and terrain.


๐Ÿ†• Currency mode โ€” protection needs fuel

Opt-in mechanic where each protection block must hold a configurable "currency" item inside; it consumes a fixed amount per minute. If the slot runs out, the protection stops applying โ€” the block stays in the world but no longer blocks intruders, and even the cube itself becomes breakable by third parties (explicit "raid if you neglect it" mechanic).

  • Any item from vanilla or any mod on the server can be the currency (e.g. minecraft:diamond, bubustein_money:banknote, whatever).
  • Per-tier cost multiplier: Basic ร—1, Advanced ร—2, Superior ร—3, Elite ร—5, Master ร—8. A Master block at costPerMinute=1 consumes 8 items/min.
  • Refill from anywhere in the inventory โ€” the mod scans the hotbar, main slots and offhand looking for the currency item. No need to swap it to the main hand.
  • Live time tracking: the GUI shows time remaining in Xh Ym Zs and previews the extra time you'd add with the amount typed in the input.
  • Discord alerts when the block has <5 min of fuel left (fuel_low) and again when it runs out (fuel_depleted), in all 5 bot languages.
  • Configurable in-game from the admin ConfigScreen โ€” new "Currency" tab: enable/disable, currency item id, base cost per minute.
  • Master switch is OFF by default โ€” 100% backwards compatible with existing worlds.

๐Ÿ†• Upgrade slots โ€” extend range at the cost of fuel

Every protection block now has 4 slots where you can insert other protection blocks to grow the protected radius.

  • Effective range = base radius + ฮฃ (base radius of each tier inserted). A Master (r=12) with an Advanced + Superior + Elite inserted covers 34 blocks of radius instead of 12.
  • Effective fuel cost = costPerMinute ร— (main tier mult + ฮฃ inserted tier mults). More range = more consumption. A fully upgraded Master consumes 1 ร— (8 + 8 + 8 + 8 + 8) = 40 items/min at cost=1.
  • Insert with the new + Increase range button (auto-picks the first protection block from your inventory), remove by clicking the slot.
  • The wireframe visualization updates in real time when you add/remove upgrades โ€” no need to toggle "Show area".
  • When the protection block is broken, all inserted upgrades and the remaining fuel drop back to the world.
  • The ProtectionAreaCache re-indexes affected chunks on every upgrade change, so protection actually covers the new radius immediately.

๐Ÿ†• X-ray wireframe + HSV color picker

  • X-ray mode: the "Show area" wireframe now draws through blocks, walls and terrain โ€” you can inspect the real protected volume underground or behind cover. Implemented with a manual Tesselator path so we can control disableDepthTest directly (RenderType.lines() applied its own depth state that overrode the previous approach).
  • Toggle X-ray checkbox in the management GUI in case you find the see-through effect distracting โ€” the flag is a session preference (default ON).
  • HSV color picker: the "Color" button now opens an inline dialog with a hue bar (60 segments of full rainbow) + a 40ร—16 SV grid. Any color can be applied, updates the wireframe instantly if "Show area" is on. Replaces the old 8-color cycle.

๐ŸŽจ Redesigned management GUI (ModernUI)

The old management screen was completely rewritten around a new ModernUI primitive module (panel/card/box/header helpers with a single color palette).

  • Dark panel with pastel accents (purple, green, amber, red) matching the web dashboard style. Semi-transparent overlay behind, 1px card borders, hover states everywhere.
  • Centered header with the block's actual texture next to the title, and a subtitle showing "tier ยท range ยท owner" at a glance.
  • Ally list: each row has an 8ร—8 avatar with the player's initial in accent purple, name in pastel green, permissions muted, a "manage" button (opens the permission dropdown) and a ๐Ÿ—‘ trash button.
  • Add ally = 1 click. New + Add ally button opens an inline picker (dialog above the UI, not a separate Screen) with live-search by prefix + scroll + auto-add on click. Replaces the old input+dropdown+button combo.
  • Auto-clear of the "Zone name" default placeholder on focus โ€” start typing right away without deleting first.
  • Fuel row reorganized: state + preview on line 1 (with the currency item's display name โ€” e.g. "+ 32m 0s with 64x Diamond"), icon + input + arrows โ†“ โ†‘ on line 2, aligned left.
  • Fuel input starts with the block's current stack count (0 if empty), and auto-syncs with server changes while the user hasn't manually edited it.
  • Upgrades section shows the total effective range in real time next to the label ("โ†’ 23 total blocks").
  • Uniform 16 px vertical gap between sections โ€” no more "buried" fuel row.
  • Elastic panel width (460โ€“500 px) that adapts to the screen without leaving dead space.

๐Ÿ›ก๏ธ Grace period โ€” safe currency migrations

Three-layer safety net for when the admin changes the currencyItem or the cost while players still have blocks running on the old settings.

  • Automatic (always on): the fuel ticker now consumes whatever item is inside the slot, not just the currently-configured one. Player fuel investments are never wasted โ€” the old item is spent down at the normal rate until it runs out, and only then does the new item need to be inserted to keep protection alive. Prevents the "infinite free protection" exploit that came from a strict item-match check.
  • Manual (admin action, custom duration): new "Grant grace period" button in the ConfigScreen โ†’ Currency tab with H : M : S inputs so admins can dial any duration (default 24h). One click and the fuel ticker suspends across the entire server โ€” no block loses fuel during the window. The button label refreshes live as you type ("Grant 12h 30m 0s grace period"). A companion "Cancel active grace" button reverts immediately. The system chat message confirms the actual duration granted, not a hardcoded "24 hours".
  • The timestamp is persisted to config/protectionblocks/grace_until.txt and survives server restarts. Only OPs can grant/cancel; the client just sends a request and the server stamps it with its own clock (no client-side clock skew).
  • UI feedback: while grace is active every protection block's GUI shows a green pastel label "๐Ÿ›ก Grace active ยท Xh Ym Zs remaining" replacing the normal fuel state, plus a muted hint "(refills consumed after grace ends)" so players know they can refuel without losing anything.
  • No retroactive damage: at the first server tick after the grace expires, if a block wasn't ticked during the whole window its lastConsumeMs is bumped forward to the grace's end. Without this the ticker would compute elapsed = now โˆ’ lastConsumeMs including the grace hours and drain the stack instantly. Player fuel now survives every grace window intact.
  • Protection still applies during grace: isActive() returns true for every block while grace is on, even if their slot is empty. Fixes the bug where the visual grace was shown but the block was silently unprotected โ€” non-allies could break inside without penalty.

๐Ÿ’ฐ Currency system โ€” fractional costs, cleaner UI

The cost model, the admin UI and the player GUI got a complete overhaul in v1.0.7.

  • Cost as "X items per Y minutes": the old costPerMinute (int, 1โ€“100) has been replaced by two independent config keys โ€” costItemCount (int) and costDurationMinutes (double, 0.1โ€“1440). The admin now expresses cost as "N items last Y minutes", supporting sub-item-per-minute rates. Examples:
    • 1 item / 10 min โ†’ a single diamond lasts 10 minutes.
    • 3 items / 5 min โ†’ 0.6 items/min.
    • 1 item / 1.5 min โ†’ 40 items/hour.
  • Fractional consumption for real: the internal fuel ticker no longer runs on "minute ร— ceil(cost/min)" (which was rounding any ratio < 1 up to 1). It now uses msPerItem = 60_000 / costPerMinuteFloat and consumes one item every msPerItem. A "1 item / 10 min" config actually consumes one diamond every 10 minutes, not one every minute like before.
  • Real countdown on the GUI, always accurate: the server now sends a precise secondsLeft computed from lastConsumeMs. Before, the client did stackCount ร— 60 / costPerMinute and re-received a fresh packet on every GUI reopen, so the timer reset to the maximum every time you closed and reopened the interface (10:00 โ†’ close โ†’ open โ†’ 10:00 again). Now the countdown reflects the actual server clock โ€” Xh Ym Zs baseline from the server, minus now โˆ’ receivedAtMs for the tick-to-tick smoothness.
  • Layout of the fuel section rewritten from a single crowded line to three clean lines:
    Fuel: 1 (0.1x Diamond/min)
    Time remaining: 00:09:57
    ๐Ÿ”ท [1] [โ†“] [โ†‘]
        
    The first line shows the effective rate with the currency item's display name (Diamond, not minecraft:diamond). Second line is a live HH:MM:SS counter in soft blue. Third line has the icon, the refill/withdraw buttons compressed to just โ†“ / โ†‘, and the amount input.
  • Depositing on an empty slot resets the countdown. Previously the last lastConsumeMs stayed around even after the slot emptied. If the block had been empty for hours and the player deposited a diamond, the very next tick would compute an elapsed of hours and instantly consume the item. Now deposits into an empty slot reset the clock so the new fuel is used properly.
  • Broadcast on config save: when the admin clicks "Save" in the ConfigScreen, the server iterates every loaded protection block in every dimension and broadcasts a fresh SyncFuelStatePacket. Every player watching a block sees their remaining time recalculated instantly, no need to reopen the GUI or wait for the next server-side tick.

โš™๏ธ Admin ConfigScreen โ€” Currency tab

  • Item autocomplete: typing in the "Currency item" field pops up a floating list of up to 5 registry item IDs matching your query (from all installed mods). Click one to autofill. Focus loss hides it. Works on ForgeRegistries.ITEMS.getKeys(), so minecraft:diamond, modid:custom_coin, everything shows up.
  • Cost input compacted into a single row: Amount: [10] Duration: [5] Minutes โ€” all label widths computed dynamically with font.width() so nothing overlaps in any of the 5 mod languages.
  • Grace H:/M:/S: inputs โ€” three compact input boxes with single-letter labels. The button label refreshes as you type, so you always see exactly what you're about to grant.

๐Ÿ› Fixed

  • Player names saved as "Unknown" after server shutdown. The shutdown-save queried PlayerList.getPlayer(uuid) after all players had already disconnected โ†’ all entries got "Unknown" except the one who triggered the stop. Now falls back through 3 layers: online player โ†’ server.getProfileCache() (persisted vanilla cache) โ†’ an internal NAME_CACHE seeded on player login and when loading the JSON. Never "Unknown" again unless the UUID was truly never seen.
  • Massive cache add/remove loop spamming the log with thousands of lines per second. ProtectionAreaCache.findProtectionForPosition was interpreting "block entity's chunk is unloaded" as "orphan entry" and cleaning the cache; a moment later indexChunk re-added it โ†’ infinite ping-pong. Now checks level.hasChunk(cx, cz) before cleaning: only remove if the chunk is loaded and there really is no BE there. Also silenced the noisy per-op logs (they weren't diagnostic value at this point).
  • PauseScreen button overlap with HeadRoles / other admin mods. Both mods listened to ScreenEvent.Init.Post at NORMAL priority and colored their buttons at fixed bounds(6, 6, 70, 16) โ€” whoever fired first won the coordinate; the other one drew on top. Our handler now uses EventPriority.LOWEST so we always run last and computeNextFreeX() can walk existing widgets and place the button after all neighbours.
  • Depleted protection cube was still indestructible to non-owners. The path that catches breaking the cube itself (as opposed to blocks inside the zone) went through instanceof ProtectionBlockEntity directly and never checked isActive(). Fixed: when currency mode is on and the fuel is out, the cube is breakable by anyone โ€” coherent with the "no fuel = no protection" contract everywhere else.
  • Client showed "depleted" behind the server for minutes. Fuel state was only broadcast to clients on GUI open + deposit/withdraw. Now the cron ticker also fires SyncFuelStatePacket after each consumption, so the label updates in real time in every connected client watching that chunk.

๐Ÿ†• Diagnostic command

  • /protection diag (OP only) inspects the block you're aiming at and reports everything the mod knows about it: owner UUID, isOwner(you), isActive, fuel count, tier, effective range, whether the block itself is a protection cube, and which protections cover this position. Invaluable when a player reports "it won't let me break X" โ€” you see instantly whether it's the mod, another mod, or spawn-protection.

๐ŸŒ Languages

All new labels, tooltips and Discord bot titles translated to the 5 mod languages: ๐Ÿ‡ช๐Ÿ‡ธ Spanish ยท ๐Ÿ‡ฌ๐Ÿ‡ง English ยท ๐Ÿ‡ฉ๐Ÿ‡ช German ยท ๐Ÿ‡ซ๐Ÿ‡ท French ยท ๐Ÿ‡ฎ๐Ÿ‡น Italian.


๐Ÿ”ง Under the hood

  • 7 new network packets: SyncFuelStatePacket, DepositFuelPacket, WithdrawFuelPacket, SyncUpgradeStatePacket, UpgradeSlotActionPacket, plus 2 extended existing ones with the new sync fields.
  • New client-side caches: ClientFuelCache, ClientUpgradeCache โ€” the GUI reads exclusively from these to avoid depending on client-side BE snapshots.
  • ProtectionAreaRenderer rewritten to push line vertices through Tesselator directly (bypassing RenderType.lines()) so we can control depth test / cull / blend / line width manually. Enables the x-ray toggle without an access transformer.
  • Config schema extended with currency section (enableCurrencyMode, currencyItem, costPerMinute) โ€” round-tripped through ConfigSnapshot so the in-game admin ConfigScreen can edit it live.
  • ProtectionBlockEntity persists currencyStack, lastConsumeMs, lowFuelWarned and the 4 upgrade slots in NBT, omitting empty entries to keep the save compact.

๐Ÿ“ฆ Compatibility

  • Minecraft 1.20.1
  • Forge 47.x (built against 47.4.8)
  • Client & Server (currency & upgrades are server-driven; the client is authoritative only for the wireframe rendering + x-ray toggle)

ยฉ 2026 vicxelcode โ€” MIT License

This mod has no additional files