Interface NativePacketFactory


public interface NativePacketFactory
Creates native packets for the exact Minecraft version selected at startup.

Every returned object is an NMS packet owned by the active adapter. Native values supplied to factory methods are borrowed: callers must retain their validity until vanilla encodes the packet. No method accepts raw packet bytes or performs protocol translation.

  • Method Details

    • constructor

      NativePacketConstructor constructor(String nativeClassName, Class<?>... parameterTypes)
      Resolves an exact native constructor once. The returned callable performs no member lookup and is suitable for repeated use.
      Parameters:
      nativeClassName - exact NMS packet class name
      parameterTypes - exact constructor parameter types, including primitives
      Returns:
      pre-resolved constructor
    • constructor

      NativePacketConstructor constructor(Class<?> nativePacketClass, Class<?>... parameterTypes)
      Resolves an exact native packet constructor from an already linked class.
      Parameters:
      nativePacketClass - exact NMS packet class
      parameterTypes - exact constructor parameter types, including primitives
      Returns:
      pre-resolved constructor
    • relativeMove

      Object relativeMove(int entityId, double x, double y, double z, boolean onGround)
    • relativeMoveAndRotate

      Object relativeMoveAndRotate(int entityId, double x, double y, double z, float yaw, float pitch, boolean onGround)
    • rotate

      Object rotate(int entityId, float yaw, float pitch, boolean onGround)
    • rotateHead

      Object rotateHead(int entityId, float headYaw)
    • teleport

      Object teleport(int entityId, double x, double y, double z, float yaw, float pitch, boolean onGround)
    • playerPosition

      Object playerPosition(PlayerPositionChange change)
    • vehiclePosition

      Object vehiclePosition(double x, double y, double z, float yaw, float pitch)
    • addEntity

      Object addEntity(int entityId, UUID entityUuid, Object nativeEntityType, double x, double y, double z, float pitch, float yaw, float headYaw, int data, double velocityX, double velocityY, double velocityZ)
    • itemDisplay

      Object itemDisplay(int entityId, UUID entityUuid, double x, double y, double z, float pitch, float yaw, float headYaw)
    • blockDisplay

      Object blockDisplay(int entityId, UUID entityUuid, double x, double y, double z, float pitch, float yaw, float headYaw)
    • removeEntities

      Object removeEntities(int... entityIds)
    • passengers

      Object passengers(int vehicleEntityId, int... passengerEntityIds)
    • entityEvent

      Object entityEvent(int entityId, byte eventId)
    • entityAnimation

      Object entityAnimation(int entityId, EntityAnimation animation)
    • blockBreakAnimation

      Object blockBreakAnimation(int breakerId, int x, int y, int z, int progress)
    • blockChangedAck

      Object blockChangedAck(int sequence)
    • collectItem

      Object collectItem(int collectedEntityId, int collectorEntityId, int amount)
    • closeScreen

      Object closeScreen(int containerId)
    • containerData

      Object containerData(int containerId, int propertyId, int value)
    • setCamera

      Object setCamera(int entityId)
    • keepAlive

      Object keepAlive(long id)
    • ping

      Object ping(int id)
    • pong

      Object pong(long time)
      Creates the status-ping pong response.
    • statusResponse

      Object statusResponse(NativeText description, @Nullable StatusPlayers players, @Nullable StatusVersion version, @Nullable byte[] favicon, boolean enforcesSecureChat)
      Creates a server status response; optional sections may be null.
    • updateTags

      Object updateTags(NativeValue tagsPayload)
      Creates a zero-copy registry-tag update from an exact adapter snapshot.
    • registryData

      Object registryData(String registryKey, List<NativeRegistryEntry> entries)
      Creates registry synchronization entries without converting their optional NBT.
    • customReportDetails

      Object customReportDetails(Map<String,String> details)
      Creates client report details. Supported from Minecraft 1.21.
    • serverLinks

      Object serverLinks(List<NativeServerLink> links)
      Creates the server-links packet. Supported from Minecraft 1.21.
    • codeOfConduct

      Object codeOfConduct(String text)
      Creates the configuration code-of-conduct packet. Supported from Minecraft 1.21.9.
    • awardStatistics

      Object awardStatistics(NativeValue statistics)
      Creates a zero-copy statistics update from an exact adapter map snapshot.
    • updateAdvancements

      Object updateAdvancements(boolean reset, NativeValue added, NativeValue removed, NativeValue progress, boolean showAdvancements)
      Creates an advancement update from exact adapter collection snapshots. showAdvancements is ignored before Minecraft 1.21.5.
    • updateAttributes

      Object updateAttributes(int entityId, NativeValue attributes)
      Creates an attribute update from exact adapter attribute-instance snapshots.
    • deleteChat

      Object deleteChat(NativeValue packedSignature)
      Creates a signed-chat deletion from an exact packed-signature snapshot.
    • playerRotation

      Object playerRotation(float yaw, boolean relativeYaw, float pitch, boolean relativePitch)
      Rotates the local player. Relative flags require Minecraft 1.21.9; the packet itself is available from supported Minecraft 1.21.3.
    • lowDiskSpaceWarning

      Object lowDiskSpaceWarning()
      Returns the low-disk-space warning singleton available from Minecraft 26.1.
    • experienceOrb

      Object experienceOrb(int entityId, double x, double y, double z, int value)
      Creates an experience-orb spawn packet where that dedicated packet exists.
    • damageEvent

      Object damageEvent(int entityId, NativeValue damageType, int sourceCauseEntityId, int sourceDirectEntityId, @Nullable NativeVector3 sourcePosition)
    • bossBarAdd

      Object bossBarAdd(UUID id, NativeText name, float progress, BossBarColor color, BossBarOverlay overlay, boolean darkenScreen, boolean playMusic, boolean createWorldFog)
    • bossBarRemove

      Object bossBarRemove(UUID id)
    • bossBarProgress

      Object bossBarProgress(UUID id, float progress)
    • bossBarName

      Object bossBarName(UUID id, NativeText name)
    • bossBarStyle

      Object bossBarStyle(UUID id, BossBarColor color, BossBarOverlay overlay)
    • bossBarProperties

      Object bossBarProperties(UUID id, boolean darkenScreen, boolean playMusic, boolean createWorldFog)
    • chunkBiomes

      Object chunkBiomes(List<NativeChunkBiomeData> chunks)
    • explosion

      Object explosion(NativeVector3 center, float radius, List<NativeBlockCoordinate> affectedBlocks, @Nullable NativeVector3 playerKnockback, ExplosionBlockInteraction blockInteraction, NativeParticle smallParticle, NativeParticle largeParticle, NativeSound sound)
    • mapData

      Object mapData(int mapId, byte scale, boolean locked, @Nullable NativeValue decorations, @Nullable NativeMapPatch colorPatch)
    • entityPositionSync

      Object entityPositionSync(int entityId, NativeVector3 position, NativeVector3 movement, float yaw, float pitch, boolean onGround)
      Creates exact entity position synchronization from supported Minecraft 1.21.3.
    • moveMinecart

      Object moveMinecart(int entityId, List<NativeMinecartStep> steps)
      Creates minecart interpolation from supported Minecraft 1.21.3.
    • cursorItem

      Object cursorItem(NativeItem item)
      Sets the carried cursor item. Supported from Minecraft 1.21.3.
    • playerInventorySlot

      Object playerInventorySlot(int slot, NativeItem item)
      Sets one player-inventory slot. Supported from Minecraft 1.21.3.
    • gameRuleValues

      Object gameRuleValues(Map<String,String> values)
      Creates the dedicated client game-rule snapshot available from Minecraft 26.1.
    • addTrackedWaypointPosition

      Object addTrackedWaypointPosition(UUID id, @Nullable NativeWaypointIcon icon, int x, int y, int z)
    • updateTrackedWaypointPosition

      Object updateTrackedWaypointPosition(UUID id, @Nullable NativeWaypointIcon icon, int x, int y, int z)
    • addTrackedWaypointChunk

      Object addTrackedWaypointChunk(UUID id, @Nullable NativeWaypointIcon icon, int chunkX, int chunkZ)
    • updateTrackedWaypointChunk

      Object updateTrackedWaypointChunk(UUID id, @Nullable NativeWaypointIcon icon, int chunkX, int chunkZ)
    • addTrackedWaypointAzimuth

      Object addTrackedWaypointAzimuth(UUID id, @Nullable NativeWaypointIcon icon, float azimuth)
    • updateTrackedWaypointAzimuth

      Object updateTrackedWaypointAzimuth(UUID id, @Nullable NativeWaypointIcon icon, float azimuth)
    • removeTrackedWaypoint

      Object removeTrackedWaypoint(UUID id)
    • gameTestHighlightPosition

      Object gameTestHighlightPosition(int absoluteX, int absoluteY, int absoluteZ, int relativeX, int relativeY, int relativeZ)
    • debugSample

      Object debugSample(long[] sample)
      Creates the tick-time debug sample and retains the supplied array.
    • debugBlockValue

      Object debugBlockValue(int x, int y, int z, NativeValue update)
      Creates a debug block update from an exact borrowed debug-update snapshot.
    • debugChunkValue

      Object debugChunkValue(int chunkX, int chunkZ, NativeValue update)
      Creates a debug chunk update from an exact borrowed debug-update snapshot.
    • debugEntityValue

      Object debugEntityValue(int entityId, NativeValue update)
      Creates a debug entity update from an exact borrowed debug-update snapshot.
    • debugEvent

      Object debugEvent(NativeValue event)
      Creates a debug event from an exact borrowed debug-event snapshot.
    • clearTitles

      Object clearTitles(boolean resetTimes)
    • titleAnimation

      Object titleAnimation(int fadeInTicks, int stayTicks, int fadeOutTicks)
    • chunkCacheCenter

      Object chunkCacheCenter(int chunkX, int chunkZ)
    • chunkCacheRadius

      Object chunkCacheRadius(int radius)
    • experience

      Object experience(float progress, int totalExperience, int level)
    • cooldown

      Object cooldown(String cooldownKey, int ticks)
      Sets or clears an item cooldown; zero ticks clears it.
    • projectilePower

      Object projectilePower(int entityId, double powerX, double powerY, double powerZ)
      Updates a projectile acceleration vector, converted to scalar power where required.
    • health

      Object health(float health, int food, float saturation)
    • systemChat

      Object systemChat(NativeText message, boolean overlay)
    • disguisedChat

      Object disguisedChat(NativeText message, NativeValue chatType)
      Creates unsigned/disguised chat while retaining the exact chat-type binding.
    • playerChat

      Object playerChat(int globalIndex, UUID sender, int index, @Nullable NativeValue signature, NativeValue body, @Nullable NativeText unsignedContent, NativeValue filterMask, NativeValue chatType)
      Creates signed player chat from retained native cryptographic values. globalIndex is ignored before Minecraft 1.21.5.
    • actionBar

      Object actionBar(NativeText message)
    • titleText

      Object titleText(NativeText message)
    • subtitleText

      Object subtitleText(NativeText message)
    • tabList

      Object tabList(NativeText header, NativeText footer)
    • disconnect

      Object disconnect(NativeText reason)
    • serverData

      Object serverData(NativeText motd, @Nullable byte[] iconBytes)
      Creates server-list data; iconBytes may be null when no icon is sent.
    • customPayload

      Object customPayload(String channel, byte[] data)
    • unloadChunk

      Object unloadChunk(int chunkX, int chunkZ)
    • chunkWithLight

      Object chunkWithLight(int chunkX, int chunkZ, NativeValue chunkData, NativeValue lightData)
      Creates a chunk packet retaining exact encoded chunk and light payloads.
    • lightUpdate

      Object lightUpdate(int chunkX, int chunkZ, NativeValue lightData)
      Creates a light update retaining an exact encoded light payload.
    • levelEvent

      Object levelEvent(int eventId, int x, int y, int z, int data, boolean global)
    • openSignEditor

      Object openSignEditor(int x, int y, int z, boolean frontText)
    • mountScreen

      Object mountScreen(int containerId, int inventoryColumns, int entityId)
    • defaultSpawn

      Object defaultSpawn(NativeGlobalPosition position, float yaw, float pitch)
      Sets the default spawn; dimension and pitch are encoded where supported.
    • time

      Object time(long gameTime, long dayTime, boolean daylightCycle)
      Synchronizes the legacy day clock or the default world clock on newer versions.
    • hurtAnimation

      Object hurtAnimation(int entityId, float yaw)
    • entityMotion

      Object entityMotion(int entityId, double velocityX, double velocityY, double velocityZ)
    • entityLink

      Object entityLink(int sourceEntityId, int destinationEntityId)
    • borderCenter

      Object borderCenter(double x, double z)
    • borderSize

      Object borderSize(double size)
    • borderLerpSize

      Object borderLerpSize(double oldSize, double newSize, long durationMillis)
    • borderWarningDelay

      Object borderWarningDelay(int warningTimeSeconds)
    • borderWarningDistance

      Object borderWarningDistance(int warningBlocks)
    • simulationDistance

      Object simulationDistance(int chunks)
    • heldSlot

      Object heldSlot(int slot)
    • combatEnd

      Object combatEnd(int durationTicks)
    • combatEnter

      Object combatEnter()
    • startConfiguration

      Object startConfiguration()
    • loginCompression

      Object loginCompression(int threshold)
    • loginHello

      Object loginHello(String serverId, byte[] publicKey, byte[] challenge, boolean authenticate)
    • loginDisconnect

      Object loginDisconnect(NativeText reason)
    • loginFinished

      Object loginFinished(NativeGameProfile profile, UUID sessionId)
      Completes login; sessionId is encoded by Minecraft 26.2 and newer.
    • loginCustomQuery

      Object loginCustomQuery(int transactionId, String channel, byte[] data)
      Creates a login custom-query packet retaining data until encoding.
    • difficulty

      Object difficulty(NativeDifficulty difficulty, boolean locked)
    • gameEvent

      Object gameEvent(ClientGameEvent event, float value)
    • lookAt

      Object lookAt(EntityAnchor sourceAnchor, double x, double y, double z)
    • resourcePackPush

      Object resourcePackPush(UUID id, String url, String hash, boolean required, @Nullable NativeText prompt)
      Creates a resource-pack request; prompt may be null.
    • resourcePackPop

      Object resourcePackPop(@Nullable UUID id)
      Removes one resource pack, or every pack when id is null.
    • cookieRequest

      Object cookieRequest(String key)
    • storeCookie

      Object storeCookie(String key, byte[] payload)
    • transfer

      Object transfer(String host, int port)
    • finishConfiguration

      Object finishConfiguration()
    • resetChat

      Object resetChat()
      Resets configuration-phase chat state.
    • enabledFeatures

      Object enabledFeatures(Set<String> featureKeys)
      Replaces the enabled feature-flag set from resource keys.
    • dialog

      default NativeDialog dialog(String key)
      Resolves a registered dialog for repeated packet creation.
      Throws:
      UnsupportedOperationException - before Minecraft 1.21.6
    • showDialog

      default Object showDialog(NativeDialog dialog)
      Opens a registered dialog.
      Throws:
      UnsupportedOperationException - before Minecraft 1.21.6
    • clearDialog

      default Object clearDialog()
      Clears the currently displayed dialog.
      Throws:
      UnsupportedOperationException - before Minecraft 1.21.6
    • selectAdvancementsTab

      Object selectAdvancementsTab(@Nullable String tabKey)
      Selects a tab, or closes the advancements screen when tabKey is null.
    • resetScore

      Object resetScore(String owner, @Nullable String objectiveName)
      Resets one objective, or all scores for the owner when objectiveName is null.
    • blankNumberFormat

      NativeNumberFormat blankNumberFormat()
    • fixedNumberFormat

      NativeNumberFormat fixedNumberFormat(NativeText text)
    • setScore

      Object setScore(String owner, String objectiveName, int score, @Nullable NativeText display, @Nullable NativeNumberFormat numberFormat)
      Creates a score update with optional display text and number formatting.
    • scoreboardObjective

      Object scoreboardObjective(String objectiveName, ScoreboardObjectiveAction action, @Nullable NativeText displayName, @Nullable ScoreboardRenderType renderType, @Nullable NativeNumberFormat numberFormat)
      Display and render type may be null only for ScoreboardObjectiveAction.REMOVE.
    • displayObjective

      Object displayObjective(ScoreboardDisplaySlot slot, @Nullable String objectiveName)
      Displays an objective in a slot, or clears the slot when its name is null.
    • scoreboardTeam

      Object scoreboardTeam(String teamName, ScoreboardTeamAction action, @Nullable ScoreboardTeamParameters parameters, List<String> players)
      Parameters may be null for operations other than add and update.
    • customChatCompletions

      Object customChatCompletions(ChatCompletionAction action, List<String> entries)
    • commandSuggestions

      Object commandSuggestions(int requestId, int start, int length, List<CommandSuggestion> suggestions)
    • openBook

      Object openBook(NativeHand hand)
    • recipe

      NativeRecipe recipe(String key)
      Resolves a registered recipe for version-correct ghost-recipe packets.
    • updateRecipes

      Object updateRecipes(NativeValue primaryPayload, @Nullable NativeValue secondaryPayload)
      Creates recipe-registry synchronization from exact payloads exposed by UpdateRecipesPacketView. The secondary payload is absent on legacy releases.
    • recipeBookSettings

      NativeRecipeBookSettings recipeBookSettings(boolean craftingOpen, boolean craftingFiltering, boolean furnaceOpen, boolean furnaceFiltering, boolean blastFurnaceOpen, boolean blastFurnaceFiltering, boolean smokerOpen, boolean smokerFiltering)
      Creates immutable recipe-book settings from portable category flags.
    • recipeBookAdd

      Object recipeBookAdd(List<NativeValue> entries, List<NativeValue> highlightedEntries, boolean replace, @Nullable NativeRecipeBookSettings settings)
      Adds or initializes recipe-book entries. Legacy highlighted entries are separate; modern entries retain their own notification/highlight flags.
    • recipeBookRemove

      Object recipeBookRemove(List<NativeValue> entries, @Nullable NativeRecipeBookSettings settings)
      Removes recipe-book entries, optionally applying settings in the same semantic update.
    • recipeBookSettings

      Object recipeBookSettings(NativeRecipeBookSettings settings)
      Applies recipe-book settings without changing entries.
    • ghostRecipe

      Object ghostRecipe(int containerId, NativeRecipe recipe)
    • ghostRecipe

      default Object ghostRecipe(int containerId, String recipeKey)
    • openScreen

      Object openScreen(int containerId, NativeMenuType menuType, NativeText title)
    • merchantOffers

      Object merchantOffers(int containerId, NativeValue offers, int villagerLevel, int villagerExperience, boolean showProgress, boolean canRestock)
      Creates merchant offers retaining the exact encoded offers collection.
    • commands

      Object commands(int rootIndex, NativeValue entries)
      Creates a command-tree packet retaining exact encoded entries.
    • openScreen

      default Object openScreen(int containerId, String menuTypeKey, NativeText title)
    • setSlot

      Object setSlot(int containerId, int stateId, int slot, NativeItem item)
    • containerContent

      Object containerContent(int containerId, int stateId, List<NativeItem> items, NativeItem carriedItem)
    • equipment

      Object equipment(int entityId, List<NativeEquipment> equipment)
    • bundleDelimiter

      Object bundleDelimiter()
    • chunkBatchStart

      Object chunkBatchStart()
    • chunkBatchFinished

      Object chunkBatchFinished(int batchSize)
    • combatKill

      Object combatKill(int playerId, NativeText message)
    • tickingState

      Object tickingState(float tickRate, boolean frozen)
    • tickingStep

      Object tickingStep(int steps)
    • playerInfoRemove

      Object playerInfoRemove(List<UUID> profileIds)
    • playerInfoUpdate

      Object playerInfoUpdate(Set<PlayerInfoAction> actions, List<PlayerInfoEntry> entries)
      Creates a player-info update without live Bukkit or NMS player objects.
    • bundle

      Object bundle(Iterable<?> packets)
    • playerAbilities

      Object playerAbilities(NativePlayerAbilities abilities)
    • spawnInfo

      NativeSpawnInfo spawnInfo(String dimensionTypeKey, String dimensionKey, long seed, NativeGameMode gameMode, @Nullable NativeGameMode previousGameMode, boolean debug, boolean flat, @Nullable NativeGlobalPosition lastDeathLocation, int portalCooldown, int seaLevel)
      Resolves version-correct common player spawn state.
      Parameters:
      previousGameMode - previous mode, or null when unknown
      lastDeathLocation - last death position, or null when absent
      seaLevel - dimension sea level; encoded by supported Minecraft 1.21.3 and newer
    • respawn

      Object respawn(NativeSpawnInfo spawnInfo, boolean keepAttributes, boolean keepEntityData)
      Creates a play-state respawn packet with semantic keep flags.
    • login

      Object login(int playerId, boolean hardcore, Set<String> levelKeys, int maxPlayers, int chunkRadius, int simulationDistance, boolean reducedDebugInfo, boolean showDeathScreen, boolean limitedCrafting, NativeSpawnInfo spawnInfo, boolean onlineMode, boolean enforcesSecureChat)
      Creates the play-state login packet.
      Parameters:
      onlineMode - encoded by Minecraft 26.2 and newer
    • initializeBorder

      Object initializeBorder(double centerX, double centerZ, double oldSize, double newSize, long lerpDurationMillis, int absoluteMaxSize, int warningBlocks, int warningTimeSeconds)
    • sound

      NativeSound sound(String key)
    • mobEffect

      NativeMobEffect mobEffect(String key)
    • soundAt

      Object soundAt(NativeSound sound, NativeSoundSource source, double x, double y, double z, float volume, float pitch, long seed)
    • soundAt

      default Object soundAt(String soundKey, NativeSoundSource source, double x, double y, double z, float volume, float pitch, long seed)
    • entitySound

      Object entitySound(NativeSound sound, NativeSoundSource source, int entityId, float volume, float pitch, long seed)
    • entitySound

      default Object entitySound(String soundKey, NativeSoundSource source, int entityId, float volume, float pitch, long seed)
    • stopSound

      Object stopSound(@Nullable String soundKey, @Nullable NativeSoundSource source)
      Null sound and source stop every sound; either value may be supplied independently.
    • removeMobEffect

      Object removeMobEffect(int entityId, NativeMobEffect effect)
    • removeMobEffect

      default Object removeMobEffect(int entityId, String effectKey)
    • updateMobEffect

      Object updateMobEffect(int entityId, NativeMobEffect effect, int amplifier, int durationTicks, boolean ambient, boolean visible, boolean showIcon, boolean blend)
    • updateMobEffect

      default Object updateMobEffect(int entityId, String effectKey, int amplifier, int durationTicks, boolean ambient, boolean visible, boolean showIcon, boolean blend)
    • blockEntityType

      NativeBlockEntityType blockEntityType(String key)
    • tagQuery

      Object tagQuery(int transactionId, @Nullable NativeNbt tag)
      Replies to an NBT query; tag may be null when no result exists.
    • blockEntityData

      Object blockEntityData(int x, int y, int z, NativeBlockEntityType type, NativeNbt tag)
    • blockEntityData

      default Object blockEntityData(int x, int y, int z, String typeKey, NativeNbt tag)
    • blockUpdate

      Object blockUpdate(int x, int y, int z, NativeBlockState state)
    • blockEvent

      Object blockEvent(int x, int y, int z, NativeBlockState state, int type, int data)
      Creates a block event; type and data are encoded as unsigned bytes.
    • sectionBlocksUpdate

      Object sectionBlocksUpdate(int sectionX, int sectionY, int sectionZ, List<SectionBlockChange> changes)
    • particles

      Object particles(NativeParticle particle, boolean overrideLimiter, boolean alwaysShow, double x, double y, double z, float offsetX, float offsetY, float offsetZ, float maxSpeed, int count)
    • metadata

      <T> Object metadata(int entityId, EntityMetadataField<T> field, T value)
    • metadata

      Object metadata(int entityId, EntityMetadataField<?>[] fields, Object[] values)
    • rotationMetadata

      Object rotationMetadata(int entityId, EntityMetadataField<MetadataRotation> field, float x, float y, float z)
    • displayVectorMetadata

      Object displayVectorMetadata(int entityId, EntityMetadataField<NativeValue> field, float x, float y, float z)
    • displayQuaternionMetadata

      Object displayQuaternionMetadata(int entityId, EntityMetadataField<NativeValue> field, float x, float y, float z, float w)