Class EntityMethodsProvider

java.lang.Object
com.kamikazejam.kamicommon.nms.provider.Provider<AbstractEntityMethods>
com.kamikazejam.kamicommon.nms.provider.EntityMethodsProvider

public class EntityMethodsProvider extends Provider<AbstractEntityMethods>
Provider for version-specific entity manipulation implementations.

This provider selects the appropriate AbstractEntityMethods implementation based on the current Minecraft version, handling the evolution of entity APIs and spawner mechanics across different Minecraft releases. Entity methods provide advanced entity manipulation capabilities including dimension handling, AI control, and spawner item management.

The provider covers major changes in entity handling systems:

  • 1.8-1.12: Legacy entity manipulation with NBT-based spawner items
  • 1.13+: Updated entity systems with improved spawner handling
  • 1.17+: Significant NMS restructuring affecting entity APIs
  • 1.20.5+: Mojang-mapped Paper NMS for enhanced compatibility

Each implementation provides methods for entity dimension queries, persistence settings, AI control, and advanced spawner item manipulation that are essential for plugins dealing with custom entities or spawner mechanics.

See Also:
  • Constructor Details

    • EntityMethodsProvider

      public EntityMethodsProvider()
  • Method Details

    • provide

      @NotNull protected @NotNull AbstractEntityMethods 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 entity methods implementation based on Minecraft version, accounting for significant changes in entity handling and spawner mechanics. The selection ensures compatibility with both legacy NBT systems and modern entity management approaches.

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