Skip to content

Optimize universal block detection to avoid expensive NBT lookups - #1222

Merged
StarWishsama merged 1 commit into
masterfrom
codex/github-mention
Jul 6, 2026
Merged

Optimize universal block detection to avoid expensive NBT lookups#1222
StarWishsama merged 1 commit into
masterfrom
codex/github-mention

Conversation

@StarWishsama

Copy link
Copy Markdown
Member

Motivation

  • Reduce hot-path overhead observed in the Spark report where explosion/physics handling frequently invoked universal block checks.
  • Avoid synchronous NBT/PersistentData reads for blocks that cannot possibly hold universal data (non-tile-entities) to improve performance during bulk block operations.

Description

  • Updated StorageCacheUtils.hasUniversalBlock(Location) in src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/util/StorageCacheUtils.java to first check the in-memory universal block cache before any NBT lookup.
  • Added a tile-entity guard using Slimefun.getBlockDataService().isTileEntity(...) to immediately return false for non-tile blocks.
  • Deferred the expensive getUniversalDataUUID call behind TaskUtil.runSyncMethod(...) and only execute it when the block is a tile-entity and not present in the cache.

Testing

  • Ran git diff --check without issues.
  • Attempted ./gradlew compileJava but the Gradle distribution download was blocked by the environment proxy (HTTP 403), so a full compile could not be completed.
  • mvn -q -DskipTests compile is not applicable because the repository uses Gradle and there is no top-level pom.xml.

Codex Task

@StarWishsama
StarWishsama merged commit 1dd713f into master Jul 6, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant