▶️ ЗАБЕРИ СВОИ 8 ПОДАРКОВ 🎁 ПРИ СОЗДАНИИ СВОЕГО МАЙНКРАФТ СЕРВЕРА
Моды/CobblemonOptimizer
CobblemonOptimizer

CobblemonOptimizer

CobbleOptimizer is a server-side Fabric mod that reduces lag caused by Cobblemon's Pokemon entities.

3.5K
17
Все версииCobblemonOptimizer 2.0.0

CobblemonOptimizer 2.0.0

Release1 мес. назад

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

Scalability Review

Analyzed the full codebase for a 50-70 player server. Confirmed it can handle the load — the main bottleneck is PlayerTracker distance cache at O(players ×
pokemon) per tick, but with 70 players and 300 Pokemon the math operations are trivial for the JVM. Provided recommended config values for large servers.

Feature: Species Blacklist

Added a configurable blacklist to prevent specific Pokemon species from being despawned.

  • New config field: batch_despawn.species_blacklist = ["pikachu", "eevee"]
  • New commands: /cobbleoptimizer blacklist add/remove/list
  • Case-insensitive matching, auto-saves to TOML

Made Everything Configurable

Exposed all previously hardcoded values:

  • batch_despawn.protect_shiny/legendary/mythical/ultra_beast — toggle protections on/off
  • ai_freeze.cleanup_interval_ticks — stale entity cleanup interval
  • tps_monitor.sample_window — TPS averaging window (10-1000)

Bug Fixes

  1. Stale lastDespawnCount — now resets to 0 when batch despawn is disabled
  2. Missing validation — added bounds for targetPokemonPerWorld, maxDespawnPerCycle, minDespawnRadius to prevent negative values
  3. Config race condition — both TickThrottleManager and AiFreezeManager now read config once at method start instead of twice
  4. Blacklist lookup O(n) — cached as HashSet for O(1) lookups

Performance Improvements

  • PlayerTracker HashMap pre-sized to 256 (fewer rehashes)
  • Replaced java.util.Random with ThreadLocalRandom (lock-free)

Feature Improvements

  1. AI Freeze is now TPS-aware — only freezes AI when TPS drops below ai_freeze.tps_threshold (default 18.0). No more freezing Pokemon for no reason at 20 TPS.

  2. Spawn statistics tracking — /cobbleoptimizer status now shows blocked: X/Y (how many spawns were blocked out of total).

  3. Detailed despawn logging — logs now show species breakdown: Batch despawn: removed 8 [rattata x3, pidgey x2, zubat x3]

  4. Emergency Mode — new [emergency] config section that coordinates all features when TPS is critically low (default <12):

  • Aggressive tick skip interval (1 in 5)
  • Tighter AI freeze radius (24 blocks)
  • Blocks all spawns
  • Forces immediate despawn sweep
  • Logs activation/deactivation with TPS values
  1. Entity age in despawn scoring — newer Pokemon are despawned first (players haven't seen them yet). Older entities (50+ min) get up to -50 score penalty, making them less likely to be removed.

  2. Enhanced status command — shows protection flags, blacklist count, spawn stats, and emergency mode state.

Files Modified (13) + Created (1)

  • CobbleOptimizerConfig.kt — 3 new data classes, new fields
  • ConfigManager.kt — parse/write/keys/applyKeyValue for all new fields + blacklist methods
  • ConfigValidator.kt — validation for all new fields
  • CobbleOptimizer.kt — registers EmergencyManager
  • FeatureManager.kt — calls TpsMonitor.onConfigReload()
  • TpsMonitor.kt — configurable sample window with hot reload
  • PlayerTracker.kt — pre-sized HashMap
  • TickThrottleManager.kt — consistent config read + emergency integration
  • AiFreezeManager.kt — TPS-aware + emergency freeze radius
  • AdaptiveSpawnManager.kt — spawn stats + ThreadLocalRandom + emergency block
  • BatchDespawnManager.kt — detailed logging + force sweep + stale count fix
  • DespawnPriority.kt — configurable protections + blacklist Set cache + age scoring
  • CobbleOptimizerCommand.kt — blacklist commands + enhanced status
  • NEW: EmergencyManager.kt — emergency mode coordinator

Файлы

CobbleOptimizer-2.0.0.jar(437.20 KiB)
Основной
Скачать

Метаданные

Канал релиза

Release

Номер версии

2.0.0

Загрузчики

Fabric

Версии игры

1.21.1

Загрузок

430

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

1 мес. назад

Загрузил

ID версии

Главная