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 Summary
Modifier and TypeMethodDescription@NotNull BaseEntityadapt(@NotNull PlatformEntity entity) Adapts a Bukkit entity to aBaseEntity, handling Folia compatibility.@NotNull BasePlayeradapt(@NotNull PlatformPlayer player) Adapts a Bukkit player to aBasePlayer, handling Folia compatibility.default @NotNull ModelDisplaycreate(@NotNull PlatformLocation location) Creates a model display at the specified location.@NotNull ModelDisplaycreate(@NotNull PlatformLocation location, double yOffset, @NotNull Consumer<ModelDisplay> initialConsumer) Creates a model display at the specified location with a Y-offset and initial configuration.default @NotNull ModelDisplaycreate(@NotNull PlatformLocation location, @NotNull Consumer<ModelDisplay> initialConsumer) Creates a model display at the specified location with an initial configuration.@NotNull PacketBundlercreateBundler(int initialCapacity) Creates a packet bundler with an initial capacity.@Nullable HitBoxcreateHitBox(@NotNull BaseEntity entity, @NotNull RenderedBone bone, @NotNull ModelBoundingBox boundingBox, @NotNull MountController controller, @NotNull HitBoxListener listener) Creates a delegate hitbox for a target entity.@NotNull ModAnimationBundlercreateModAnimationBuilder(int initialCapacity) Creates a mod animation bundler.@NotNull ModelNametagcreateNametag(@NotNull RenderedBone bone) Creates a nametag for a rendered bone.default @NotNull ModelNametagcreateNametag(@NotNull RenderedBone bone, @NotNull Consumer<ModelNametag> consumer) Creates a nametag for a rendered bone with configuration.@NotNull PacketBundlercreateParallelBundler(int threshold) Creates a parallel packet bundler with a size threshold.default @NotNull TransformedItemStackcreateSkinItem(@NotNull String model, @NotNull List<Float> floats, @NotNull List<Boolean> flags, @NotNull List<String> strings, @NotNull List<Integer> colors) Creates a custom skin item stack.voidhide(@NotNull PlayerChannelHandler channel, @NotNull EntityTrackerRegistry registry) Sends a hide packet for an entity to a player via their channel handler.default voidhide(@NotNull PlayerChannelHandler channel, @NotNull EntityTrackerRegistry registry, @NotNull BooleanSupplier condition) Sends a hide packet for an entity to a player if a condition is met.@NotNull PlayerChannelHandlerinject(@NotNull PlatformPlayer player) Injects a Netty channel handler into a player's connection.booleanChecks if the server is in online mode (either natively or via proxy).voidmount(@NotNull EntityTrackerRegistry registry, @NotNull PacketBundler bundler) Adds a mount packet for an entity tracker to a bundler.@NotNull ModelProfileprofile(@NotNull PlatformPlayer player) Retrieves the model profile (skin) for a player.@NotNull PlatformItemStacktint(@NotNull PlatformItemStack itemStack, int rgb) Applies a tint color to an item stack.@NotNull NMSVersionversion()Returns the NMS version of the server.
-
Method Details
-
create
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 locationinitialConsumer- 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 locationyOffset- the vertical offsetinitialConsumer- a consumer to configure the display upon creation- Returns:
- the created model display
- Since:
- 1.15.2
-
createNametag
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 toconsumer- a consumer to configure the nametag- Returns:
- the created nametag
- Since:
- 1.15.2
-
inject
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
Creates a packet bundler with an initial capacity.- Parameters:
initialCapacity- the initial capacity- Returns:
- the packet bundler
- Since:
- 1.15.2
-
createParallelBundler
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
Creates a mod animation bundler.- Parameters:
initialCapacity- the initial capacity- Returns:
- mod animation bundler.
- Since:
- 2.2.1
-
tint
Applies a tint color to an item stack.- Parameters:
itemStack- the item to tintrgb- 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 registrybundler- 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 handlerregistry- 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 handlerregistry- the entity tracker registrycondition- 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 entitybone- the bone associated with the hitboxboundingBox- the bounding box definitioncontroller- the mount controllerlistener- the hitbox listener- Returns:
- the created hitbox, or null if creation failed
- Since:
- 1.15.2
-
version
Returns the NMS version of the server.- Returns:
- the version
- Since:
- 1.15.2
-
adapt
Adapts a Bukkit entity to aBaseEntity, handling Folia compatibility.- Parameters:
entity- the Bukkit entity- Returns:
- the adapted entity
- Since:
- 1.15.2
-
adapt
Adapts a Bukkit player to aBasePlayer, handling Folia compatibility.- Parameters:
player- the Bukkit player- Returns:
- the adapted player
- Since:
- 1.15.2
-
profile
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 namefloats- a list of floatsflags- a list of flagsstrings- a list of stringscolors- 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
-