▶️ ЗАБЕРИ СВОИ 8 ПОДАРКОВ 🎁 ПРИ СОЗДАНИИ СВОЕГО МАЙНКРАФТ СЕРВЕРА
SLib

SLib

Slib is a closed-source infrastructure library for Forge 1.20.1 mods. It unifies advanced networking mechanics and security guards, ensuring total stability for all dependent mods without the need for constant maintenance updates.

Оцените первым
699
0
Все версии→SLib 0.0.2

SLib 0.0.2

Release29.06.2026

Список изменений

Fixes

  • Fixed lazy Network.<clinit> crash on dedicated server and on Refresh Trades NetworkRegistry lock conflict. Channel is now created eagerly by Entry constructor and lazy accessors fall back to a thread-safe getInstance().
  • Fixed PlayerEvent.PlayerLoggedOutEvent.getPlayer() access on Forge 47.4.20 — switched to getEntity().
  • Fixed MinecraftServer.getServer() deprecation on dedicated server — replaced with anchor.getServer() for filtered broadcast.
  • Fixed PacketDistributor.TRACKING_CHUNK typing — now passes LevelChunk resolved from ServerLevel.getChunk().
  • Fixed double-counted rejected counter on null NBT tags during sanitize.
  • Fixed malformed-JSON negative depth leaking out of countJsonDepth — now returns Integer.MAX_VALUE plus a malformed flag.
  • Fixed escape-sequence double-counting in JSON string length scan.
  • Fixed unverified FMLJavaModLoadingContext.get() deprecation warning in Entry.
  • Fixed HashMap race surface in Registry.CONSUMER_VERSIONS — switched to ConcurrentHashMap.
  • IsolationRegistry is now real LRU. LinkedHashMap was created with accessOrder = false so eviction was FIFO; switched to accessOrder = true with an overridden removeEldestEntry. Modules that have not been touched recently are now actually evicted first, which matters once maxTrackedModules (1024) is reached by busy servers.
  • IsolationRegistry.clearFailureState now also wipes the sliding-window timestamp deque when it drops a module out of COOLDOWN. The window used to keep the last slidingWindowTicks worth of failures, so a module that recovered and then tripped once more was promoted to ISOLATED instantly because of stale history.
  • Failover.updateGameTime no longer takes the IsolationRegistry lock 1024 times per tick. New clearExpired(currentGameTime) walks every module under a single synchronized block and resets expired COOLDOWN entries in one pass.
  • PacketGuard.allowsCooldown(level, lastActionGameTime) was dead code — it never read the internal lastCooldownGameTime map. Removed; tryAcquire already enforces the cooldown against internal state.
  • PacketGuard no longer leaks per-player entries for disconnected players. tryAcquire and markRefreshed now call maybeCleanup(currentGameTime); the first call to advance past cleanupIntervalTicks (default 12000 ticks) drops entries that have been quiet for staleTicks (default 24000 ticks) through ConcurrentHashMap.entrySet().removeIf.
  • Boost.cancelSchedule no longer scans every player. Added a reverse index playersBySchedule (key -> set of player UUIDs) so cancellation is O(N players of that schedule), not O(all players Г— all schedules).
  • Boost.schedule now removes the entry from scheduledTasks before running the user work. Previously the entry was removed in finally, so a re-entrant schedule(same-key) call from inside the task could not cancel the in-flight task; the old one is now cancelled the moment the scheduler starts running it.
  • Boost.shutdown now calls ForkJoinPool.awaitQuiescence(2s) before awaitTermination(2s). ForkJoinPool.shutdown() alone does not drain queued tasks that are being cooperatively forked; awaitQuiescence forces the pool to actually wind down.
  • Network consumer-log spam is fixed. The direction-mismatch / null-sender / handler-crash branches used to log at WARN / ERROR on every single bad packet; an attacker holding a valid connection could fill the log file. Each branch now goes through a per-id 5-second throttle on the allocator, so each (id, kind) pair logs at most once every 5 seconds.
  • Network.nextId is now fully atomic. The registrationFrozen check, allocator lookup, slot reservation, id -> modId and id -> packetName writes, and the registration log entry all happen under a single synchronized (ALLOCATOR_LOCK). Previously the freeze check happened outside the lock and could race with freezeRegistration().
  • Network.registerSafe now throws IllegalStateException with a clear message if getInstance() returns null instead of crashing with a NPE deep in SimpleChannel. The eager Entry constructor still creates the channel, so this is a defensive guard for modders who might instantiate Network classes without running the entry point.
  • Boost.CleanupHooks.onPlayerLoggedOut now also calls Registry.clearPlayerState(playerId) so every registered PacketGuard releases the disconnected player's rate-limit and cooldown slots immediately instead of waiting for the periodic maybeCleanup sweep.
  • Network dropped the unused import java.util.Collection; that survived the cleanup pass and confused IDEs.

Improvements

  • Added SBS (Senior Boost and Stabilization) layer: Failover, SafeExecutor, IsolationRegistry, CrashReport, ModuleState, WarningScreen, SbsClient, SbsServer.
  • Added warning screen on client with BlurBackground fake-blur, Rounded panel and a single "Ignore and continue" button.
  • Added server-side crash logger that routes crashes through IsolationRegistry without ever loading client classes.
  • Added Boost layer: FrameMonitor sliding window (p50 / p95 / p99), TickBatcher with dedupe, Boost.offload(...) over ForkJoinPool, Boost.schedule/scheduleAsync/cancelSchedule/cancelAllSchedules/cancelPlayerSchedules.
  • Added per-player schedule binding through scheduleForPlayer(playerId, ...) so logout can cancel related work.
  • Added LevelEvent.Unload and PlayerLoggedOutEvent hooks in Boost that cancel pending schedules and clear the tick batcher automatically.
  • Added BlurBackground defensive disposal pattern with releaseAllocated / resetState / trackResource, plus WarningScreen.init / onClose cleanup hooks.
  • Added LRU + TTL eviction to TickBatcher and IsolationRegistry so dynamic keys (per-NPC UUIDs, per-chunk IDs) cannot grow the map without bound.
  • Added SendToAll(message, filter, anchor) with strict IllegalArgumentException for missing anchor or filter instead of a silent fail.
  • Added PlayerPreviewModel.dispose() cleanup of synthetic RemotePlayer, and guarded mc.getWindow() against null.
  • Added ItemIcon.renderInto(GuiGraphics, ...) zero-allocation overload for callers that already own a GuiGraphics.
  • Per-mod packet allocator uses double-checked locking on a dedicated ALLOCATOR_LOCK — external Forge calls are no longer performed under our lock.
  • Network dispatcher validates NetworkDirection and getSender() != null for PLAY_TO_SERVER, runs handlers inside enqueueWork, and catches any Throwable so a buggy handler cannot kill the packet pipeline.
  • IsolationRegistry exposes clearExpired(currentGameTime) for batch sweeps. Failover is the only caller in-tree, but external modders can call it from a server tick handler if they want explicit control over cooldown reclamation.
  • PacketGuard constructor takes a new cleanupIntervalTicks and staleTicks pair. Defaults are 12000 / 24000 ticks (10 / 20 minutes). Mods that know their player turnover can tune both down for aggressive cleanup or up for long-lived cooldowns.
  • Boost.schedule and Boost.scheduleAsync now share a single implementation: the scheduler thread only enqueues a deferred offload(...) so heavy work always lands on the ForkJoinPool instead of blocking the single scheduler thread.

UI / Sync

  • Slib now ships a single channel slib:main and is shared across every consumer mod through Network.namespace(modId). Consumer mods should migrate to Network.getInstance() instead of any prior static accessor.
  • Rounded.drawOutline now goes through the SDF shader (new IsOutline / OutlineThickness uniforms), so outlined rounded rectangles actually keep their corners on the outline ring instead of being an "enlarged rounded box" under the inner body. AA is still feather-aware at every GUI scale.
  • RoundedButton no longer takes eight to nine positional integers per constructor. There is one constructor: RoundedButton(x, y, w, h, label, onPress, Style). Static factories primary / primaryWithHoverOutline / secondary / danger cover the common cases.
  • Sidebar.mouseOver hit-test was rewritten. The previous version called Minecraft.getInstance().mouseHandler.xpos() * scale / window.width per item per frame and was inconsistent with PoseStack transforms. Sidebar.draw(gfx, style, x, y, width, items, activeIndex, itemH, gap, onSelect, mouseX, mouseY) now uses the same Sidebar.indexAt math the old draw path did for visuals.
  • TabBar extracted computeLayout(SafeArea, count, justify). draw and indexAt both consume the same Layout record now, so the visual layout cannot drift from the hit-test layout.
  • ItemIcon removed the legacy render / renderSized / renderCount overloads that created a fresh GuiGraphics per call. Only the zero-allocation renderInto / renderSizedInto / renderCountInto overloads remain.
  • ScissorClip stores a record Clip(int x, int y, int w, int h) on the stack instead of a new int[] per push.
  • SearchBar rewritten on StringBuilder with an explicit cursor, selection anchor, Backspace / Delete / Left / Right (with optional word jump) / Home / End, Ctrl+A select all, Ctrl+C / Ctrl+X / Ctrl+V and click-to-position-cursor. The previous O(n²) per-keystroke string concatenation is gone.
  • Style.hoverBorderColor (defaults to borderColor when unset) added so widgets can draw a distinct outline on hover without the consumer building a second Style. Stylesheet.Rule.hoverBorderColor(int) is wired through Stylesheet.applyRule.
  • Slider.valueFormat is a Component template; %s is replaced with the formatted number. The literal template is drawn otherwise.
  • Full UI + UX engine, split into two packages. The en.antinimus.slib.api.ui package is "how it looks" — primitives, drawing, layout, styles. The en.antinimus.slib.api.ux package is "how it behaves" — focus, navigation, feedback, events, data binding, scroll, modals. UI primitives: Layout (golden-ratio solver, modular 4dp scale, proportional gap shrink, bottom-anchored reserve, adaptive panel sizing, horizontal stack with START / CENTER / END / DISTRIBUTE justify), SafeArea (content box with inset / intersect / bottomAnchor / bottomStrip / splitHorizontal / right(width) / left(width) / mid(width)), Theme (gold + progress + tab + stat + divider tokens, progressFillColor(ratio) auto-picks critical / low / mid / high), Rounded (SDF shader), ScissorClip (nested clip regions), BlurBackground, Metrics (pixel-scale snap), ItemIcon, Style (immutable object + builder + withXxx(...) modifiers; presets Style.GOLD and Style.MODERN), Stylesheet (CSS-like cascade — Selector.tag("button").cornerRadius(8), Selector.clazz("primary").accentColor(...), Selector.id("submit"), applied via stylesheet.resolve(tag, id, classes, fallback) so a screen can re-skin an entire widget tree by changing one Stylesheet), Easing (LINEAR, EASE_IN, EASE_OUT, EASE_IN_OUT, EASE_IN_CUBIC, EASE_OUT_CUBIC, EASE_OUT_BACK overshoot, EASE_OUT_BOUNCE, EASE_OUT_ELASTIC), Animation + AnimationRunner + AnimationTicker (ClientTickEvent-driven runtime interpolation, valueOr(id, fallback) for read). Widgets in ui: RoundedButton (primary / secondary factories), TabBar, ProgressBar, SectionHeader, StatRow, Divider, Slider, Toggle, Dropdown, Sidebar, SearchBar (placeholder + caret blink + Backspace + Ctrl+V paste, plus the full keyboard model above), Stepper (+/- numeric input), Card (rounded container with title / subtitle / divider). UX patterns in ux: StateMachine<S, E> (typed FSM with transition / selfTransition / onEnter / onExit), Binding<T> (observable value, set fires listeners, bind(other) two-way sync, observeOnce), EventBus (typed events with on(Class, Consumer) returning Subscription with .cancel()), FocusManager (TAB navigation with Focusable.onFocus(boolean) + Shift+TAB reverse, optional onKey per focusable, focusById(id), wrap-around toggle), RippleEffect (Material-style click wave with RippleEffect.trigger(x, y, w, h, style) and global tick / renderAll), Tooltip (AUTO / ABOVE / BELOW / LEFT / RIGHT / FOLLOW_CURSOR positioning, configurable delay, auto-flip at screen edges, multi-line), Toast (Toast.success/info/warning/error(title, body), queue + max visible, slide-in / slide-out via AnimationRunner, color-coded per Level), ScrollContainer (vertical / horizontal with beginDrag / updateDrag / endDrag / tickKinetic for inertia + scrollWheel, themed scrollbar), Modal (animated open / close + backdrop dim + trapsClick), KeyboardShortcut (typed (modifiers, key, Consumer<Press>) bindings with MOD_CTRL / MOD_ALT / MOD_SHIFT / MOD_SUPER, fromGlfwKey / fromGlfwMods parser, describeKey / describeModifiers for display strings, conflict-safe handle), Drawer (LEFT / RIGHT / TOP / BOTTOM slide-in side panels with scoped animation IDs so multiple drawers coexist). WarningScreen is rewritten on top of these — overlap of the dismiss button with body text is now structurally impossible: the button lives in a bottomReserve slot, sections are measured first, and Layout.stack distributes Y-offsets inside the safe area with proportional gap shrink if the content overflows. Panel width follows clamp(viewportW / φ, minW, maxW) so the dialog scales gracefully with the window.
  • No public API change for consumer mods in the strict sense — 0.0.x is backward compatible. Style.hoverBorderColor is additive (defaults to borderColor), Sidebar.draw(gfx, style, x, y, width, items, activeIndex, itemH, gap, onSelect, mouseX, mouseY) is additive (the old overload is preserved and delegates with -1, -1). Consumer mods should still pin slib_version_range=[0.0.1,0.1.0).

Файлы

slib-0.0.2.jar(215.28 KiB)
Основной
Скачать

Метаданные

Канал релиза

Release

Номер версии

0.0.2

Загрузчики

Forge

Версии игры

1.20.1–1.20.6

Загрузок

46

Дата публикации

29.06.2026

Загрузил

ID версии

Главная