Class NMSWorldWrapper

java.lang.Object
com.kamikazejam.kamicommon.nms.wrappers.NMSWrapper<NMSWorld,World>
com.kamikazejam.kamicommon.nms.wrapper.NMSWorldWrapper

public class NMSWorldWrapper extends NMSWrapper<NMSWorld,World>
Version-specific wrapper factory for creating NMS world instances.

This wrapper extends the NMSWrapper pattern to provide context-dependent NMS world creation based on both the current Minecraft version and a specific Bukkit world instance. It integrates with the block utility provider system to ensure that each world wrapper has access to appropriate high-performance block manipulation capabilities.

The wrapper handles the evolution of world management across Minecraft versions:

  • 1.8-1.12: Legacy world systems with stable NMS structure
  • 1.13+: Updated world handling with flattened block systems
  • 1.17+: Significant NMS restructuring affecting world access
  • 1.20.5+: Mojang-mapped implementations for enhanced stability

Each world wrapper provides access to:

  • Chunk management and manipulation systems
  • High-performance block operations
  • Entity spawning and world queries
  • World boundary information (min/max height)
  • Direct client update mechanisms

The wrapper ensures that each world instance is paired with the appropriate block utility implementation, enabling consistent performance characteristics and API compatibility across all supported Minecraft versions.

See Also:
  • Constructor Details

    • NMSWorldWrapper

      public NMSWorldWrapper()
  • Method Details

    • provide

      @NotNull protected @NotNull NMSWorld provide(int ver, @NotNull @NotNull World world)
      Creates the appropriate NMS wrapper for the specified version and context.

      This method must be implemented by subclasses to provide version-specific logic for creating the appropriate wrapper implementation. The method receives both a formatted NMS integer for version comparison and a context object that provides necessary information for wrapper creation.

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

      Creates a version-appropriate NMS world wrapper for the specified Bukkit world. Each wrapper is integrated with the corresponding block utility provider to ensure consistent performance and API compatibility. The selection covers major world system changes including chunk handling, entity management, and block manipulation optimizations.

      Specified by:
      provide in class NMSWrapper<NMSWorld,World>
      Parameters:
      ver - the formatted NMS version integer
      world - the Bukkit World to wrap with NMS functionality
      Returns:
      the version-appropriate NMSWorld wrapper
      Throws:
      IllegalArgumentException - if the version is below 1.8 (unsupported)