Fix shulker loot-table compatibility by using Lootable #5

Merged
NotAlexNoyle merged 1 commits from codex/fix-gradle-build-error-for-shulkerbox into master 2026-03-18 10:08:06 -04:00
NotAlexNoyle commented 2026-03-18 08:00:50 -04:00 (Migrated from github.com)

Motivation

  • Avoid compile errors on older Bukkit APIs that don't expose ShulkerBox#getLootTable / setLootTable while preserving the runtime loot-table cleanup behavior.

Description

  • Replace the direct ShulkerBox usage in TileLootTableListener with a generic BlockState check and Lootable usage so code compiles against older API versions.
  • Remove the import org.bukkit.block.ShulkerBox; and instead obtain the BlockState from BlockStateMeta and test instanceof Lootable for item dispense handling.
  • Keep the existing server-version runtime guard (checkForLootable) and the generic fixLootTable(Block) path unchanged so behavior is preserved on versions that support loot tables.

Testing

  • Ran ./gradlew clean build eclipse --warning-mode all before the change and observed the cannot find symbol compile errors for getLootTable / setLootTable in TileLootTableListener, which this change addresses. (original failure reproduced)
  • After the change attempted ./gradlew clean build eclipse --warning-mode all in this environment but a full build could not complete due to environment issues: Gradle/Kotlin rejected Java 25.0.1 until switching to Java 17, and dependency resolution then failed with HTTP 403 responses from remote Maven repositories, so an end-to-end build could not be verified here. (source-level compile issue fixed locally in the modified file)

Codex Task

### Motivation - Avoid compile errors on older Bukkit APIs that don't expose `ShulkerBox#getLootTable` / `setLootTable` while preserving the runtime loot-table cleanup behavior. ### Description - Replace the direct `ShulkerBox` usage in `TileLootTableListener` with a generic `BlockState` check and `Lootable` usage so code compiles against older API versions. - Remove the `import org.bukkit.block.ShulkerBox;` and instead obtain the `BlockState` from `BlockStateMeta` and test `instanceof Lootable` for item dispense handling. - Keep the existing server-version runtime guard (`checkForLootable`) and the generic `fixLootTable(Block)` path unchanged so behavior is preserved on versions that support loot tables. ### Testing - Ran `./gradlew clean build eclipse --warning-mode all` before the change and observed the `cannot find symbol` compile errors for `getLootTable` / `setLootTable` in `TileLootTableListener`, which this change addresses. (original failure reproduced) - After the change attempted `./gradlew clean build eclipse --warning-mode all` in this environment but a full build could not complete due to environment issues: Gradle/Kotlin rejected Java `25.0.1` until switching to Java 17, and dependency resolution then failed with HTTP 403 responses from remote Maven repositories, so an end-to-end build could not be verified here. (source-level compile issue fixed locally in the modified file) ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69ba91ca25dc832f90ab7b2ff8cfbbda)
Sign in to join this conversation.