Class BlockUtilProvider

java.lang.Object
com.kamikazejam.kamicommon.nms.provider.Provider<AbstractBlockUtil>
com.kamikazejam.kamicommon.nms.provider.BlockUtilProvider

public class BlockUtilProvider extends Provider<AbstractBlockUtil>
Provider for version-specific block utility implementations.

This provider selects the appropriate AbstractBlockUtil implementation based on the current Minecraft version, handling the evolution of NMS block manipulation APIs across different Minecraft releases. Block utilities provide high-performance block placement operations that bypass normal Bukkit overhead.

The provider covers major API changes in Minecraft's block handling system:

  • 1.8-1.12: Legacy block manipulation with data values
  • 1.13+: Flattened block system with block states
  • 1.17+: Significant NMS restructuring and mapping changes
  • 1.20.5+: Mojang-mapped Paper NMS for improved stability

Each implementation provides optimized block placement methods that can significantly outperform standard Bukkit block operations, particularly for bulk operations like world generation, schematic pasting, or large-scale modifications.

See Also:
  • Constructor Details

    • BlockUtilProvider

      public BlockUtilProvider()
  • Method Details

    • provide

      @NotNull protected @NotNull AbstractBlockUtil provide(int ver)
      Creates the appropriate implementation for the specified NMS version.

      This method must be implemented by subclasses to provide version-specific logic for creating the appropriate implementation. The method receives a formatted NMS integer that can be compared against known version thresholds to determine which implementation to create.

      Use the Provider.f(String) helper method to convert Minecraft version strings to formatted integers for comparison.

      Selects the appropriate block utility implementation based on Minecraft version, accounting for major API changes in block handling systems. The selection covers the evolution from legacy data values to modern block states.

      Specified by:
      provide in class Provider<AbstractBlockUtil>
      Parameters:
      ver - the formatted NMS version integer
      Returns:
      the version-appropriate AbstractBlockUtil implementation
      Throws:
      IllegalArgumentException - if the version is below 1.8 (unsupported)