Interface NMS


public interface NMS
Handles direct interactions with Minecraft's internal server code (NMS).

This interface provides methods for creating displays, managing packets, handling hitboxes, and adapting entities for different server environments (e.g., Folia).

Since:
1.15.2
  • Method Details

    • create

      @NotNull default @NotNull ModelDisplay create(@NotNull @NotNull PlatformLocation location)
      Creates a model display at the specified location.
      Parameters:
      location - the starting location
      Returns:
      the created model display
      Since:
      1.15.2
    • create

      @NotNull default @NotNull ModelDisplay create(@NotNull @NotNull PlatformLocation location, @NotNull @NotNull Consumer<ModelDisplay> initialConsumer)
      Creates a model display at the specified location with an initial configuration.
      Parameters:
      location - the starting location
      initialConsumer - a consumer to configure the display upon creation
      Returns:
      the created model display
      Since:
      1.15.2
    • create

      @NotNull @NotNull ModelDisplay create(@NotNull @NotNull PlatformLocation location, double yOffset, @NotNull @NotNull Consumer<ModelDisplay> initialConsumer)
      Creates a model display at the specified location with a Y-offset and initial configuration.
      Parameters:
      location - the starting location
      yOffset - the vertical offset
      initialConsumer - a consumer to configure the display upon creation
      Returns:
      the created model display
      Since:
      1.15.2
    • createNametag

      @NotNull @NotNull ModelNametag createNametag(@NotNull @NotNull RenderedBone bone)
      Creates a nametag for a rendered bone.
      Parameters:
      bone - the bone to attach the nametag to
      Returns:
      the created nametag
      Since:
      1.15.2
    • createNametag

      @NotNull default @NotNull ModelNametag createNametag(@NotNull @NotNull RenderedBone bone, @NotNull @NotNull Consumer<ModelNametag> consumer)
      Creates a nametag for a rendered bone with configuration.
      Parameters:
      bone - the bone to attach the nametag to
      consumer - a consumer to configure the nametag
      Returns:
      the created nametag
      Since:
      1.15.2
    • inject

      @NotNull @NotNull PlayerChannelHandler inject(@NotNull @NotNull PlatformPlayer player)
      Injects a Netty channel handler into a player's connection.
      Parameters:
      player - the player to inject
      Returns:
      the created channel handler
      Since:
      1.15.2
    • createBundler

      @NotNull @NotNull PacketBundler createBundler(int initialCapacity)
      Creates a packet bundler with an initial capacity.
      Parameters:
      initialCapacity - the initial capacity
      Returns:
      the packet bundler
      Since:
      1.15.2
    • createParallelBundler

      @NotNull @NotNull PacketBundler createParallelBundler(int threshold)
      Creates a parallel packet bundler with a size threshold.
      Parameters:
      threshold - the size threshold for parallel processing
      Returns:
      the packet bundler
      Since:
      1.15.2
    • createModAnimationBuilder

      @NotNull @NotNull ModAnimationBundler createModAnimationBuilder(int initialCapacity)
      Creates a mod animation bundler.
      Parameters:
      initialCapacity - the initial capacity
      Returns:
      mod animation bundler.
      Since:
      2.2.1
    • tint

      @NotNull @NotNull PlatformItemStack tint(@NotNull @NotNull PlatformItemStack itemStack, int rgb)
      Applies a tint color to an item stack.
      Parameters:
      itemStack - the item to tint
      rgb - the RGB color value
      Returns:
      the tinted item stack
      Since:
      1.15.2
    • mount

      void mount(@NotNull @NotNull EntityTrackerRegistry registry, @NotNull @NotNull PacketBundler bundler)
      Adds a mount packet for an entity tracker to a bundler.
      Parameters:
      registry - the entity tracker registry
      bundler - the packet bundler
      Since:
      1.15.2
    • hide

      void hide(@NotNull @NotNull PlayerChannelHandler channel, @NotNull @NotNull EntityTrackerRegistry registry)
      Sends a hide packet for an entity to a player via their channel handler.
      Parameters:
      channel - the player's channel handler
      registry - the entity tracker registry
      Since:
      1.15.2
    • hide

      default void hide(@NotNull @NotNull PlayerChannelHandler channel, @NotNull @NotNull EntityTrackerRegistry registry, @NotNull @NotNull BooleanSupplier condition)
      Sends a hide packet for an entity to a player if a condition is met.

      For players, the hide operation is delayed based on configuration.

      Parameters:
      channel - the player's channel handler
      registry - the entity tracker registry
      condition - the condition to check
      Since:
      1.15.2
    • createHitBox

      @Nullable @Nullable HitBox createHitBox(@NotNull @NotNull BaseEntity entity, @NotNull @NotNull RenderedBone bone, @NotNull @NotNull ModelBoundingBox boundingBox, @NotNull @NotNull MountController controller, @NotNull @NotNull HitBoxListener listener)
      Creates a delegate hitbox for a target entity.
      Parameters:
      entity - the target entity
      bone - the bone associated with the hitbox
      boundingBox - the bounding box definition
      controller - the mount controller
      listener - the hitbox listener
      Returns:
      the created hitbox, or null if creation failed
      Since:
      1.15.2
    • version

      @NotNull @NotNull NMSVersion version()
      Returns the NMS version of the server.
      Returns:
      the version
      Since:
      1.15.2
    • adapt

      @NotNull @NotNull BaseEntity adapt(@NotNull @NotNull PlatformEntity entity)
      Adapts a Bukkit entity to a BaseEntity, handling Folia compatibility.
      Parameters:
      entity - the Bukkit entity
      Returns:
      the adapted entity
      Since:
      1.15.2
    • adapt

      @NotNull @NotNull BasePlayer adapt(@NotNull @NotNull PlatformPlayer player)
      Adapts a Bukkit player to a BasePlayer, handling Folia compatibility.
      Parameters:
      player - the Bukkit player
      Returns:
      the adapted player
      Since:
      1.15.2
    • profile

      @NotNull @NotNull ModelProfile profile(@NotNull @NotNull PlatformPlayer player)
      Retrieves the model profile (skin) for a player.
      Parameters:
      player - the player
      Returns:
      the model profile
      Since:
      1.15.2
    • createSkinItem

      @NotNull default @NotNull TransformedItemStack createSkinItem(@NotNull @NotNull String model, @NotNull @NotNull List<Float> floats, @NotNull @NotNull List<Boolean> flags, @NotNull @NotNull List<String> strings, @NotNull @NotNull List<Integer> colors)
      Creates a custom skin item stack.
      Parameters:
      model - the model name
      floats - a list of floats
      flags - a list of flags
      strings - a list of strings
      colors - a list of colors
      Returns:
      the transformed item stack
      Since:
      1.15.2
    • isProxyOnlineMode

      boolean isProxyOnlineMode()
      Checks if the server is in online mode (either natively or via proxy).
      Returns:
      true if online mode, false otherwise
      Since:
      1.15.2