packet

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package packet implements every packet in the Minecraft Bedrock Edition protocol using the functions found in the minecraft/protocol package. Each of the packets hold their own encoding and decoding methods which are used to read the packet from a bytes.Buffer or write the packet to one.

Besides the implementations of packets themselves, the packet package also implements the decoding and encoding of the lowest level Minecraft related packets, meaning the compressed packet batches. It handles the compression and (optional) encryption of these packet batches.

Index

Constants

View Source
const (
	ActorEventJump = iota + 1
	ActorEventHurt
	ActorEventDeath
	ActorEventStartAttacking
	ActorEventStopAttacking
	ActorEventTamingFailed
	ActorEventTamingSucceeded
	ActorEventShakeWetness
	ActorEventUseItem
	ActorEventEatGrass
	ActorEventFishhookBubble
	ActorEventFishhookFishPosition
	ActorEventFishhookHookTime
	ActorEventFishhookTease
	ActorEventSquidFleeing
	ActorEventZombieConverting
	ActorEventPlayAmbient
	ActorEventSpawnAlive
	ActorEventStartOfferFlower
	ActorEventStopOfferFlower
	ActorEventLoveHearts
	ActorEventVillagerAngry
	ActorEventVillagerHappy
	ActorEventWitchHatMagic
	ActorEventFireworksExplode
	ActorEventInLoveHearts
	ActorEventSilverfishMergeAnimation
	ActorEventGuardianAttackSound
	ActorEventDrinkPotion
	ActorEventThrowPotion
	ActorEventCartWithPrimeTNT
	ActorEventPrimeCreeper
	ActorEventAirSupply
	ActorEventAddPlayerLevels
	ActorEventGuardianMiningFatigue
	ActorEventAgentSwingArm
	ActorEventDragonStartDeathAnim
	ActorEventGroundDust
	ActorEventShake
)
View Source
const (
	ActorEventFeed = iota + 57

	ActorEventBabyEat
	ActorEventInstantDeath
	ActorEventNotifyTrade
	ActorEventLeashDestroyed
	ActorEventCaravanUpdated
	ActorEventTalismanActivate
	ActorEventUpdateStructureFeature
	ActorEventPlayerSpawnedMob
	ActorEventPuke
	ActorEventUpdateStackSize
	ActorEventStartSwimming
	ActorEventBalloonPop
	ActorEventTreasureHunt
	ActorEventSummonAgent
	ActorEventFinishedChargingCrossbow
	ActorEventLandedOnGround
	ActorEventActorGrowUp
	ActorEventVibrationDetected
	ActorEventDrinkMilk
)
View Source
const (
	AdventureFlagWorldImmutable = 1 << iota
	AdventureSettingsFlagsNoPvM
	AdventureSettingsFlagsNoMvP
	AdventureSettingsFlagsUnused
	AdventureSettingsFlagsShowNameTags
	AdventureFlagAutoJump
	AdventureFlagAllowFlight
	AdventureFlagNoClip
	AdventureFlagWorldBuilder
	AdventureFlagFlying
	AdventureFlagMuted
)
View Source
const (
	CommandPermissionLevelNormal = iota
	CommandPermissionLevelGameDirectors
	CommandPermissionLevelAdmin
	CommandPermissionLevelHost
	CommandPermissionLevelOwner
	CommandPermissionLevelInternal
)
View Source
const (
	ActionPermissionMine = 1 << iota
	ActionPermissionDoorsAndSwitches
	ActionPermissionOpenContainers
	ActionPermissionAttackPlayers
	ActionPermissionAttackMobs
	ActionPermissionOperator
	ActionPermissionTeleport
	ActionPermissionBuild
	ActionPermissionDefault
)
View Source
const (
	PermissionLevelVisitor = iota
	PermissionLevelMember
	PermissionLevelOperator
	PermissionLevelCustom
)
View Source
const (
	AgentActionTypeAttack = iota + 1
	AgentActionTypeCollect
	AgentActionTypeDestroy
	AgentActionTypeDetectRedstone
	AgentActionTypeDetectObstacle
	AgentActionTypeDrop
	AgentActionTypeDropAll
	AgentActionTypeInspect
	AgentActionTypeInspectData
	AgentActionTypeInspectItemCount
	AgentActionTypeInspectItemDetail
	AgentActionTypeInspectItemSpace
	AgentActionTypeInteract
	AgentActionTypeMove
	AgentActionTypePlaceBlock
	AgentActionTypeTill
	AgentActionTypeTransferItemTo
	AgentActionTypeTurn
)
View Source
const (
	AnimateActionSwingArm = iota + 1

	AnimateActionStopSleep
	AnimateActionCriticalHit
	AnimateActionMagicCriticalHit
)
View Source
const (
	AnimateActionRowRight = iota + 128
	AnimateActionRowLeft
)
View Source
const (
	BookActionReplacePage = iota
	BookActionAddPage
	BookActionDeletePage
	BookActionSwapPages
	BookActionSign
)
View Source
const (
	BossEventShow = iota
	BossEventRegisterPlayer
	BossEventHide
	BossEventUnregisterPlayer
	BossEventHealthPercentage
	BossEventTitle
	BossEventAppearanceProperties
	BossEventTexture
	BossEventRequest
)
View Source
const (
	BossEventColourGrey = iota
	BossEventColourBlue
	BossEventColourRed
	BossEventColourGreen
	BossEventColourYellow
	BossEventColourPurple
	BossEventColourWhite
)
View Source
const (
	CameraShakeTypePositional uint8 = iota
	CameraShakeTypeRotational
)
View Source
const (
	CameraShakeActionAdd = iota
	CameraShakeActionStop
)
View Source
const (
	DimensionOverworld = iota
	DimensionNether
	DimensionEnd
)
View Source
const (
	ClientBoundDebugRendererClear int32 = iota + 1
	ClientBoundDebugRendererAddCube
)
View Source
const (
	MapUpdateFlagTexture = 1 << (iota + 1)
	MapUpdateFlagDecoration
	MapUpdateFlagInitialisation
)
View Source
const (
	CodeBuilderCategoryNone = iota
	CodeBuilderCategoryStatus
	CodeBuilderCategoryInstantiation
)
View Source
const (
	CodeBuilderOperationNone = iota
	CodeBuilderOperationGet
	CodeBuilderOperationSet
	CodeBuilderOperationReset
)
View Source
const (
	CommandBlockImpulse = iota
	CommandBlockRepeating
	CommandBlockChain
)
View Source
const (
	CommandOutputTypeNone = iota
	CommandOutputTypeLastOutput
	CommandOutputTypeSilent
	CommandOutputTypeAllOutput
	CommandOutputTypeDataSet
)
View Source
const (
	UseItemEquipArmour = iota
	UseItemEat
	UseItemAttack
	UseItemConsume
	UseItemThrow
	UseItemShoot
	UseItemPlace
	UseItemFillBottle
	UseItemFillBucket
	UseItemPourBucket
	UseItemUseTool
	UseItemInteract
	UseItemRetrieved
	UseItemDyed
	UseItemTraded
)
View Source
const (
	ContainerDataFurnaceTickCount = iota
	ContainerDataFurnaceLitTime
	ContainerDataFurnaceLitDuration

	ContainerDataFurnaceFuelAux
)
View Source
const (
	ContainerDataBrewingStandBrewTime = iota
	ContainerDataBrewingStandFuelAmount
	ContainerDataBrewingStandFuelTotal
)
View Source
const (
	EmoteFlagServerSide = 1 << iota
	EmoteFlagMuteChat
)
View Source
const (
	GameTestRequestRotation0 = iota
	GameTestRequestRotation90
	GameTestRequestRotation180
	GameTestRequestRotation270
	GameTestRequestRotation360
)
View Source
const (
	IDLogin = iota + 1
	IDPlayStatus
	IDServerToClientHandshake
	IDClientToServerHandshake
	IDDisconnect
	IDResourcePacksInfo
	IDResourcePackStack
	IDResourcePackClientResponse
	IDText
	IDSetTime
	IDStartGame
	IDAddPlayer
	IDAddActor
	IDRemoveActor
	IDAddItemActor

	IDTakeItemActor
	IDMoveActorAbsolute
	IDMovePlayer
	IDPassengerJump
	IDUpdateBlock
	IDAddPainting
	IDTickSync

	IDLevelEvent
	IDBlockEvent
	IDActorEvent
	IDMobEffect
	IDUpdateAttributes
	IDInventoryTransaction
	IDMobEquipment
	IDMobArmourEquipment
	IDInteract
	IDBlockPickRequest
	IDActorPickRequest
	IDPlayerAction

	IDHurtArmour
	IDSetActorData
	IDSetActorMotion
	IDSetActorLink
	IDSetHealth
	IDSetSpawnPosition
	IDAnimate
	IDRespawn
	IDContainerOpen
	IDContainerClose
	IDPlayerHotBar
	IDInventoryContent
	IDInventorySlot
	IDContainerSetData
	IDCraftingData
	IDCraftingEvent
	IDGUIDataPickItem
	IDAdventureSettings
	IDBlockActorData
	IDPlayerInput
	IDLevelChunk
	IDSetCommandsEnabled
	IDSetDifficulty
	IDChangeDimension
	IDSetPlayerGameType
	IDPlayerList
	IDSimpleEvent
	IDEvent
	IDSpawnExperienceOrb
	IDClientBoundMapItemData
	IDMapInfoRequest
	IDRequestChunkRadius
	IDChunkRadiusUpdated
	IDItemFrameDropItem
	IDGameRulesChanged
	IDCamera
	IDBossEvent
	IDShowCredits
	IDAvailableCommands
	IDCommandRequest
	IDCommandBlockUpdate
	IDCommandOutput
	IDUpdateTrade
	IDUpdateEquip
	IDResourcePackDataInfo
	IDResourcePackChunkData
	IDResourcePackChunkRequest
	IDTransfer
	IDPlaySound
	IDStopSound
	IDSetTitle
	IDAddBehaviourTree
	IDStructureBlockUpdate
	IDShowStoreOffer
	IDPurchaseReceipt
	IDPlayerSkin
	IDSubClientLogin
	IDAutomationClientConnect
	IDSetLastHurtBy
	IDBookEdit
	IDNPCRequest
	IDPhotoTransfer
	IDModalFormRequest
	IDModalFormResponse
	IDServerSettingsRequest
	IDServerSettingsResponse
	IDShowProfile
	IDSetDefaultGameType
	IDRemoveObjective
	IDSetDisplayObjective
	IDSetScore
	IDLabTable
	IDUpdateBlockSynced
	IDMoveActorDelta
	IDSetScoreboardIdentity
	IDSetLocalPlayerAsInitialised
	IDUpdateSoftEnum
	IDNetworkStackLatency

	IDScriptCustomEvent
	IDSpawnParticleEffect
	IDAvailableActorIdentifiers

	IDNetworkChunkPublisherUpdate
	IDBiomeDefinitionList
	IDLevelSoundEvent
	IDLevelEventGeneric
	IDLecternUpdate

	IDAddEntity
	IDRemoveEntity
	IDClientCacheStatus
	IDMapCreateLockedCopy
	IDOnScreenTextureAnimation
	IDStructureTemplateDataRequest
	IDStructureTemplateDataResponse

	IDClientCacheBlobStatus
	IDClientCacheMissResponse
	IDEducationSettings
	IDEmote
	IDMultiPlayerSettings
	IDSettingsCommand
	IDAnvilDamage
	IDCompletedUsingItem
	IDNetworkSettings
	IDPlayerAuthInput
	IDCreativeContent
	IDPlayerEnchantOptions
	IDItemStackRequest
	IDItemStackResponse
	IDPlayerArmourDamage
	IDCodeBuilder
	IDUpdatePlayerGameType
	IDEmoteList
	IDPositionTrackingDBServerBroadcast
	IDPositionTrackingDBClientRequest
	IDDebugInfo
	IDPacketViolationWarning
	IDMotionPredictionHints
	IDAnimateEntity
	IDCameraShake
	IDPlayerFog
	IDCorrectPlayerMovePrediction
	IDItemComponent
	IDFilterText
	IDClientBoundDebugRenderer
	IDSyncActorProperty
	IDAddVolumeEntity
	IDRemoveVolumeEntity
	IDSimulationType
	IDNPCDialogue
	IDEducationResourceURI
	IDCreatePhoto
	IDUpdateSubChunkBlocks
	IDPhotoInfoRequest
	IDSubChunk
	IDSubChunkRequest
	IDClientStartItemCooldown
	IDScriptMessage
	IDCodeBuilderSource
	IDTickingAreasLoadStatus
	IDDimensionData
	IDAgentAction
	IDChangeMobProperty
	IDLessonProgress
	IDRequestAbility
	IDRequestPermissions
	IDToastRequest
	IDUpdateAbilities
	IDUpdateAdventureSettings
	IDDeathInfo
	IDEditorNetwork
	IDFeatureRegistry
	IDServerStats
	IDRequestNetworkSettings
	IDGameTestRequest
	IDGameTestResults
	IDUpdateClientInputLocks
	IDClientCheatAbility
	IDCameraPresets
	IDUnlockedRecipes
	IDCameraInstruction = iota + 101
	IDCompressedBiomeDefinitionList
	IDTrimData
	IDOpenSign
)
View Source
const (
	InteractActionLeaveVehicle
	InteractActionMouseOverEntity
	InteractActionNPCOpen
	InteractActionOpenInventory
)
View Source
const (
	InventoryTransactionTypeNormal = iota
	InventoryTransactionTypeMismatch
	InventoryTransactionTypeUseItem
	InventoryTransactionTypeUseItemOnEntity
	InventoryTransactionTypeReleaseItem
)
View Source
const (
	LabTableActionCombine = iota
	LabTableActionReact
	LabTableActionReset
)
View Source
const (
	LessonActionStart = iota
	LessonActionComplete
	LessonActionRestart
)
View Source
const (
	LevelEventSoundClick                   = 1000
	LevelEventSoundClickFail               = 1001
	LevelEventSoundLaunch                  = 1002
	LevelEventSoundOpenDoor                = 1003
	LevelEventSoundFizz                    = 1004
	LevelEventSoundFuse                    = 1005
	LevelEventSoundPlayRecording           = 1006
	LevelEventSoundGhastWarning            = 1007
	LevelEventSoundGhastFireball           = 1008
	LevelEventSoundBlazeFireball           = 1009
	LevelEventSoundZombieWoodenDoor        = 1010
	LevelEventSoundZombieDoorCrash         = 1012
	LevelEventSoundZombieInfected          = 1016
	LevelEventSoundZombieConverted         = 1017
	LevelEventSoundEndermanTeleport        = 1018
	LevelEventSoundAnvilBroken             = 1020
	LevelEventSoundAnvilUsed               = 1021
	LevelEventSoundAnvilLand               = 1022
	LevelEventSoundInfinityArrowPickup     = 1030
	LevelEventSoundTeleportEnderPearl      = 1032
	LevelEventSoundAddItem                 = 1040
	LevelEventSoundItemFrameBreak          = 1041
	LevelEventSoundItemFramePlace          = 1042
	LevelEventSoundItemFrameRemoveItem     = 1043
	LevelEventSoundItemFrameRotateItem     = 1044
	LevelEventSoundExperienceOrbPickup     = 1051
	LevelEventSoundTotemUsed               = 1052
	LevelEventSoundArmorStandBreak         = 1060
	LevelEventSoundArmorStandHit           = 1061
	LevelEventSoundArmorStandLand          = 1062
	LevelEventSoundArmorStandPlace         = 1063
	LevelEventSoundPointedDripstoneLand    = 1064
	LevelEventSoundDyeUsed                 = 1065
	LevelEventSoundInkSacUsed              = 1066
	LevelEventSoundAmethystResonate        = 1067
	LevelEventQueueCustomMusic             = 1900
	LevelEventPlayCustomMusic              = 1901
	LevelEventStopCustomMusic              = 1902
	LevelEventSetMusicVolume               = 1903
	LevelEventParticlesShoot               = 2000
	LevelEventParticlesDestroyBlock        = 2001
	LevelEventParticlesPotionSplash        = 2002
	LevelEventParticlesEyeOfEnderDeath     = 2003
	LevelEventParticlesMobBlockSpawn       = 2004
	LevelEventParticleCropGrowth           = 2005
	LevelEventParticleSoundGuardianGhost   = 2006
	LevelEventParticleDeathSmoke           = 2007
	LevelEventParticleDenyBlock            = 2008
	LevelEventParticleGenericSpawn         = 2009
	LevelEventParticlesDragonEgg           = 2010
	LevelEventParticlesCropEaten           = 2011
	LevelEventParticlesCritical            = 2012
	LevelEventParticlesTeleport            = 2013
	LevelEventParticlesCrackBlock          = 2014
	LevelEventParticlesBubble              = 2015
	LevelEventParticlesEvaporate           = 2016
	LevelEventParticlesDestroyArmorStand   = 2017
	LevelEventParticlesBreakingEgg         = 2018
	LevelEventParticleDestroyEgg           = 2019
	LevelEventParticlesEvaporateWater      = 2020
	LevelEventParticlesDestroyBlockNoSound = 2021
	LevelEventParticlesKnockbackRoar       = 2022
	LevelEventParticlesTeleportTrail       = 2023
	LevelEventParticlesPointCloud          = 2024
	LevelEventParticlesExplosion           = 2025
	LevelEventParticlesBlockExplosion      = 2026
	LevelEventParticlesVibrationSignal     = 2027
	LevelEventParticlesDripstoneDrip       = 2028
	LevelEventParticlesFizzEffect          = 2029
	LevelEventWaxOn                        = 2030
	LevelEventWaxOff                       = 2031
	LevelEventScrape                       = 2032
	LevelEventParticlesElectricSpark       = 2033
	LevelEventParticleTurtleEgg            = 2034
	LevelEventParticleSculkShriek          = 2035
	LevelEventSculkCatalystBloom           = 2036
	LevelEventSculkCharge                  = 2037
	LevelEventSculkChargePop               = 2038
	LevelEventSonicExplosion               = 2039
	LevelEventStartRaining                 = 3001
	LevelEventStartThunderstorm            = 3002
	LevelEventStopRaining                  = 3003
	LevelEventStopThunderstorm             = 3004
	LevelEventGlobalPause                  = 3005
	LevelEventSimTimeStep                  = 3006
	LevelEventSimTimeScale                 = 3007
	LevelEventActivateBlock                = 3500
	LevelEventCauldronExplode              = 3501
	LevelEventCauldronDyeArmor             = 3502
	LevelEventCauldronCleanArmor           = 3503
	LevelEventCauldronFillPotion           = 3504
	LevelEventCauldronTakePotion           = 3505
	LevelEventCauldronFillWater            = 3506
	LevelEventCauldronTakeWater            = 3507
	LevelEventCauldronAddDye               = 3508
	LevelEventCauldronCleanBanner          = 3509
	LevelEventCauldronFlush                = 3510
	LevelEventAgentSpawnEffect             = 3511
	LevelEventCauldronFillLava             = 3512
	LevelEventCauldronTakeLava             = 3513
	LevelEventCauldronFillPowderSnow       = 3514
	LevelEventCauldronTakePowderSnow       = 3515
	LevelEventStartBlockCracking           = 3600
	LevelEventStopBlockCracking            = 3601
	LevelEventUpdateBlockCracking          = 3602
	LevelEventParticlesCrackBlockDown      = 3603
	LevelEventParticlesCrackBlockUp        = 3604
	LevelEventParticlesCrackBlockNorth     = 3605
	LevelEventParticlesCrackBlockSouth     = 3606
	LevelEventParticlesCrackBlockWest      = 3607
	LevelEventParticlesCrackBlockEast      = 3608
	LevelEventAllPlayersSleeping           = 9800
	LevelEventSleepingPlayers              = 9801
	LevelEventJumpPrevented                = 9810
	LevelEventParticleLegacyEvent          = 0x4000
)

noinspection SpellCheckingInspection

View Source
const (
	SoundEventItemUseOn = iota
	SoundEventHit
	SoundEventStep
	SoundEventFly
	SoundEventJump
	SoundEventBreak
	SoundEventPlace
	SoundEventHeavyStep
	SoundEventGallop
	SoundEventFall
	SoundEventAmbient
	SoundEventAmbientBaby
	SoundEventAmbientInWater
	SoundEventBreathe
	SoundEventDeath
	SoundEventDeathInWater
	SoundEventDeathToZombie
	SoundEventHurt
	SoundEventHurtInWater
	SoundEventMad
	SoundEventBoost
	SoundEventBow
	SoundEventSquishBig
	SoundEventSquishSmall
	SoundEventFallBig
	SoundEventFallSmall
	SoundEventSplash
	SoundEventFizz
	SoundEventFlap
	SoundEventSwim
	SoundEventDrink
	SoundEventEat
	SoundEventTakeoff
	SoundEventShake
	SoundEventPlop
	SoundEventLand
	SoundEventSaddle
	SoundEventArmor
	SoundEventArmorPlace
	SoundEventAddChest
	SoundEventThrow
	SoundEventAttack
	SoundEventAttackNoDamage
	SoundEventAttackStrong
	SoundEventWarn
	SoundEventShear
	SoundEventMilk
	SoundEventThunder
	SoundEventExplode
	SoundEventFire
	SoundEventIgnite
	SoundEventFuse
	SoundEventStare
	SoundEventSpawn
	SoundEventShoot
	SoundEventBreakBlock
	SoundEventLaunch
	SoundEventBlast
	SoundEventLargeBlast
	SoundEventTwinkle
	SoundEventRemedy
	SoundEventUnfect
	SoundEventLevelUp
	SoundEventBowHit
	SoundEventBulletHit
	SoundEventExtinguishFire
	SoundEventItemFizz
	SoundEventChestOpen
	SoundEventChestClosed
	SoundEventShulkerBoxOpen
	SoundEventShulkerBoxClosed
	SoundEventEnderChestOpen
	SoundEventEnderChestClosed
	SoundEventPowerOn
	SoundEventPowerOff
	SoundEventAttach
	SoundEventDetach
	SoundEventDeny
	SoundEventTripod
	SoundEventPop
	SoundEventDropSlot
	SoundEventNote
	SoundEventThorns
	SoundEventPistonIn
	SoundEventPistonOut
	SoundEventPortal
	SoundEventWater
	SoundEventLavaPop
	SoundEventLava
	SoundEventBurp
	SoundEventBucketFillWater
	SoundEventBucketFillLava
	SoundEventBucketEmptyWater
	SoundEventBucketEmptyLava
	SoundEventEquipChain
	SoundEventEquipDiamond
	SoundEventEquipGeneric
	SoundEventEquipGold
	SoundEventEquipIron
	SoundEventEquipLeather
	SoundEventEquipElytra
	SoundEventRecord13
	SoundEventRecordCat
	SoundEventRecordBlocks
	SoundEventRecordChirp
	SoundEventRecordFar
	SoundEventRecordMall
	SoundEventRecordMellohi
	SoundEventRecordStal
	SoundEventRecordStrad
	SoundEventRecordWard
	SoundEventRecord11
	SoundEventRecordWait
	SoundEventRecordNull
	SoundEventFlop
	SoundEventGuardianCurse
	SoundEventMobWarning
	SoundEventMobWarningBaby
	SoundEventTeleport
	SoundEventShulkerOpen
	SoundEventShulkerClose
	SoundEventHaggle
	SoundEventHaggleYes
	SoundEventHaggleNo
	SoundEventHaggleIdle
	SoundEventChorusGrow
	SoundEventChorusDeath
	SoundEventGlass
	SoundEventPotionBrewed
	SoundEventCastSpell
	SoundEventPrepareAttackSpell
	SoundEventPrepareSummon
	SoundEventPrepareWololo
	SoundEventFang
	SoundEventCharge
	SoundEventTakePicture
	SoundEventPlaceLeashKnot
	SoundEventBreakLeashKnot
	SoundEventAmbientGrowl
	SoundEventAmbientWhine
	SoundEventAmbientPant
	SoundEventAmbientPurr
	SoundEventAmbientPurreow
	SoundEventDeathMinVolume
	SoundEventDeathMidVolume
	SoundEventImitateBlaze
	SoundEventImitateCaveSpider
	SoundEventImitateCreeper
	SoundEventImitateElderGuardian
	SoundEventImitateEnderDragon
	SoundEventImitateEnderman
	SoundEventImitateEndermite
	SoundEventImitateEvocationIllager
	SoundEventImitateGhast
	SoundEventImitateHusk
	SoundEventImitateIllusionIllager
	SoundEventImitateMagmaCube
	SoundEventImitatePolarBear
	SoundEventImitateShulker
	SoundEventImitateSilverfish
	SoundEventImitateSkeleton
	SoundEventImitateSlime
	SoundEventImitateSpider
	SoundEventImitateStray
	SoundEventImitateVex
	SoundEventImitateVindicationIllager
	SoundEventImitateWitch
	SoundEventImitateWither
	SoundEventImitateWitherSkeleton
	SoundEventImitateWolf
	SoundEventImitateZombie
	SoundEventImitateZombiePigman
	SoundEventImitateZombieVillager
	SoundEventEnderEyePlaced
	SoundEventEndPortalCreated
	SoundEventAnvilUse
	SoundEventBottleDragonBreath
	SoundEventPortalTravel
	SoundEventTridentHit
	SoundEventTridentReturn
	SoundEventTridentRiptide1
	SoundEventTridentRiptide2
	SoundEventTridentRiptide3
	SoundEventTridentThrow
	SoundEventTridentThunder
	SoundEventTridentHitGround
	SoundEventDefault
	SoundEventFletchingTableUse
	SoundEventElemConstructOpen
	SoundEventIceBombHit
	SoundEventBalloonPop
	SoundEventLtReactionIceBomb
	SoundEventLtReactionBleach
	SoundEventLtReactionElephantToothpaste
	SoundEventLtReactionElephantToothpaste2
	SoundEventLtReactionGlowStick
	SoundEventLtReactionGlowStick2
	SoundEventLtReactionLuminol
	SoundEventLtReactionSalt
	SoundEventLtReactionFertilizer
	SoundEventLtReactionFireball
	SoundEventLtReactionMagnesiumSalt
	SoundEventLtReactionMiscFire
	SoundEventLtReactionFire
	SoundEventLtReactionMiscExplosion
	SoundEventLtReactionMiscMystical
	SoundEventLtReactionMiscMystical2
	SoundEventLtReactionProduct
	SoundEventSparklerUse
	SoundEventGlowStickUse
	SoundEventSparklerActive
	SoundEventConvertToDrowned
	SoundEventBucketFillFish
	SoundEventBucketEmptyFish
	SoundEventBubbleColumnUpwards
	SoundEventBubbleColumnDownwards
	SoundEventBubblePop
	SoundEventBubbleUpInside
	SoundEventBubbleDownInside
	SoundEventHurtBaby
	SoundEventDeathBaby
	SoundEventStepBaby
	SoundEventSpawnBaby
	SoundEventBorn
	SoundEventTurtleEggBreak
	SoundEventTurtleEggCrack
	SoundEventTurtleEggHatched
	SoundEventLayEgg
	SoundEventTurtleEggAttacked
	SoundEventBeaconActivate
	SoundEventBeaconAmbient
	SoundEventBeaconDeactivate
	SoundEventBeaconPower
	SoundEventConduitActivate
	SoundEventConduitAmbient
	SoundEventConduitAttack
	SoundEventConduitDeactivate
	SoundEventConduitShort
	SoundEventSwoop
	SoundEventBambooSaplingPlace
	SoundEventPreSneeze
	SoundEventSneeze
	SoundEventAmbientTame
	SoundEventScared
	SoundEventScaffoldingClimb
	SoundEventCrossbowLoadingStart
	SoundEventCrossbowLoadingMiddle
	SoundEventCrossbowLoadingEnd
	SoundEventCrossbowShoot
	SoundEventCrossbowQuickChargeStart
	SoundEventCrossbowQuickChargeMiddle
	SoundEventCrossbowQuickChargeEnd
	SoundEventAmbientAggressive
	SoundEventAmbientWorried
	SoundEventCantBreed
	SoundEventShieldBlock
	SoundEventLecternBookPlace
	SoundEventGrindstoneUse
	SoundEventBell
	SoundEventCampfireCrackle
	SoundEventRoar
	SoundEventStun
	SoundEventSweetBerryBushHurt
	SoundEventSweetBerryBushPick
	SoundEventCartographyTableUse
	SoundEventStonecutterUse
	SoundEventComposterEmpty
	SoundEventComposterFill
	SoundEventComposterFillLayer
	SoundEventComposterReady
	SoundEventBarrelOpen
	SoundEventBarrelClose
	SoundEventRaidHorn
	SoundEventLoomUse
	SoundEventAmbientInRaid
	SoundEventUicartographyTableUse
	SoundEventUistonecutterUse
	SoundEventUiloomUse
	SoundEventSmokerUse
	SoundEventBlastFurnaceUse
	SoundEventSmithingTableUse
	SoundEventScreech
	SoundEventSleep
	SoundEventFurnaceUse
	SoundEventMooshroomConvert
	SoundEventMilkSuspiciously
	SoundEventCelebrate
	SoundEventJumpPrevent
	SoundEventAmbientPollinate
	SoundEventBeehiveDrip
	SoundEventBeehiveEnter
	SoundEventBeehiveExit
	SoundEventBeehiveWork
	SoundEventBeehiveShear
	SoundEventHoneybottleDrink
	SoundEventAmbientCave
	SoundEventRetreat
	SoundEventConvertToZombified
	SoundEventAdmire
	SoundEventStepLava
	SoundEventTempt
	SoundEventPanic
	SoundEventAngry
	SoundEventAmbientMoodWarpedForest
	SoundEventAmbientMoodSoulsandValley
	SoundEventAmbientMoodNetherWastes
	SoundEventAmbientMoodBasaltDeltas
	SoundEventAmbientMoodCrimsonForest
	SoundEventRespawnAnchorCharge
	SoundEventRespawnAnchorDeplete
	SoundEventRespawnAnchorSetSpawn
	SoundEventRespawnAnchorAmbient
	SoundEventSoulEscapeQuiet
	SoundEventSoulEscapeLoud
	SoundEventRecordPigstep
	SoundEventLinkCompassToLodestone
	SoundEventUseSmithingTable
	SoundEventEquipNetherite
	SoundEventAmbientLoopWarpedForest
	SoundEventAmbientLoopSoulsandValley
	SoundEventAmbientLoopNetherWastes
	SoundEventAmbientLoopBasaltDeltas
	SoundEventAmbientLoopCrimsonForest
	SoundEventAmbientAdditionWarpedForest
	SoundEventAmbientAdditionSoulsandValley
	SoundEventAmbientAdditionNetherWastes
	SoundEventAmbientAdditionBasaltDeltas
	SoundEventAmbientAdditionCrimsonForest
	SoundEventSculkSensorPowerOn
	SoundEventSculkSensorPowerOff
	SoundEventBucketFillPowderSnow
	SoundEventBucketEmptyPowderSnow
	SoundEventPointedDripstoneCauldronDripWater
	SoundEventPointedDripstoneCauldronDripLava
	SoundEventPointedDripstoneDripWater
	SoundEventPointedDripstoneDripLava
	SoundEventCaveVinesPickBerries
	SoundEventBigDripleafTiltDown
	SoundEventBigDripleafTiltUp
	SoundEventCopperWaxOn
	SoundEventCopperWaxOff
	SoundEventScrape
	SoundEventPlayerHurtDrown
	SoundEventPlayerHurtOnFire
	SoundEventPlayerHurtFreeze
	SoundEventUseSpyglass
	SoundEventStopUsingSpyglass
	SoundEventAmethystBlockChime
	SoundEventAmbientScreamer
	SoundEventHurtScreamer
	SoundEventDeathScreamer
	SoundEventMilkScreamer
	SoundEventJumpToBlock
	SoundEventPreRam
	SoundEventPreRamScreamer
	SoundEventRamImpact
	SoundEventRamImpactScreamer
	SoundEventSquidInkSquirt
	SoundEventGlowSquidInkSquirt
	SoundEventConvertToStray
	SoundEventCakeAddCandle
	SoundEventExtinguishCandle
	SoundEventAmbientCandle
	SoundEventBlockClick
	SoundEventBlockClickFail
	SoundEventSculkCatalystBloom
	SoundEventSculkShriekerShriek
	SoundEventWardenNearbyClose
	SoundEventWardenNearbyCloser
	SoundEventWardenNearbyClosest
	SoundEventWardenSlightlyAngry
	SoundEventRecordOtherside
	SoundEventTongue
	SoundEventCrackIronGolem
	SoundEventRepairIronGolem
	SoundEventListening
	SoundEventHeartbeat
	SoundEventHornBreak

	SoundEventSculkSpread
	SoundEventSculkCharge
	SoundEventSculkSensorPlace
	SoundEventSculkShriekerPlace
	SoundEventGoatCall0
	SoundEventGoatCall1
	SoundEventGoatCall2
	SoundEventGoatCall3
	SoundEventGoatCall4
	SoundEventGoatCall5
	SoundEventGoatCall6
	SoundEventGoatCall7

	SoundEventImitateWarden
	SoundEventListeningAngry
	SoundEventItemGiven
	SoundEventItemTaken
	SoundEventDisappeared
	SoundEventReappeared
	SoundEventDrinkMilk
	SoundEventFrogspawnHatched
	SoundEventLaySpawn
	SoundEventFrogspawnBreak
	SoundEventSonicBoom
	SoundEventSonicCharge
	SoundeventItemThrown
	SoundEventRecord5
	SoundEventConvertToFrog
	SoundEventRecordPlaying
	SoundEventEnchantingTableUse
	SoundEventStepSand
	SoundEventDashReady
	SoundEventBundleDropContents
	SoundEventBundleInsert
	SoundEventBundleRemoveOne
	SoundEventPressurePlateClickOff
	SoundEventPressurePlateClickOn
	SoundEventButtonClickOff
	SoundEventButtonClickOn
	SoundEventDoorOpen
	SoundEventDoorClose
	SoundEventTrapdoorOpen
	SoundEventTrapdoorClose
	SoundEventFenceGateOpen
	SoundEventFenceGateClose
	SoundEventInsert
	SoundEventPickup
	SoundEventInsertEnchanted
	SoundEventPickupEnchanted
	SoundEventBrush
	SoundEventBrushCompleted
	SoundEventShatterDecoratedPot
	SoundEventBreakDecoratedPot
	SoundEventSnifferEggCrack
	SoundEventSnifferEggHatched
	SoundEventWaxedSignInteractFail
	SoundEventRecordRelic
)

noinspection SpellCheckingInspection

View Source
const (
	MobEffectAdd = iota + 1
	MobEffectModify
	MobEffectRemove
)
View Source
const (
	EffectSpeed = iota + 1
	EffectSlowness
	EffectHaste
	EffectMiningFatigue
	EffectStrength
	EffectInstantHealth
	EffectInstantDamage
	EffectJumpBoost
	EffectNausea
	EffectRegeneration
	EffectResistance
	EffectFireResistance
	EffectWaterBreathing
	EffectInvisibility
	EffectBlindness
	EffectNightVision
	EffectHunger
	EffectWeakness
	EffectPoison
	EffectWither
	EffectHealthBoost
	EffectAbsorption
	EffectSaturation
	EffectLevitation
	EffectFatalPoison
	EffectConduitPower
	EffectSlowFalling
)
View Source
const (
	ModalFormCancelReasonUserClosed = iota
	ModalFormCancelReasonUserBusy
)
View Source
const (
	MoveFlagOnGround = 1 << iota
	MoveFlagTeleport
)
View Source
const (
	MoveActorDeltaFlagHasX = 1 << iota
	MoveActorDeltaFlagHasY
	MoveActorDeltaFlagHasZ
	MoveActorDeltaFlagHasRotX
	MoveActorDeltaFlagHasRotY
	MoveActorDeltaFlagHasRotZ
	MoveActorDeltaFlagOnGround
	MoveActorDeltaFlagTeleport
	MoveActorDeltaFlagForceMove
)
View Source
const (
	MoveModeNormal = iota
	MoveModeReset
	MoveModeTeleport
	MoveModeRotation
)
View Source
const (
	TeleportCauseUnknown = iota
	TeleportCauseProjectile
	TeleportCauseChorusFruit
	TeleportCauseCommand
	TeleportCauseBehaviour
)
View Source
const (
	EnableMultiPlayer = iota
	DisableMultiPlayer
	RefreshJoinCode
)
View Source
const (
	NPCDialogueActionOpen int32 = iota
	NPCDialogueActionClose
)
View Source
const (
	NPCRequestActionSetActions = iota
	NPCRequestActionExecuteAction
	NPCRequestActionExecuteClosingCommands
	NPCRequestActionSetName
	NPCRequestActionSetSkin
	NPCRequestActionSetInteractText
	NPCRequestActionExecuteOpeningCommands
)
View Source
const (
	ViolationSeverityWarning = iota
	ViolationSeverityFinalWarning
	ViolationSeverityTerminatingConnection
)
View Source
const (
	PhotoTypePortfolio uint8 = iota
	PhotoTypePhotoItem
	PhotoTypeBook
)
View Source
const (
	PlayStatusLoginSuccess int32 = iota
	PlayStatusLoginFailedClient
	PlayStatusLoginFailedServer
	PlayStatusPlayerSpawn
	PlayStatusLoginFailedInvalidTenant
	PlayStatusLoginFailedVanillaEdu
	PlayStatusLoginFailedEduVanilla
	PlayStatusLoginFailedServerFull
	PlayStatusLoginFailedEditorVanilla
	PlayStatusLoginFailedVanillaEditor
)
View Source
const (
	InputFlagAscend = 1 << iota
	InputFlagDescend
	InputFlagNorthJump
	InputFlagJumpDown
	InputFlagSprintDown
	InputFlagChangeHeight
	InputFlagJumping
	InputFlagAutoJumpingInWater
	InputFlagSneaking
	InputFlagSneakDown
	InputFlagUp
	InputFlagDown
	InputFlagLeft
	InputFlagRight
	InputFlagUpLeft
	InputFlagUpRight
	InputFlagWantUp
	InputFlagWantDown
	InputFlagWantDownSlow
	InputFlagWantUpSlow
	InputFlagSprinting
	InputFlagAscendBlock
	InputFlagDescendBlock
	InputFlagSneakToggleDown
	InputFlagPersistSneak
	InputFlagStartSprinting
	InputFlagStopSprinting
	InputFlagStartSneaking
	InputFlagStopSneaking
	InputFlagStartSwimming
	InputFlagStopSwimming
	InputFlagStartJumping
	InputFlagStartGliding
	InputFlagStopGliding
	InputFlagPerformItemInteraction
	InputFlagPerformBlockActions
	InputFlagPerformItemStackRequest
	InputFlagHandledTeleport
	InputFlagEmoting
)
View Source
const (
	InputModeMouse = iota + 1
	InputModeTouch
	InputModeGamePad
	InputModeMotionController
)
View Source
const (
	PlayModeNormal = iota
	PlayModeTeaser
	PlayModeScreen
	PlayModeViewer
	PlayModeReality
	PlayModePlacement
	PlayModeLivingRoom
	PlayModeExitLevel
	PlayModeExitLevelLivingRoom
	PlayModeNumModes
)
View Source
const (
	InteractionModelTouch = iota
	InteractionModelCrosshair
	InteractionModelClassic
)
View Source
const (
	PlayerListActionAdd = iota
	PlayerListActionRemove
)
View Source
const (
	PositionTrackingDBBroadcastActionUpdate = iota
	PositionTrackingDBBroadcastActionDestroy
	PositionTrackingDBBroadcastActionNotFound
)
View Source
const (
	AbilityBuild = iota
	AbilityMine
	AbilityDoorsAndSwitches
	AbilityOpenContainers
	AbilityAttackPlayers
	AbilityAttackMobs
	AbilityOperatorCommands
	AbilityTeleport
	AbilityInvulnerable
	AbilityFlying
	AbilityMayFly
	AbilityInstantBuild
	AbilityLightning
	AbilityFlySpeed
	AbilityWalkSpeed
	AbilityMuted
	AbilityWorldBuilder
	AbilityNoClip
	AbilityCount
)
View Source
const (
	PackResponseRefused = iota + 1
	PackResponseSendPacks
	PackResponseAllPacksDownloaded
	PackResponseCompleted
)
View Source
const (
	ResourcePackTypeAddon = iota + 1
	ResourcePackTypeCached
	ResourcePackTypeCopyProtected
	ResourcePackTypeBehaviour
	ResourcePackTypePersonaPiece
	ResourcePackTypeResources
	ResourcePackTypeSkins
	ResourcePackTypeWorldTemplate
)

noinspection SpellCheckingInspection

View Source
const (
	RespawnStateSearchingForSpawn = iota
	RespawnStateReadyToSpawn
	RespawnStateClientReadyToSpawn
)
View Source
const (
	ScoreboardSortOrderAscending = iota
	ScoreboardSortOrderDescending
)
View Source
const (
	ScoreboardSlotList      = "list"
	ScoreboardSlotSidebar   = "sidebar"
	ScoreboardSlotBelowName = "belowname"
)

noinspection SpellCheckingInspection

View Source
const (
	GameTypeSurvival = iota
	GameTypeCreative
	GameTypeAdventure
	GameTypeSurvivalSpectator
	GameTypeCreativeSpectator
	GameTypeDefault
	GameTypeSpectator
)
View Source
const (
	ScoreboardActionModify = iota
	ScoreboardActionRemove
)
View Source
const (
	ScoreboardIdentityActionRegister = iota
	ScoreboardIdentityActionClear
)
View Source
const (
	SpawnTypePlayer = iota
	SpawnTypeWorld
)
View Source
const (
	TitleActionClear = iota
	TitleActionReset
	TitleActionSetTitle
	TitleActionSetSubtitle
	TitleActionSetActionBar
	TitleActionSetDurations
	TitleActionTitleTextObject
	TitleActionSubtitleTextObject
	TitleActionActionbarTextObject
)
View Source
const (
	ShowCreditsStatusStart = iota
	ShowCreditsStatusEnd
)
View Source
const (
	SimpleEventCommandsEnabled = iota + 1
	SimpleEventCommandsDisabled
	SimpleEventUnlockWorldTemplateSettings
)
View Source
const (
	SimulationTypeGame byte = iota
	SimulationTypeEditor
	SimulationTypeTest
	SimulationTypeInvalid
)
View Source
const (
	SpawnBiomeTypeDefault = iota
	SpawnBiomeTypeUserDefined
)
View Source
const (
	ChatRestrictionLevelNone     = 0
	ChatRestrictionLevelDropped  = 1
	ChatRestrictionLevelDisabled = 2
)
View Source
const (
	StructureBlockData = iota
	StructureBlockSave
	StructureBlockLoad
	StructureBlockCorner
	StructureBlockInvalid
	StructureBlockExport
)
View Source
const (
	StructureRedstoneSaveModeMemory = iota
	StructureRedstoneSaveModeDisk
)
View Source
const (
	StructureTemplateRequestExportFromSave = iota + 1
	StructureTemplateRequestExportFromLoad
	StructureTemplateRequestQuerySavedStructure
	StructureTemplateRequestImportFromSave
)
View Source
const (
	StructureTemplateResponseExport = iota + 1
	StructureTemplateResponseQuery
	StructureTemplateResponseImport
)
View Source
const (
	TextTypeRaw = iota
	TextTypeChat
	TextTypeTranslation
	TextTypePopup
	TextTypeJukeboxPopup
	TextTypeTip
	TextTypeSystem
	TextTypeWhisper
	TextTypeAnnouncement
	TextTypeObjectWhisper
	TextTypeObject
	TextTypeObjectAnnouncement
)
View Source
const (
	UnlockedRecipesTypeEmpty = iota
	UnlockedRecipesTypeInitiallyUnlocked
	UnlockedRecipesTypeNewlyUnlocked
	UnlockedRecipesTypeRemoveUnlocked
	UnlockedRecipesTypeRemoveAllUnlocked
)
View Source
const (
	BlockUpdateNeighbours = 1 << iota
	BlockUpdateNetwork
	BlockUpdateNoGraphics
	BlockUpdatePriority
)
View Source
const (
	BlockToEntityTransition = iota + 1
	EntityToBlockTransition
)
View Source
const (
	ClientInputLockMove = 1 << (iota + 1)
	ClientInputLockJump
	ClientInputLockSneak
	ClientInputLockMount
	ClientInputLockDismount
	ClientInputLockRotation
)
View Source
const (
	SoftEnumActionAdd = iota
	SoftEnumActionRemove
	SoftEnumActionSet
)
View Source
const (
	BlockEventChangeChestState = 1
)
View Source
const (
	PositionTrackingDBRequestActionQuery = iota
)
View Source
const (
	ViolationTypeMalformed = iota
)

Variables

View Source
var (
	// FlateCompression is the implementation of the Flate compression
	// algorithm. This was used by default until v1.19.30.
	FlateCompression flateCompression
	// SnappyCompression is the implementation of the Snappy compression
	// algorithm. This is used by default.
	SnappyCompression snappyCompression

	DefaultCompression Compression = FlateCompression
)

Functions

func RegisterCompression

func RegisterCompression(compression Compression)

RegisterCompression registers a compression so that it can be used by the protocol.

func RegisterPacketFromClient

func RegisterPacketFromClient(id uint32, pk func() Packet)

RegisterPacketFromClient registers a function that returns a packet for a specific ID. Packets with this ID coming in from connections will resolve to the packet returned by the function passed. noinspection

func RegisterPacketFromServer

func RegisterPacketFromServer(id uint32, pk func() Packet)

RegisterPacketFromServer registers a function that returns a packet for a specific ID. Packets with this ID coming in from connections will resolve to the packet returned by the function passed. noinspection

Types

type ActorEvent

type ActorEvent struct {
	// EntityRuntimeID is the runtime ID of the entity. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// EventType is the ID of the event to be called. It is one of the constants that can be found above.
	EventType byte
	// EventData is optional data associated with a particular event. The data has a different function for
	// different events, however most events don't use this field at all.
	EventData int32
}

ActorEvent is sent by the server when a particular event happens that has to do with an entity. Some of these events are entity-specific, for example a wolf shaking itself dry, but others are used for each entity, such as dying.

func (*ActorEvent) ID

func (*ActorEvent) ID() uint32

ID ...

func (*ActorEvent) Marshal

func (pk *ActorEvent) Marshal(io protocol.IO)

type ActorPickRequest

type ActorPickRequest struct {
	// EntityUniqueID is the unique ID of the entity that was attempted to be picked. The server must find the
	// type of that entity and provide the correct spawn egg to the player.
	EntityUniqueID int64
	// HotBarSlot is the held hot bar slot of the player at the time of trying to pick the entity. If empty,
	// the resulting spawn egg should be put into this slot.
	HotBarSlot byte
	// WithData is true if the pick request requests the entity metadata.
	WithData bool
}

ActorPickRequest is sent by the client when it tries to pick an entity, so that it gets a spawn egg which can spawn that entity.

func (*ActorPickRequest) ID

func (*ActorPickRequest) ID() uint32

ID ...

func (*ActorPickRequest) Marshal

func (pk *ActorPickRequest) Marshal(io protocol.IO)

type AddActor

type AddActor struct {
	// EntityUniqueID is the unique ID of the entity. The unique ID is a value that remains consistent across
	// different sessions of the same world, but most servers simply fill the runtime ID of the entity out for
	// this field.
	EntityUniqueID int64
	// EntityRuntimeID is the runtime ID of the entity. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// EntityType is the string entity type of the entity, for example 'minecraft:skeleton'. A list of these
	// entities may be found online.
	EntityType string
	// Position is the position to spawn the entity on. If the entity is on a distance that the player cannot
	// see it, the entity will still show up if the player moves closer.
	Position mgl32.Vec3
	// Velocity is the initial velocity the entity spawns with. This velocity will initiate client side
	// movement of the entity.
	Velocity mgl32.Vec3
	// Pitch is the vertical rotation of the entity. Facing straight forward yields a pitch of 0. Pitch is
	// measured in degrees.
	Pitch float32
	// Yaw is the horizontal rotation of the entity. Yaw is also measured in degrees.
	Yaw float32
	// HeadYaw is the same as Yaw, except that it applies specifically to the head of the entity. A different value for
	// HeadYaw than Yaw means that the entity will have its head turned.
	HeadYaw float32
	// BodyYaw is the same as Yaw, except that it applies specifically to the body of the entity. A different value for
	// BodyYaw than HeadYaw means that the entity will have its body turned, although it is unclear what the difference
	// between BodyYaw and Yaw is.
	BodyYaw float32
	// Attributes is a slice of attributes that the entity has. It includes attributes such as its health,
	// movement speed, etc.
	Attributes []protocol.AttributeValue
	// EntityMetadata is a map of entity metadata, which includes flags and data properties that alter in
	// particular the way the entity looks. Flags include ones such as 'on fire' and 'sprinting'.
	// The metadata values are indexed by their property key.
	EntityMetadata map[uint32]any
	// EntityProperties is a list of properties that the entity inhibits. These properties define and alter specific
	// attributes of the entity.
	EntityProperties protocol.EntityProperties
	// EntityLinks is a list of entity links that are currently active on the entity. These links alter the
	// way the entity shows up when first spawned in terms of it shown as riding an entity. Setting these
	// links is important for new viewers to see the entity is riding another entity.
	EntityLinks []protocol.EntityLink
}

AddActor is sent by the server to the client to spawn an entity to the player. It is used for every entity except other players, for which the AddPlayer packet is used.

func (*AddActor) ID

func (*AddActor) ID() uint32

ID ...

func (*AddActor) Marshal

func (pk *AddActor) Marshal(io protocol.IO)

type AddBehaviourTree

type AddBehaviourTree struct {
	// BehaviourTree is an unused string.
	BehaviourTree string
}

AddBehaviourTree is sent by the server to the client. The packet is currently unused by both client and server.

func (*AddBehaviourTree) ID

func (*AddBehaviourTree) ID() uint32

ID ...

func (*AddBehaviourTree) Marshal

func (pk *AddBehaviourTree) Marshal(io protocol.IO)

type AddEntity

type AddEntity struct {
	// EntityNetworkID is the network ID of the entity that should be added.
	EntityNetworkID uint64
}

AddEntity is sent by the server to the client. Its function is not entirely clear: It does not add an entity in the sense of an in-game entity, but has to do with the ECS that Minecraft uses.

func (*AddEntity) ID

func (pk *AddEntity) ID() uint32

ID ...

func (*AddEntity) Marshal

func (pk *AddEntity) Marshal(io protocol.IO)

type AddItemActor

type AddItemActor struct {
	// EntityUniqueID is the unique ID of the entity. The unique ID is a value that remains consistent across
	// different sessions of the same world, but most servers simply fill the runtime ID of the entity out for
	// this field.
	EntityUniqueID int64
	// EntityRuntimeID is the runtime ID of the entity. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// Item is the item that is spawned. It must have a valid ID for it to show up client-side. If it is not
	// a valid item, the client will crash when coming near.
	Item protocol.ItemInstance
	// Position is the position to spawn the entity on. If the entity is on a distance that the player cannot
	// see it, the entity will still show up if the player moves closer.
	Position mgl32.Vec3
	// Velocity is the initial velocity the entity spawns with. This velocity will initiate client side
	// movement of the entity.
	Velocity mgl32.Vec3
	// EntityMetadata is a map of entity metadata, which includes flags and data properties that alter in
	// particular the way the entity looks. Flags include ones such as 'on fire' and 'sprinting'.
	// The metadata values are indexed by their property key.
	EntityMetadata map[uint32]any
	// FromFishing specifies if the item was obtained by fishing it up using a fishing rod. It is not clear
	// why the client needs to know this.
	FromFishing bool
}

AddItemActor is sent by the server to the client to make an item entity show up. It is one of the few entities that cannot be sent using the AddActor packet

func (*AddItemActor) ID

func (*AddItemActor) ID() uint32

ID ...

func (*AddItemActor) Marshal

func (pk *AddItemActor) Marshal(io protocol.IO)

type AddPainting

type AddPainting struct {
	// EntityUniqueID is the unique ID of the entity. The unique ID is a value that remains consistent across
	// different sessions of the same world, but most servers simply fill the runtime ID of the entity out for
	// this field.
	EntityUniqueID int64
	// EntityRuntimeID is the runtime ID of the entity. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// Position is the position to spawn the entity on. If the entity is on a distance that the player cannot
	// see it, the entity will still show up if the player moves closer.
	Position mgl32.Vec3
	// Direction is the facing direction of the painting.
	Direction int32
	// Title is the title of the painting. It specifies the motive of the painting. The title of the painting
	// must be valid.
	Title string
}

AddPainting is sent by the server to the client to make a painting entity show up. It is one of the few entities that cannot be sent using the AddActor packet.

func (*AddPainting) ID

func (*AddPainting) ID() uint32

ID ...

func (*AddPainting) Marshal

func (pk *AddPainting) Marshal(io protocol.IO)

type AddPlayer

type AddPlayer struct {
	// UUID is the UUID of the player. It is the same UUID that the client sent in the Login packet at the
	// start of the session. A player with this UUID must exist in the player list (built up using the
	// PlayerList packet), for it to show up in-game.
	UUID uuid.UUID
	// Username is the name of the player. This username is the username that will be set as the initial
	// name tag of the player.
	Username string
	// EntityRuntimeID is the runtime ID of the player. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// PlatformChatID is an identifier only set for particular platforms when chatting (presumably only for
	// Nintendo Switch). It is otherwise an empty string, and is used to decide which players are able to
	// chat with each other.
	PlatformChatID string
	// Position is the position to spawn the player on. If the player is on a distance that the viewer cannot
	// see it, the player will still show up if the viewer moves closer.
	Position mgl32.Vec3
	// Velocity is the initial velocity the player spawns with. This velocity will initiate client side
	// movement of the player.
	Velocity mgl32.Vec3
	// Pitch is the vertical rotation of the player. Facing straight forward yields a pitch of 0. Pitch is
	// measured in degrees.
	Pitch float32
	// Yaw is the horizontal rotation of the player. Yaw is also measured in degrees.
	Yaw float32
	// HeadYaw is the same as Yaw, except that it applies specifically to the head of the player. A different
	// value for HeadYaw than Yaw means that the player will have its head turned.
	HeadYaw float32
	// HeldItem is the item that the player is holding. The item is shown to the viewer as soon as the player
	// itself shows up. Needless to say that this field is rather pointless, as additional packets still must
	// be sent for armour to show up.
	HeldItem protocol.ItemInstance
	// GameType is the game type of the player. If set to GameTypeSpectator, the player will not be shown to viewers.
	GameType int32
	// EntityMetadata is a map of entity metadata, which includes flags and data properties that alter in
	// particular the way the player looks. Flags include ones such as 'on fire' and 'sprinting'.
	// The metadata values are indexed by their property key.
	EntityMetadata map[uint32]any
	// EntityProperties is a list of properties that the entity inhibits. These properties define and alter specific
	// attributes of the entity.
	EntityProperties protocol.EntityProperties
	// AbilityData represents various data about the abilities of a player, such as ability layers or permissions.
	AbilityData protocol.AbilityData
	// EntityLinks is a list of entity links that are currently active on the player. These links alter the
	// way the player shows up when first spawned in terms of it shown as riding an entity. Setting these
	// links is important for new viewers to see the player is riding another entity.
	EntityLinks []protocol.EntityLink
	// DeviceID is the device ID set in one of the files found in the storage of the device of the player. It
	// may be changed freely, so it should not be relied on for anything.
	DeviceID string
	// BuildPlatform is the build platform/device OS of the player that is about to be added, as it sent in
	// the Login packet when joining.
	BuildPlatform int32
}

AddPlayer is sent by the server to the client to make a player entity show up client-side. It is one of the few entities that cannot be sent using the AddActor packet.

func (*AddPlayer) ID

func (*AddPlayer) ID() uint32

ID ...

func (*AddPlayer) Marshal

func (pk *AddPlayer) Marshal(io protocol.IO)

type AddVolumeEntity

type AddVolumeEntity struct {
	// EntityRuntimeID is the runtime ID of the volume. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// EntityMetadata is a map of entity metadata, which includes flags and data properties that alter in
	// particular the way the volume functions or looks.
	EntityMetadata map[string]any
	// EncodingIdentifier is the unique identifier for the volume. It must be of the form 'namespace:name', where
	// namespace cannot be 'minecraft'.
	EncodingIdentifier string
	// InstanceIdentifier is the identifier of a fog definition.
	InstanceIdentifier string
	// Bounds represent the volume's bounds. The first value is the minimum bounds, and the second value is the
	// maximum bounds.
	Bounds [2]protocol.BlockPos
	// Dimension is the dimension in which the volume exists.
	Dimension int32
	// EngineVersion is the engine version the entity is using, for example, '1.17.0'.
	EngineVersion string
}

AddVolumeEntity sends a volume entity's definition and metadata from server to client.

func (*AddVolumeEntity) ID

func (*AddVolumeEntity) ID() uint32

ID ...

func (*AddVolumeEntity) Marshal

func (pk *AddVolumeEntity) Marshal(io protocol.IO)

type AdventureSettings

type AdventureSettings struct {
	// Flags is a set of flags that specify certain properties of the player, such as whether or not it can
	// fly and/or move through blocks. It is one of the AdventureFlag constants above.
	Flags uint32
	// CommandPermissionLevel is a permission level that specifies the kind of commands that the player is
	// allowed to use. It is one of the CommandPermissionLevel constants above.
	CommandPermissionLevel uint32
	// ActionPermissions is, much like Flags, a set of flags that specify actions that the player is allowed
	// to undertake, such as whether it is allowed to edit blocks, open doors etc. It is a combination of the
	// ActionPermission constants above.
	ActionPermissions uint32
	// PermissionLevel is the permission level of the player as it shows up in the player list built up using
	// the PlayerList packet. It is one of the PermissionLevel constants above.
	PermissionLevel uint32
	// CustomStoredPermissions ...
	CustomStoredPermissions uint32
	// PlayerUniqueID is a unique identifier of the player. This must be filled out with the entity unique ID of the
	// player.
	PlayerUniqueID int64
}

AdventureSettings is sent by the server to update game-play related features, in particular permissions to access these features for the client. It includes allowing the player to fly, build and mine, and attack entities. Most of these flags should be checked server-side instead of using this packet only. The client may also send this packet to the server when it updates one of these settings through the in-game settings interface. The server should verify if the player actually has permission to update those settings.

func (*AdventureSettings) ID

func (*AdventureSettings) ID() uint32

ID ...

func (*AdventureSettings) Marshal

func (pk *AdventureSettings) Marshal(io protocol.IO)

type AgentAction

type AgentAction struct {
	// Identifier is a JSON identifier referenced in the initial action.
	Identifier string
	// Action represents the action type that was requested. It is one of the constants defined above.
	Action int32
	// Response is a JSON string containing the response to the action.
	Response []byte
}

AgentAction is an Education Edition packet sent from the server to the client to return a response to a previously requested action.

func (*AgentAction) ID

func (*AgentAction) ID() uint32

ID ...

func (*AgentAction) Marshal

func (pk *AgentAction) Marshal(io protocol.IO)

type Animate

type Animate struct {
	// ActionType is the ID of the animation action to execute. It is one of the action type constants that
	// may be found above.
	ActionType int32
	// EntityRuntimeID is the runtime ID of the player that the animation should be played upon. The runtime
	// ID is unique for each world session, and entities are generally identified in packets using this
	// runtime ID.
	EntityRuntimeID uint64
	// BoatRowingTime ...
	BoatRowingTime float32
}

Animate is sent by the server to send a player animation from one player to all viewers of that player. It is used for a couple of actions, such as arm swimming and critical hits.

func (*Animate) ID

func (*Animate) ID() uint32

ID ...

func (*Animate) Marshal

func (pk *Animate) Marshal(io protocol.IO)

type AnimateEntity

type AnimateEntity struct {
	// Animation is the name of a single animation to start playing.
	Animation string
	// NextState is the first state to start with. These states are declared in animation controllers (which,
	// in themselves, are animations too). These states in turn may have animations and transitions to move to
	// a next state.
	NextState string
	// StopCondition is a MoLang expression that specifies when the animation should be stopped.
	StopCondition string
	// StopConditionVersion is the MoLang stop condition version.
	StopConditionVersion int32
	// Controller is the animation controller that is used to manage animations. These controllers decide when
	// to play which animation.
	Controller string
	// BlendOutTime does not currently seem to be used.
	BlendOutTime float32
	// EntityRuntimeIDs is list of runtime IDs of entities that the animation should be applied to.
	EntityRuntimeIDs []uint64
}

AnimateEntity is sent by the server to animate an entity client-side. It may be used to play a single animation, or to activate a controller which can start a sequence of animations based on different conditions specified in an animation controller. Much of the documentation of this packet can be found at https://minecraft.gamepedia.com/Bedrock_Edition_beta_animation_documentation.

func (*AnimateEntity) ID

func (*AnimateEntity) ID() uint32

ID ...

func (*AnimateEntity) Marshal

func (pk *AnimateEntity) Marshal(io protocol.IO)

type AnvilDamage

type AnvilDamage struct {
	// Damage is the damage that the client requests to be dealt to the anvil.
	Damage uint8
	// AnvilPosition is the position in the world that the anvil can be found at.
	AnvilPosition protocol.BlockPos
}

AnvilDamage is sent by the client to request the dealing damage to an anvil. This packet is completely pointless and the server should never listen to it.

func (*AnvilDamage) ID

func (*AnvilDamage) ID() uint32

ID ...

func (*AnvilDamage) Marshal

func (pk *AnvilDamage) Marshal(io protocol.IO)

type AutomationClientConnect

type AutomationClientConnect struct {
	// ServerURI is the URI to make the client connect to. It can be, for example, 'localhost:8000/ws' to
	// connect to a websocket server on the localhost at port 8000.
	ServerURI string
}

AutomationClientConnect is used to make the client connect to a websocket server. This websocket server has the ability to execute commands on the behalf of the client and it can listen for certain events fired by the client.

func (*AutomationClientConnect) ID

ID ...

func (*AutomationClientConnect) Marshal

func (pk *AutomationClientConnect) Marshal(io protocol.IO)

type AvailableActorIdentifiers

type AvailableActorIdentifiers struct {
	// SerialisedEntityIdentifiers is a network NBT serialised compound of all entity identifiers that are
	// available in the server.
	SerialisedEntityIdentifiers []byte
}

AvailableActorIdentifiers is sent by the server at the start of the game to let the client know all entities that are available on the server.

func (*AvailableActorIdentifiers) ID

ID ...

func (*AvailableActorIdentifiers) Marshal

func (pk *AvailableActorIdentifiers) Marshal(io protocol.IO)

type AvailableCommands

type AvailableCommands struct {
	// EnumValues is a slice of all enum values of any enum in the
	// AvailableCommands packet. EnumValues generally should contain each
	// possible value only once. Enums are built by pointing to entries in this
	// slice.
	EnumValues []string
	// Suffixes, like EnumValues, is a slice of all suffix values of any command
	// parameter in the AvailableCommands packet.
	Suffixes []string
	// Enums is a slice of all (fixed) command enums present in any of the
	// commands.
	Enums []protocol.CommandEnum
	// Commands is a list of all commands that the client should show
	// client-side. The AvailableCommands packet replaces any commands sent
	// before. It does not only add the commands that are sent in it.
	Commands []protocol.Command
	// DynamicEnums is a slice of dynamic command enums. These command enums can
	// be changed during runtime without having to resend an AvailableCommands
	// packet.
	DynamicEnums []protocol.DynamicEnum
	// Constraints is a list of constraints that should be applied to certain
	// options of enums in the commands above.
	Constraints []protocol.CommandEnumConstraint
}

AvailableCommands is sent by the server to send a list of all commands that the player is able to use on the server. This packet holds all the arguments of each commands as well, making it possible for the client to provide auto-completion and command usages. AvailableCommands packets can be resent, but the packet is often very big, so doing this very often should be avoided.

func (*AvailableCommands) ID

func (*AvailableCommands) ID() uint32

ID ...

func (*AvailableCommands) Marshal

func (pk *AvailableCommands) Marshal(io protocol.IO)

type BiomeDefinitionList

type BiomeDefinitionList struct {
	// SerialisedBiomeDefinitions is a network NBT serialised compound of all definitions of biomes that are
	// available on the server.
	SerialisedBiomeDefinitions []byte
}

BiomeDefinitionList is sent by the server to let the client know all biomes that are available and implemented on the server side. It is much like the AvailableActorIdentifiers packet, but instead functions for biomes.

func (*BiomeDefinitionList) ID

ID ...

func (*BiomeDefinitionList) Marshal

func (pk *BiomeDefinitionList) Marshal(io protocol.IO)

type BlockActorData

type BlockActorData struct {
	// Position is the position of the block that holds the block entity. If no block entity is at this
	// position, the packet is ignored by the client.
	Position protocol.BlockPos
	// NBTData is the new data of the block that will be encoded to NBT and applied client-side, so that the
	// client can see the block update. The NBTData should contain all properties of the block, not just
	// properties that were changed.
	NBTData map[string]any
}

BlockActorData is sent by the server to update data of a block entity client-side, for example the data of a chest.

func (*BlockActorData) ID

func (*BlockActorData) ID() uint32

ID ...

func (*BlockActorData) Marshal

func (pk *BlockActorData) Marshal(io protocol.IO)

type BlockEvent

type BlockEvent struct {
	// Position is the position of the block that an event occurred at.
	Position protocol.BlockPos
	// EventType is the type of the block event. The event type decides the way the event data that follows
	// is used. It is one of the constants found above.
	EventType int32
	// EventData holds event type specific data. For chests for example, opening the chest means the data must
	// hold 1, whereas closing it should hold 0.
	EventData int32
}

BlockEvent is sent by the server to initiate a certain event that has something to do with blocks in specific, for example opening a chest.

func (*BlockEvent) ID

func (*BlockEvent) ID() uint32

ID ...

func (*BlockEvent) Marshal

func (pk *BlockEvent) Marshal(io protocol.IO)

type BlockPickRequest

type BlockPickRequest struct {
	// Position is the position at which the client requested to pick the block. The block at that position
	// should have its item put in HotBarSlot if it is empty.
	Position protocol.BlockPos
	// AddBlockNBT specifies if the item should get all NBT tags from the block, meaning the item places a
	// block practically always equal to the one picked.
	AddBlockNBT bool
	// HotBarSlot is the slot that was held at the time of picking a block.
	HotBarSlot byte
}

BlockPickRequest is sent by the client when it requests to pick a block in the world and place its item in their inventory.

func (*BlockPickRequest) ID

func (*BlockPickRequest) ID() uint32

ID ...

func (*BlockPickRequest) Marshal

func (pk *BlockPickRequest) Marshal(io protocol.IO)

type BookEdit

type BookEdit struct {
	// ActionType is the type of the book edit action. The data obtained depends on what type this is. The
	// action type is one of the constants above.
	ActionType byte
	// InventorySlot is the slot in which the book that was edited may be found. Typically, the server should
	// check if this slot matches the held item slot of the player.
	InventorySlot byte
	// PageNumber is the number of the page that the book edit action concerns. It applies for all actions
	// but the BookActionSign. In BookActionSwapPages, it is one of the pages that was swapped.
	PageNumber byte
	// SecondaryPageNumber is the page number of the second page that the action concerned. It is only set for
	// the BookActionSwapPages action, in which case it is the other page that is swapped.
	SecondaryPageNumber byte
	// Text is the text that was written in a particular page of the book. It applies for the
	// BookActionAddPage and BookActionReplacePage only.
	Text string
	// PhotoName is the name of the photo on the page in the book. It applies for the BookActionAddPage and
	// BookActionReplacePage only.
	// Unfortunately, the functionality of this field was removed from the default Minecraft Bedrock Edition.
	// It is still available on Education Edition.
	PhotoName string
	// Title is the title that the player has given the book. It applies only for the BookActionSign action.
	Title string
	// Author is the author that the player has given the book. It applies only for the BookActionSign action.
	// Note that the author may be freely changed, so no assumptions can be made on if the author is actually
	// the name of a player.
	Author string
	// XUID is the XBOX Live User ID of the player that edited the book. The field is rather pointless, as the
	// server is already aware of the XUID of the player anyway.
	XUID string
}

BookEdit is sent by the client when it edits a book. It is sent each time a modification was made and the player stops its typing 'session', rather than simply after closing the book.

func (*BookEdit) ID

func (*BookEdit) ID() uint32

ID ...

func (*BookEdit) Marshal

func (pk *BookEdit) Marshal(io protocol.IO)

type BossEvent

type BossEvent struct {
	// BossEntityUniqueID is the unique ID of the boss entity that the boss
	// event sent involves. By default, the health percentage and title of the
	// boss bar depend on the health and name tag of this entity. If
	// BossEntityUniqueID is the same as the client's entity unique ID, its
	// HealthPercentage and BossBarTitle can be freely altered.
	BossEntityUniqueID int64
	// EventType is the type of the event. The fields written depend on the
	// event type set, and some event types are sent by the client, whereas
	// others are sent by the server. The event type is one of the constants
	// above.
	EventType uint32
	// PlayerUniqueID is the unique ID of the player that is registered to or
	// unregistered from the boss fight. It is set if EventType is either
	// BossEventRegisterPlayer or BossEventUnregisterPlayer.
	PlayerUniqueID int64
	// BossBarTitle is the title shown above the boss bar. It may be set to set
	// a different title if the BossEntityUniqueID matches the client's entity
	// unique ID.
	BossBarTitle string
	// HealthPercentage is the percentage of health that is shown in the boss
	// bar (0.0-1.0). The HealthPercentage may be set to a specific value if the
	// BossEntityUniqueID matches the client's entity unique ID.
	HealthPercentage float32
	// ScreenDarkening currently seems not to do anything.
	ScreenDarkening int16
	// Colour is the colour of the boss bar that is shown when a player is
	// subscribed. It is only set if the EventType is BossEventShow,
	// BossEventAppearanceProperties or BossEventTexture. This is functional as
	// of 1.18 and can be any of the BossEventColour constants listed above.
	Colour uint32
	// Overlay is the overlay of the boss bar that is shown on top of the boss
	// bar when a player is subscribed. It currently does not function. It is
	// only set if the EventType is BossEventShow, BossEventAppearanceProperties
	// or BossEventTexture.
	Overlay uint32
}

BossEvent is sent by the server to make a specific 'boss event' occur in the world. It includes features such as showing a boss bar to the player and turning the sky dark.

func (*BossEvent) ID

func (*BossEvent) ID() uint32

ID ...

func (*BossEvent) Marshal

func (pk *BossEvent) Marshal(io protocol.IO)

type Camera

type Camera struct {
	// CameraEntityUniqueID is the unique ID of the camera entity from which the picture was taken.
	CameraEntityUniqueID int64
	// TargetPlayerUniqueID is the unique ID of the target player. The unique ID is a value that remains
	// consistent across different sessions of the same world, but most servers simply fill the runtime ID of
	// the player out for this field.
	TargetPlayerUniqueID int64
}

Camera is sent by the server to use an Education Edition camera on a player. It produces an image client-side.

func (*Camera) ID

func (*Camera) ID() uint32

ID ...

func (*Camera) Marshal

func (pk *Camera) Marshal(io protocol.IO)

type CameraInstruction

type CameraInstruction struct {
	// Data is a compound tag of the instructions to sent. The structure of this tag is currently unknown.
	Data map[string]any
}

CameraInstruction gives a custom camera specific instructions to operate.

func (*CameraInstruction) ID

func (*CameraInstruction) ID() uint32

ID ...

func (*CameraInstruction) Marshal

func (pk *CameraInstruction) Marshal(io protocol.IO)

type CameraPresets

type CameraPresets struct {
	// Data is a compound tag of the presets being set. The structure of this tag is currently unknown.
	Data map[string]any
}

CameraPresets gives the client a list of custom camera presets.

func (*CameraPresets) ID

func (*CameraPresets) ID() uint32

ID ...

func (*CameraPresets) Marshal

func (pk *CameraPresets) Marshal(io protocol.IO)

type CameraShake

type CameraShake struct {
	// Intensity is the intensity of the shaking. The client limits this value to 4, so anything higher may
	// not work.
	Intensity float32
	// Duration is the number of seconds the camera will shake for.
	Duration float32
	// Type is the type of shake, and is one of the constants listed above. The different type affects how
	// the shake looks in game.
	Type uint8
	// Action is the action to be performed, and is one of the constants listed above. Currently the
	// different actions will either add or stop shaking the client.
	Action uint8
}

CameraShake is sent by the server to make the camera shake client-side. This feature was added for map- making partners.

func (*CameraShake) ID

func (*CameraShake) ID() uint32

ID ...

func (*CameraShake) Marshal

func (pk *CameraShake) Marshal(io protocol.IO)

type ChangeDimension

type ChangeDimension struct {
	// Dimension is the dimension that the client should be changed to. The fog colour will change depending
	// on the type of dimension, which is one of the constants above.
	// Note that Dimension MUST be a different dimension than the one that the player is currently in. Sending
	// a ChangeDimension packet with a Dimension that the player is currently in will result in a never-ending
	// dimension change screen.
	Dimension int32
	// Position is the position in the new dimension that the player is spawned in.
	Position mgl32.Vec3
	// Respawn specifies if the dimension change was respawn based, meaning that the player died in one
	// dimension and got respawned into another. The client will send a PlayerAction packet with
	// PlayerActionDimensionChangeRequest if it dies in another dimension, indicating that it needs a
	// DimensionChange packet with Respawn set to true.
	Respawn bool
}

ChangeDimension is sent by the server to the client to send a dimension change screen client-side. Once the screen is cleared client-side, the client will send a PlayerAction packet with PlayerActionDimensionChangeDone.

func (*ChangeDimension) ID

func (*ChangeDimension) ID() uint32

ID ...

func (*ChangeDimension) Marshal

func (pk *ChangeDimension) Marshal(io protocol.IO)

type ChangeMobProperty

type ChangeMobProperty struct {
	// EntityUniqueID is the unique ID of the entity whose property is being changed.
	EntityUniqueID uint64
	// Property is the name of the property being updated.
	Property string
	// BoolValue is set if the property value is a bool type. If the type is not a bool, this field is ignored.
	BoolValue bool
	// StringValue is set if the property value is a string type. If the type is not a string, this field is ignored.
	StringValue string
	// IntValue is set if the property value is an int type. If the type is not an int, this field is ignored.
	IntValue int32
	// FloatValue is set if the property value is a float type. If the type is not a float, this field is ignored.
	FloatValue float32
}

ChangeMobProperty is a packet sent from the server to the client to change one of the properties of a mob client-side.

func (*ChangeMobProperty) ID

func (*ChangeMobProperty) ID() uint32

ID ...

func (*ChangeMobProperty) Marshal

func (pk *ChangeMobProperty) Marshal(io protocol.IO)

type ChunkRadiusUpdated

type ChunkRadiusUpdated struct {
	// ChunkRadius is the final chunk radius that the client will adapt when it receives the packet. It does
	// not have to be the same as the requested chunk radius.
	ChunkRadius int32
}

ChunkRadiusUpdated is sent by the server in response to a RequestChunkRadius packet. It defines the chunk radius that the server allows the client to have. This may be lower than the chunk radius requested by the client in the RequestChunkRadius packet.

func (*ChunkRadiusUpdated) ID

func (*ChunkRadiusUpdated) ID() uint32

ID ...

func (*ChunkRadiusUpdated) Marshal

func (pk *ChunkRadiusUpdated) Marshal(io protocol.IO)

type ClientBoundDebugRenderer

type ClientBoundDebugRenderer struct {
	// Type is the type of action. It is one of the constants above.
	Type int32
	// Text is the text that is displayed above the debug.
	Text string
	// Position is the position to spawn the debug on.
	Position mgl32.Vec3
	// Red is the red value from the RGBA colour rendered on the debug. This value is in the range 0-1.
	Red float32
	// Green is the green value from the RGBA colour rendered on the debug. This value is in the range 0-1.
	Green float32
	// Blue is the blue value from the RGBA colour rendered on the debug. This value is in the range 0-1.
	Blue float32
	// Alpha is the alpha value from the RGBA colour rendered on the debug. This value is in the range 0-1.
	Alpha float32
	// Duration is how long the debug will last in the world for. It is measured in milliseconds.
	Duration int64
}

ClientBoundDebugRenderer is sent by the server to spawn an outlined cube on client-side.

func (*ClientBoundDebugRenderer) ID

ID ...

func (*ClientBoundDebugRenderer) Marshal

func (pk *ClientBoundDebugRenderer) Marshal(io protocol.IO)

type ClientBoundMapItemData

type ClientBoundMapItemData struct {
	// MapID is the unique identifier that represents the map that is updated over network. It remains
	// consistent across sessions.
	MapID int64
	// UpdateFlags is a combination of flags found above that indicate what parts of the map should be updated
	// client-side.
	UpdateFlags uint32
	// Dimension is the dimension of the map that should be updated, for example the overworld (0), the nether
	// (1) or the end (2).
	Dimension byte
	// LockedMap specifies if the map that was updated was a locked map, which may be done using a cartography
	// table.
	LockedMap bool
	// Origin is the center position of the map being updated.
	Origin protocol.BlockPos
	// Scale is the scale of the map as it is shown in-game. It is written when any of the MapUpdateFlags are
	// set to the UpdateFlags field.
	Scale byte

	// MapsIncludedIn holds an array of map IDs that the map updated is included in. This has to do with the
	// scale of the map: Each map holds its own map ID and all map IDs of maps that include this map and have
	// a bigger scale. This means that a scale 0 map will have 5 map IDs in this slice, whereas a scale 4 map
	// will have only 1 (its own).
	// The actual use of this field remains unknown.
	MapsIncludedIn []int64

	// TrackedObjects is a list of tracked objects on the map, which may either be entities or blocks. The
	// client makes sure these tracked objects are actually tracked. (position updated etc.)
	TrackedObjects []protocol.MapTrackedObject
	// Decorations is a list of fixed decorations located on the map. The decorations will not change
	// client-side, unless the server updates them.
	Decorations []protocol.MapDecoration

	// Height is the height of the texture area that was updated. The height may be a subset of the total
	// height of the map.
	Height int32
	// Width is the width of the texture area that was updated. The width may be a subset of the total width
	// of the map.
	Width int32
	// XOffset is the X offset in pixels at which the updated texture area starts. From this X, the updated
	// texture will extend exactly Width pixels to the right.
	XOffset int32
	// YOffset is the Y offset in pixels at which the updated texture area starts. From this Y, the updated
	// texture will extend exactly Height pixels up.
	YOffset int32
	// Pixels is a list of pixel colours for the new texture of the map. It is indexed as Pixels[y*height + x].
	Pixels []color.RGBA
}

ClientBoundMapItemData is sent by the server to the client to update the data of a map shown to the client. It is sent with a combination of flags that specify what data is updated. The ClientBoundMapItemData packet may be used to update specific parts of the map only. It is not required to send the entire map each time when updating one part.

func (*ClientBoundMapItemData) ID

ID ...

func (*ClientBoundMapItemData) Marshal

func (pk *ClientBoundMapItemData) Marshal(io protocol.IO)

type ClientCacheBlobStatus

type ClientCacheBlobStatus struct {
	// MissHashes is a list of blob hashes that the client does not have a blob available for. The server
	// should send the blobs matching these hashes as soon as possible.
	MissHashes []uint64
	// HitHashes is a list of blob hashes that the client has a blob available for. The blobs hashes here mean
	// that the client already has them: The server does not need to send the blobs anymore.
	HitHashes []uint64
}

ClientCacheBlobStatus is part of the blob cache protocol. It is sent by the client to let the server know what blobs it needs and which blobs it already has, in an ACK type system.

func (*ClientCacheBlobStatus) ID

func (pk *ClientCacheBlobStatus) ID() uint32

ID ...

func (*ClientCacheBlobStatus) Marshal

func (pk *ClientCacheBlobStatus) Marshal(io protocol.IO)

type ClientCacheMissResponse

type ClientCacheMissResponse struct {
	// Blobs is a list of all blobs that the client sent misses for in the ClientCacheBlobStatus. These blobs
	// hold the data of the blobs with the hashes they are matched with.
	Blobs []protocol.CacheBlob
}

ClientCacheMissResponse is part of the blob cache protocol. It is sent by the server in response to a ClientCacheBlobStatus packet and contains the blob data of all blobs that the client acknowledged not to have yet.

func (*ClientCacheMissResponse) ID

ID ...

func (*ClientCacheMissResponse) Marshal

func (pk *ClientCacheMissResponse) Marshal(io protocol.IO)

type ClientCacheStatus

type ClientCacheStatus struct {
	// Enabled specifies if the blob cache is enabled. If false, the server should not attempt to use the
	// blob cache. If true, it may do so, but it may also choose not to use it.
	Enabled bool
}

ClientCacheStatus is sent by the client to the server at the start of the game. It is sent to let the server know if it supports the client-side blob cache. Clients such as Nintendo Switch do not support the cache, and attempting to use it anyway will fail.

func (*ClientCacheStatus) ID

func (pk *ClientCacheStatus) ID() uint32

ID ...

func (*ClientCacheStatus) Marshal

func (pk *ClientCacheStatus) Marshal(io protocol.IO)

type ClientCheatAbility

type ClientCheatAbility struct {
	// AbilityData represents various data about the abilities of a player, such as ability layers or permissions.
	AbilityData protocol.AbilityData
}

ClientCheatAbility functions the same as UpdateAbilities. It is unclear why these two are separated.

func (*ClientCheatAbility) ID

func (*ClientCheatAbility) ID() uint32

ID ...

func (*ClientCheatAbility) Marshal

func (pk *ClientCheatAbility) Marshal(io protocol.IO)

type ClientStartItemCooldown

type ClientStartItemCooldown struct {
	// Category is the category of the item to start the cooldown on.
	Category string
	// Duration is the duration of ticks the cooldown should last.
	Duration int32
}

ClientStartItemCooldown is sent by the server to the client to initiate a cooldown on an item.

func (*ClientStartItemCooldown) ID

ID ...

func (*ClientStartItemCooldown) Marshal

func (pk *ClientStartItemCooldown) Marshal(io protocol.IO)

type ClientToServerHandshake

type ClientToServerHandshake struct {
}

ClientToServerHandshake is sent by the client in response to a ServerToClientHandshake packet sent by the server. It is the first encrypted packet in the login handshake and serves as a confirmation that encryption is correctly initialised client side.

func (*ClientToServerHandshake) ID

ID ...

func (*ClientToServerHandshake) Marshal

type CodeBuilder

type CodeBuilder struct {
	// URL is the url to the Code Builder (websocket) server.
	URL string
	// ShouldOpenCodeBuilder specifies if the client should automatically open the Code Builder app. If set to
	// true, the client will attempt to use the Code Builder app to connect to and interface with the server
	// running at the URL above.
	ShouldOpenCodeBuilder bool
}

CodeBuilder is an Education Edition packet sent by the server to the client to open the URL to a Code Builder (websocket) server.

func (*CodeBuilder) ID

func (*CodeBuilder) ID() uint32

ID ...

func (*CodeBuilder) Marshal

func (pk *CodeBuilder) Marshal(io protocol.IO)

type CodeBuilderSource

type CodeBuilderSource struct {
	// Operation is used to distinguish the operation performed. It is always one of the constants listed above.
	Operation byte
	// Category is used to distinguish the category of the operation performed. It is always one of the constants
	// listed above.
	Category byte
	// Value contains extra data about the operation performed. It is always empty unless the operation is
	// CodeBuilderOperationSet.
	Value []byte
}

CodeBuilderSource is an Education Edition packet sent by the client to the server to run an operation with a code builder.

func (*CodeBuilderSource) ID

func (pk *CodeBuilderSource) ID() uint32

ID ...

func (*CodeBuilderSource) Marshal

func (pk *CodeBuilderSource) Marshal(io protocol.IO)

type CommandBlockUpdate

type CommandBlockUpdate struct {
	// Block specifies if the command block updated was an actual physical block. If false, the command block
	// is in a minecart and has an entity runtime ID instead.
	Block bool

	// Position is the position of the command block updated. It is only set if Block is set to true. Nothing
	// happens if no command block is set at this position.
	Position protocol.BlockPos
	// Mode is the mode of the command block. It is either CommandBlockImpulse, CommandBlockChain or
	// CommandBlockRepeat. It is only set if Block is set to true.
	Mode uint32
	// NeedsRedstone specifies if the command block needs to be powered by redstone to be activated. If false,
	// the command block is always active. The field is only set if Block is set to true.
	NeedsRedstone bool
	// Conditional specifies the behaviour of the command block if the command block before it (the opposite
	// side of the direction the arrow if facing) fails to execute. If set to false, it will activate at all
	// times, whereas if set to true, it will activate only if the previous command block executed
	// successfully. The field is only set if Block is set to true.
	Conditional bool

	// MinecartEntityRuntimeID is the runtime ID of the minecart entity carrying the command block that is
	// updated. It is set only if Block is set to false.
	MinecartEntityRuntimeID uint64

	// Command is the command currently entered in the command block. This is the command that is executed
	// when the command block is activated.
	Command string
	// LastOutput is the output of the last command executed by the command block. It may be left empty to
	// show simply no output at all, in combination with setting ShouldTrackOutput to false.
	LastOutput string
	// Name is the name of the command block updated. If not empty, it will show this name hovering above the
	// command block when hovering over the block with the cursor.
	Name string
	// ShouldTrackOutput specifies if the command block tracks output. If set to false, the output box won't
	// be shown within the command block.
	ShouldTrackOutput bool
	// TickDelay is the delay in ticks between executions of a command block, if it is a repeating command
	// block.
	TickDelay int32
	// ExecuteOnFirstTick specifies if the command block should execute on the first tick, AKA as soon as the
	// command block is enabled.
	ExecuteOnFirstTick bool
}

CommandBlockUpdate is sent by the client to update a command block at a specific position. The command block may be either a physical block or an entity.

func (*CommandBlockUpdate) ID

func (*CommandBlockUpdate) ID() uint32

ID ...

func (*CommandBlockUpdate) Marshal

func (pk *CommandBlockUpdate) Marshal(io protocol.IO)

type CommandOutput

type CommandOutput struct {
	// CommandOrigin is the data specifying the origin of the command. In other words, the source that the
	// command request was from, such as the player itself or a websocket server. The client forwards the
	// messages in this packet to the right origin, depending on what is sent here.
	CommandOrigin protocol.CommandOrigin
	// OutputType specifies the type of output that is sent. The OutputType sent by vanilla games appears to
	// be 3, which seems to work.
	OutputType byte
	// SuccessCount is the amount of times that a command was executed successfully as a result of the command
	// that was requested. For servers, this is usually a rather meaningless fields, but for vanilla, this is
	// applicable for commands created with Functions.
	SuccessCount uint32
	// OutputMessages is a list of all output messages that should be sent to the player. Whether they are
	// shown or not, depends on the type of the messages.
	OutputMessages []protocol.CommandOutputMessage
	// DataSet ... TODO: Find out what this is for.
	DataSet string
}

CommandOutput is sent by the server to the client to send text as output of a command. Most servers do not use this packet and instead simply send Text packets, but there is reason to send it. If the origin of a CommandRequest packet is not the player itself, but, for example, a websocket server, sending a Text packet will not do what is expected: The message should go to the websocket server, not to the client's chat. The CommandOutput packet will make sure the messages are relayed to the correct origin of the command request.

func (*CommandOutput) ID

func (*CommandOutput) ID() uint32

ID ...

func (*CommandOutput) Marshal

func (pk *CommandOutput) Marshal(io protocol.IO)

type CommandRequest

type CommandRequest struct {
	// CommandLine is the raw entered command line. The client does no parsing of the command line by itself
	// (unlike it did in the early stages), but lets the server do that.
	CommandLine string
	// CommandOrigin is the data specifying the origin of the command. In other words, the source that the
	// command was from, such as the player itself or a websocket server.
	CommandOrigin protocol.CommandOrigin
	// Internal specifies if the command request internal. Setting it to false seems to work and the usage of
	// this field is not known.
	Internal bool
	// Version is the version of the command that is being executed. This field currently has no purpose or functionality.
	Version int32
}

CommandRequest is sent by the client to request the execution of a server-side command. Although some servers support sending commands using the Text packet, this packet is guaranteed to have the correct result.

func (*CommandRequest) ID

func (*CommandRequest) ID() uint32

ID ...

func (*CommandRequest) Marshal

func (pk *CommandRequest) Marshal(io protocol.IO)

type CompletedUsingItem

type CompletedUsingItem struct {
	// UsedItemID is the item ID of the item that the client completed using. This should typically be the
	// ID of the item held in the hand.
	UsedItemID int16
	// UseMethod is the method of the using of the item that was completed. It is one of the constants that
	// may be found above.
	UseMethod int32
}

CompletedUsingItem is sent by the server to tell the client that it should be done using the item it is currently using.

func (*CompletedUsingItem) ID

func (*CompletedUsingItem) ID() uint32

ID ...

func (*CompletedUsingItem) Marshal

func (pk *CompletedUsingItem) Marshal(io protocol.IO)

type CompressedBiomeDefinitionList

type CompressedBiomeDefinitionList struct {
	// Biomes is a map of biomes with their identifier as key, and the biome data as value. The biome data contains many
	// different fields such as climate, surface materials and generation rules etc.
	Biomes map[string]any
}

CompressedBiomeDefinitionList is sent by the server to send a list of biomes to the client. The contents of this packet are very large, even after being compressed. This packet is only required when using client-side chunk generation.

func (*CompressedBiomeDefinitionList) ID

ID ...

func (*CompressedBiomeDefinitionList) Marshal

func (pk *CompressedBiomeDefinitionList) Marshal(io protocol.IO)

type Compression

type Compression interface {
	// EncodeCompression encodes the compression algorithm into a uint16 ID.
	EncodeCompression() uint16
	// Compress compresses the given data and returns the compressed data.
	Compress(decompressed []byte) ([]byte, error)
	// Decompress decompresses the given data and returns the decompressed data.
	Decompress(compressed []byte) ([]byte, error)
}

Compression represents a compression algorithm that can compress and decompress data.

func CompressionByID

func CompressionByID(id uint16) (Compression, bool)

CompressionByID attempts to return a compression by the ID it was registered with. If found, the compression found is returned and the bool is true.

type ContainerClose

type ContainerClose struct {
	// WindowID is the ID representing the window of the container that should be closed. It must be equal to
	// the one sent in the ContainerOpen packet to close the designated window.
	WindowID byte
	// ServerSide determines whether or not the container was force-closed by the server. If this value is
	// not set correctly, the client may ignore the packet and respond with a PacketViolationWarning.
	ServerSide bool
}

ContainerClose is sent by the server to close a container the player currently has opened, which was opened using the ContainerOpen packet, or by the client to tell the server it closed a particular container, such as the crafting grid.

func (*ContainerClose) ID

func (*ContainerClose) ID() uint32

ID ...

func (*ContainerClose) Marshal

func (pk *ContainerClose) Marshal(io protocol.IO)

type ContainerOpen

type ContainerOpen struct {
	// WindowID is the ID representing the window that is being opened. It may be used later to close the
	// container using a ContainerClose packet.
	WindowID byte
	// ContainerType is the type ID of the container that is being opened when opening the container at the
	// position of the packet. It depends on the block/entity, and could, for example, be the window type of
	// a chest or a hopper, but also a horse inventory.
	ContainerType byte
	// ContainerPosition is the position of the container opened. The position must point to a block entity
	// that actually has a container. If that is not the case, the window will not be opened and the packet
	// will be ignored, if a valid ContainerEntityUniqueID has not also been provided.
	ContainerPosition protocol.BlockPos
	// ContainerEntityUniqueID is the unique ID of the entity container that was opened. It is only used if
	// the ContainerType is one that points to an entity, for example a horse.
	ContainerEntityUniqueID int64
}

ContainerOpen is sent by the server to open a container client-side. This container must be physically present in the world, for the packet to have any effect. Unlike Java Edition, Bedrock Edition requires that chests for example must be present and in range to open its inventory.

func (*ContainerOpen) ID

func (*ContainerOpen) ID() uint32

ID ...

func (*ContainerOpen) Marshal

func (pk *ContainerOpen) Marshal(io protocol.IO)

type ContainerSetData

type ContainerSetData struct {
	// WindowID is the ID of the window that should have its data set. The player must have a window open with
	// the window ID passed, or nothing will happen.
	WindowID byte
	// Key is the key of the property. It is one of the constants that can be found above. Multiple properties
	// share the same key, but the functionality depends on the type of the container that the data is set to.
	Key int32
	// Value is the value of the property. Its use differs per property.
	Value int32
}

ContainerSetData is sent by the server to update specific data of a single container, meaning a block such as a furnace or a brewing stand. This data is usually used by the client to display certain features client-side.

func (*ContainerSetData) ID

func (*ContainerSetData) ID() uint32

ID ...

func (*ContainerSetData) Marshal

func (pk *ContainerSetData) Marshal(io protocol.IO)

type CorrectPlayerMovePrediction

type CorrectPlayerMovePrediction struct {
	// Position is the position that the player is supposed to be at the tick written in the field below.
	// The client will change its current position based on movement after that tick starting from the
	// Position.
	Position mgl32.Vec3
	// Delta is the change in position compared to what the client sent as its position at that specific tick.
	Delta mgl32.Vec3
	// OnGround specifies if the player was on the ground at the time of the tick below.
	OnGround bool
	// Tick is the tick of the movement which was corrected by this packet.
	Tick uint64
}

CorrectPlayerMovePrediction is sent by the server if and only if StartGame.ServerAuthoritativeMovementMode is set to AuthoritativeMovementModeServerWithRewind. The packet is used to correct movement at a specific point in time.

func (*CorrectPlayerMovePrediction) ID

ID ...

func (*CorrectPlayerMovePrediction) Marshal

func (pk *CorrectPlayerMovePrediction) Marshal(io protocol.IO)

type CraftingData

type CraftingData struct {
	// Recipes is a list of all recipes available on the server. It includes among others shapeless, shaped
	// and furnace recipes. The client will only be able to craft these recipes.
	Recipes []protocol.Recipe
	// PotionRecipes is a list of all potion mixing recipes which may be used in the brewing stand.
	PotionRecipes []protocol.PotionRecipe
	// PotionContainerChangeRecipes is a list of all recipes to convert a potion from one type to another,
	// such as from a drinkable potion to a splash potion, or from a splash potion to a lingering potion.
	PotionContainerChangeRecipes []protocol.PotionContainerChangeRecipe
	// MaterialReducers is a list of all material reducers which is used in education edition chemistry.
	MaterialReducers []protocol.MaterialReducer
	// ClearRecipes indicates if all recipes currently active on the client should be cleaned. Doing this
	// means that the client will have no recipes active by itself: Any CraftingData packets previously sent
	// will also be discarded, and only the recipes in this CraftingData packet will be used.
	ClearRecipes bool
}

CraftingData is sent by the server to let the client know all crafting data that the server maintains. This includes shapeless crafting, crafting table recipes, furnace recipes etc. Each crafting station's recipes are included in it.

func (*CraftingData) ID

func (*CraftingData) ID() uint32

ID ...

func (*CraftingData) Marshal

func (pk *CraftingData) Marshal(io protocol.IO)

type CraftingEvent

type CraftingEvent struct {
	// WindowID is the ID representing the window that the player crafted in.
	WindowID byte
	// CraftingType is a type that indicates the way the crafting was done, for example if a crafting table
	// was used.
	// TODO: Find out the options of the CraftingType field in the CraftingEvent packet.
	CraftingType int32
	// RecipeUUID is the UUID of the recipe that was crafted. It points to the UUID of the recipe that was
	// sent earlier in the CraftingData packet.
	RecipeUUID uuid.UUID
	// Input is a list of items that the player put into the recipe so that it could create the Output items.
	// These items are consumed in the process.
	Input []protocol.ItemInstance
	// Output is a list of items that were obtained as a result of crafting the recipe.
	Output []protocol.ItemInstance
}

CraftingEvent is sent by the client when it crafts a particular item. Note that this packet may be fully ignored, as the InventoryTransaction packet provides all the information required.

func (*CraftingEvent) ID

func (*CraftingEvent) ID() uint32

ID ...

func (*CraftingEvent) Marshal

func (pk *CraftingEvent) Marshal(io protocol.IO)

type CreatePhoto

type CreatePhoto struct {
	// EntityUniqueID is the unique ID of the entity.
	EntityUniqueID int64
	// PhotoName is the name of the photo.
	PhotoName string
	// ItemName is the name of the photo as an item.
	ItemName string
}

CreatePhoto is a packet that allows players to export photos from their portfolios into items in their inventory. This packet only works on the Education Edition version of Minecraft.

func (*CreatePhoto) ID

func (*CreatePhoto) ID() uint32

ID ...

func (*CreatePhoto) Marshal

func (pk *CreatePhoto) Marshal(io protocol.IO)

type CreativeContent

type CreativeContent struct {
	// Items is a list of the items that should be added to the creative inventory.
	Items []protocol.CreativeItem
}

CreativeContent is a packet sent by the server to set the creative inventory's content for a player. Introduced in 1.16, this packet replaces the previous method - sending an InventoryContent packet with creative inventory window ID. As of v1.16.100, this packet must be sent during the login sequence. Not sending it will stop the client from joining the server.

func (*CreativeContent) ID

func (*CreativeContent) ID() uint32

ID ...

func (*CreativeContent) Marshal

func (pk *CreativeContent) Marshal(io protocol.IO)

type DeathInfo

type DeathInfo struct {
	// Cause is the cause of the player's death, such as "suffocation" or "suicide".
	Cause string
	// Messages is a list of death messages to be shown on the death screen.
	Messages []string
}

DeathInfo is a packet sent from the server to the client expected to be sent when a player dies. It contains messages related to the player's death, which are shown on the death screen as of v1.19.10.

func (*DeathInfo) ID

func (*DeathInfo) ID() uint32

ID ...

func (*DeathInfo) Marshal

func (pk *DeathInfo) Marshal(io protocol.IO)

type DebugInfo

type DebugInfo struct {
	// PlayerUniqueID is the unique ID of the player that the packet is sent to.
	PlayerUniqueID int64
	// Data is the debug data.
	Data []byte
}

DebugInfo is a packet sent by the server to the client. It does not seem to do anything when sent to the normal client in 1.16.

func (*DebugInfo) ID

func (*DebugInfo) ID() uint32

ID ...

func (*DebugInfo) Marshal

func (pk *DebugInfo) Marshal(io protocol.IO)

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder handles the decoding of Minecraft packets sent through an io.Reader. These packets in turn contain multiple compressed packets.

func NewDecoder

func NewDecoder(reader io.Reader) *Decoder

NewDecoder returns a new decoder decoding data from the io.Reader passed. One read call from the reader is assumed to consume an entire packet.

func (*Decoder) Decode

func (decoder *Decoder) Decode() (packets [][]byte, err error)

Decode decodes one 'packet' from the io.Reader passed in NewDecoder(), producing a slice of packets that it held and an error if not successful.

func (*Decoder) DisableBatchPacketLimit

func (decoder *Decoder) DisableBatchPacketLimit()

DisableBatchPacketLimit disables the check that limits the number of packets allowed in a single packet batch. This should typically be called for Decoders decoding from a server connection.

func (*Decoder) EnableCompression

func (decoder *Decoder) EnableCompression(compression Compression)

EnableCompression enables compression for the Decoder.

func (*Decoder) EnableEncryption

func (decoder *Decoder) EnableEncryption(keyBytes [32]byte)

EnableEncryption enables encryption for the Decoder using the secret key bytes passed. Each packet received will be decrypted.

type DimensionData

type DimensionData struct {
	// Definitions contain a list of data-driven dimension definitions registered on the server.
	Definitions []protocol.DimensionDefinition
}

DimensionData is a packet sent from the server to the client containing information about data-driven dimensions that the server may have registered. This packet does not seem to be sent by default, rather only being sent when any data-driven dimensions are registered.

func (*DimensionData) ID

func (*DimensionData) ID() uint32

ID ...

func (*DimensionData) Marshal

func (pk *DimensionData) Marshal(io protocol.IO)

type Disconnect

type Disconnect struct {
	// HideDisconnectionScreen specifies if the disconnection screen should be hidden when the client is
	// disconnected, meaning it will be sent directly to the main menu.
	HideDisconnectionScreen bool
	// Message is an optional message to show when disconnected. This message is only written if the
	// HideDisconnectionScreen field is set to true.
	Message string
}

Disconnect may be sent by the server to disconnect the client using an optional message to send as the disconnect screen.

func (*Disconnect) ID

func (*Disconnect) ID() uint32

ID ...

func (*Disconnect) Marshal

func (pk *Disconnect) Marshal(io protocol.IO)

type EditorNetwork

type EditorNetwork struct {
	// Payload is a network little endian compound tag holding data relevant to the editor.
	Payload map[string]any
}

EditorNetwork is a packet sent from the server to the client and vise-versa to communicate editor-mode related information. It carries a single compound tag containing the relevant information.

func (*EditorNetwork) ID

func (*EditorNetwork) ID() uint32

ID ...

func (*EditorNetwork) Marshal

func (pk *EditorNetwork) Marshal(io protocol.IO)

type EducationResourceURI

type EducationResourceURI struct {
	// Resource is the resource that is being referenced.
	Resource protocol.EducationSharedResourceURI
}

EducationResourceURI is a packet that transmits education resource settings to all clients.

func (*EducationResourceURI) ID

ID ...

func (*EducationResourceURI) Marshal

func (pk *EducationResourceURI) Marshal(io protocol.IO)

type EducationSettings

type EducationSettings struct {
	// CodeBuilderDefaultURI is the default URI that the code builder is ran on. Using this, a Code Builder program can
	// make code directly affect the server.
	CodeBuilderDefaultURI string
	// CodeBuilderTitle is the title of the code builder shown when connected to the CodeBuilderDefaultURI.
	CodeBuilderTitle string
	// CanResizeCodeBuilder specifies if clients connected to the world should be able to resize the code
	// builder when it is opened.
	CanResizeCodeBuilder bool
	// DisableLegacyTitleBar ...
	DisableLegacyTitleBar bool
	// PostProcessFilter ...
	PostProcessFilter string
	// ScreenshotBorderPath ...
	ScreenshotBorderPath string
	// CanModifyBlocks ...
	CanModifyBlocks protocol.Optional[bool]
	// OverrideURI ...
	OverrideURI protocol.Optional[string]
	// HasQuiz specifies if the world has a quiz connected to it.
	HasQuiz bool
	// ExternalLinkSettings ...
	ExternalLinkSettings protocol.Optional[protocol.EducationExternalLinkSettings]
}

EducationSettings is a packet sent by the server to update Minecraft: Education Edition related settings. It is unused by the normal base game.

func (*EducationSettings) ID

func (*EducationSettings) ID() uint32

ID ...

func (*EducationSettings) Marshal

func (pk *EducationSettings) Marshal(io protocol.IO)

type Emote

type Emote struct {
	// EntityRuntimeID is the entity that sent the emote. When a player sends this packet, it has this field
	// set as its own entity runtime ID.
	EntityRuntimeID uint64
	// EmoteID is the ID of the emote to send.
	EmoteID string
	// XUID is the Xbox User ID of the player that sent the emote. It is only set when the emote is used by a player that
	// is authenticated with Xbox Live.
	XUID string
	// PlatformID is an identifier only set for particular platforms when using an emote (presumably only for Nintendo
	// Switch). It is otherwise an empty string, and is used to decide which players are able to emote with each other.
	PlatformID string
	// Flags is a combination of flags that change the way the Emote packet operates. When the server sends
	// this packet to other players, EmoteFlagServerSide must be present.
	Flags byte
}

Emote is sent by both the server and the client. When the client sends an emote, it sends this packet to the server, after which the server will broadcast the packet to other players online.

func (*Emote) ID

func (*Emote) ID() uint32

ID ...

func (*Emote) Marshal

func (pk *Emote) Marshal(io protocol.IO)

type EmoteList

type EmoteList struct {
	// PlayerRuntimeID is the runtime ID of the player that owns the emote pieces below. If sent by the
	// client, this player runtime ID is always that of the player itself.
	PlayerRuntimeID uint64
	// EmotePieces is a list of emote pieces that the player with the runtime ID above has.
	EmotePieces []uuid.UUID
}

EmoteList is sent by the client every time it joins the server and when it equips new emotes. It may be used by the server to find out which emotes the client has available. If the player has no emotes equipped, this packet is not sent. Under certain circumstances, this packet is also sent from the server to the client, but I was unable to find when this is done.

func (*EmoteList) ID

func (*EmoteList) ID() uint32

ID ...

func (*EmoteList) Marshal

func (pk *EmoteList) Marshal(io protocol.IO)

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder handles the encoding of Minecraft packets that are sent to an io.Writer. The packets are compressed and optionally encoded before they are sent to the io.Writer.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder returns a new Encoder for the io.Writer passed. Each final packet produced by the Encoder is sent with a single call to io.Writer.Write().

func (*Encoder) EnableCompression

func (encoder *Encoder) EnableCompression(compression Compression)

EnableCompression enables compression for the Encoder.

func (*Encoder) EnableEncryption

func (encoder *Encoder) EnableEncryption(keyBytes [32]byte)

EnableEncryption enables encryption for the Encoder using the secret key bytes passed. Each packet sent after encryption is enabled will be encrypted.

func (*Encoder) Encode

func (encoder *Encoder) Encode(packets [][]byte) error

Encode encodes the packets passed. It writes all of them as a single packet which is compressed and optionally encrypted.

type Event

type Event struct {
	// EntityRuntimeID is the runtime ID of the player. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// UsePlayerID ...
	// TODO: Figure out what UsePlayerID is for.
	UsePlayerID byte
	// Event is the event that is transmitted.
	Event protocol.Event
}

Event is sent by the server to send an event with additional data. It is typically sent to the client for telemetry reasons, much like the SimpleEvent packet.

func (*Event) ID

func (*Event) ID() uint32

ID ...

func (*Event) Marshal

func (pk *Event) Marshal(io protocol.IO)

type FeatureRegistry

type FeatureRegistry struct {
	// Features is a slice of all registered world generation features.
	Features []protocol.GenerationFeature
}

FeatureRegistry is a packet used to notify the client about the world generation features the server is currently using. This is used in combination with the client-side world generation system introduced in v1.19.20, allowing the client to completely generate the chunks of the world without having to rely on the server.

func (*FeatureRegistry) ID

func (pk *FeatureRegistry) ID() uint32

ID ...

func (*FeatureRegistry) Marshal

func (pk *FeatureRegistry) Marshal(io protocol.IO)

type FilterText

type FilterText struct {
	// Text is either the text from the client or the safer version of the text sent by the server.
	Text string
	// FromServer indicates if the packet was sent by the server or not.
	FromServer bool
}

FilterText is sent by the both the client and the server. The client sends the packet to the server to allow the server to filter the text server-side. The server then responds with the same packet and the safer version of the text.

func (*FilterText) ID

func (*FilterText) ID() uint32

ID ...

func (*FilterText) Marshal

func (pk *FilterText) Marshal(io protocol.IO)

type GUIDataPickItem

type GUIDataPickItem struct {
	// ItemName is the name of the item that shows up in the top part of the popup that shows up when
	// selecting an item. It is shown as if an item was selected by the player itself.
	ItemName string
	// ItemEffects is the line under the ItemName, where the effects of the item are usually situated.
	ItemEffects string
	// HotBarSlot is the hot bar slot to be selected/picked. This does not currently work, so it does not
	// matter what number this is.
	HotBarSlot int32
}

GUIDataPickItem is sent by the server to make the client 'select' a hot bar slot. It currently appears to be broken however, and does not actually set the selected slot to the hot bar slot set in the packet.

func (*GUIDataPickItem) ID

func (*GUIDataPickItem) ID() uint32

ID ...

func (*GUIDataPickItem) Marshal

func (pk *GUIDataPickItem) Marshal(io protocol.IO)

type GameRulesChanged

type GameRulesChanged struct {
	// GameRules defines game rules changed with their respective values. The value of these game rules may be
	// either 'bool', 'int32' or 'float32'.
	// Note that some game rules are server side only, and don't necessarily need to be sent to the client.
	// Only changed game rules need to be sent in this packet. Game rules that were not changed do not need to
	// be sent if the client is already updated on them.
	GameRules []protocol.GameRule
}

GameRulesChanged is sent by the server to the client to update client-side game rules, such as game rules like the 'showCoordinates' game rule.

func (*GameRulesChanged) ID

func (*GameRulesChanged) ID() uint32

ID ...

func (*GameRulesChanged) Marshal

func (pk *GameRulesChanged) Marshal(io protocol.IO)

type GameTestRequest

type GameTestRequest struct {
	// Name represents the name of the test.
	Name string
	// Rotation represents the rotation of the test. It is one of the constants above.
	Rotation uint8
	// Repetitions represents the amount of times the test will be run.
	Repetitions int32
	// Position is the position at which the test will be performed.
	Position protocol.BlockPos
	// StopOnError indicates whether the test should immediately stop when an error is encountered.
	StopOnError bool
	// TestsPerRow ...
	TestsPerRow int32
	// MaxTestsPerBatch ...
	MaxTestsPerBatch int32
}

GameTestRequest ...

func (*GameTestRequest) ID

func (pk *GameTestRequest) ID() uint32

ID ...

func (*GameTestRequest) Marshal

func (pk *GameTestRequest) Marshal(io protocol.IO)

type GameTestResults

type GameTestResults struct {
	// Name represents the name of the test.
	Name string
	// Succeeded indicates whether the test succeeded or not.
	Succeeded bool
	// Error is the error that occurred. If Succeeded is true, this field is empty.
	Error string
}

GameTestResults is a packet sent in response to the GameTestRequest packet, with a boolean indicating whether the test was successful or not, and an error string if the test failed.

func (*GameTestResults) ID

func (pk *GameTestResults) ID() uint32

ID ...

func (*GameTestResults) Marshal

func (pk *GameTestResults) Marshal(io protocol.IO)
type Header struct {
	PacketID        uint32
	SenderSubClient byte
	TargetSubClient byte
}

Header is the header of a packet. It exists out of a single varuint32 which is composed of a packet ID and a sender and target sub client ID. These IDs are used for split screen functionality.

func (*Header) Read

func (header *Header) Read(r io.ByteReader) error

Read reads a varuint32 from buf and sets the corresponding values to the Header.

func (*Header) Write

func (header *Header) Write(w io.ByteWriter) error

Write writes the header as a single varuint32 to buf.

type HurtArmour

type HurtArmour struct {
	// Cause is the cause of the damage dealt to the armour.
	Cause int32
	// Damage is the amount of damage points that was dealt to the player. The damage to the armour will be
	// calculated by the client based upon this damage, and will also be based upon any enchantments like
	// thorns that the armour may have.
	Damage int32
	// ArmourSlots is a bitset of all armour slots affected.
	ArmourSlots int64
}

HurtArmour is sent by the server to damage the player's armour after being hit. The packet should never be used by servers as it hands the responsibility over to the player completely, while the server can easily reliably update the armour damage of players itself.

func (*HurtArmour) ID

func (*HurtArmour) ID() uint32

ID ...

func (*HurtArmour) Marshal

func (pk *HurtArmour) Marshal(io protocol.IO)

type Interact

type Interact struct {
	// Action type is the ID of the action that was executed by the player. It is one of the constants that
	// may be found above.
	ActionType byte
	// TargetEntityRuntimeID is the runtime ID of the entity that the player interacted with. This is empty
	// for the InteractActionOpenInventory action type.
	TargetEntityRuntimeID uint64
	// Position associated with the ActionType above. For the InteractActionMouseOverEntity, this is the
	// position relative to the entity moused over over which the player hovered with its mouse/touch. For the
	// InteractActionLeaveVehicle, this is the position that the player spawns at after leaving the vehicle.
	Position mgl32.Vec3
}

Interact is sent by the client when it interacts with another entity in some way. It used to be used for normal entity and block interaction, but this is no longer the case now.

func (*Interact) ID

func (*Interact) ID() uint32

ID ...

func (*Interact) Marshal

func (pk *Interact) Marshal(io protocol.IO)

type InventoryContent

type InventoryContent struct {
	// WindowID is the ID that identifies one of the windows that the client currently has opened, or one of
	// the consistent windows such as the main inventory.
	WindowID uint32
	// Content is the new content of the inventory. The length of this slice must be equal to the full size of
	// the inventory window updated.
	Content []protocol.ItemInstance
}

InventoryContent is sent by the server to update the full content of a particular inventory. It is usually sent for the main inventory of the player, but also works for other inventories that are currently opened by the player.

func (*InventoryContent) ID

func (*InventoryContent) ID() uint32

ID ...

func (*InventoryContent) Marshal

func (pk *InventoryContent) Marshal(io protocol.IO)

type InventorySlot

type InventorySlot struct {
	// WindowID is the ID of the window that the packet modifies. It must point to one of the windows that the
	// client currently has opened.
	WindowID uint32
	// Slot is the index of the slot that the packet modifies. The new item will be set to the slot at this
	// index.
	Slot uint32
	// NewItem is the item to be put in the slot at Slot. It will overwrite any item that may currently
	// be present in that slot.
	NewItem protocol.ItemInstance
}

InventorySlot is sent by the server to update a single slot in one of the inventory windows that the client currently has opened. Usually this is the main inventory, but it may also be the off hand or, for example, a chest inventory.

func (*InventorySlot) ID

func (*InventorySlot) ID() uint32

ID ...

func (*InventorySlot) Marshal

func (pk *InventorySlot) Marshal(io protocol.IO)

type InventoryTransaction

type InventoryTransaction struct {
	// LegacyRequestID is an ID that is only non-zero at times when sent by the client. The server should
	// always send 0 for this. When this field is not 0, the LegacySetItemSlots slice below will have values
	// in it.
	// LegacyRequestID ties in with the ItemStackResponse packet. If this field is non-0, the server should
	// respond with an ItemStackResponse packet. Some inventory actions such as dropping an item out of the
	// hotbar are still one using this packet, and the ItemStackResponse packet needs to tie in with it.
	LegacyRequestID int32
	// LegacySetItemSlots are only present if the LegacyRequestID is non-zero. These item slots inform the
	// server of the slots that were changed during the inventory transaction, and the server should send
	// back an ItemStackResponse packet with these slots present in it. (Or false with no slots, if rejected.)
	LegacySetItemSlots []protocol.LegacySetItemSlot
	// Actions is a list of actions that took place, that form the inventory transaction together. Each of
	// these actions hold one slot in which one item was changed to another. In general, the combination of
	// all of these actions results in a balanced inventory transaction. This should be checked to ensure that
	// no items are cheated into the inventory.
	Actions []protocol.InventoryAction
	// TransactionData is a data object that holds data specific to the type of transaction that the
	// TransactionPacket held. Its concrete type must be one of NormalTransactionData, MismatchTransactionData
	// UseItemTransactionData, UseItemOnEntityTransactionData or ReleaseItemTransactionData. If nil is set,
	// the transaction will be assumed to of type InventoryTransactionTypeNormal.
	TransactionData protocol.InventoryTransactionData
}

InventoryTransaction is a packet sent by the client. It essentially exists out of multiple sub-packets, each of which have something to do with the inventory in one way or another. Some of these sub-packets directly relate to the inventory, others relate to interaction with the world, that could potentially result in a change in the inventory.

func (*InventoryTransaction) ID

ID ...

func (*InventoryTransaction) Marshal

func (pk *InventoryTransaction) Marshal(io protocol.IO)

type ItemComponent

type ItemComponent struct {
	// Items holds a list of all custom items with their respective components set.
	Items []protocol.ItemComponentEntry
}

ItemComponent is sent by the server to attach client-side components to a custom item.

func (*ItemComponent) ID

func (*ItemComponent) ID() uint32

ID ...

func (*ItemComponent) Marshal

func (pk *ItemComponent) Marshal(io protocol.IO)

type ItemFrameDropItem

type ItemFrameDropItem struct {
	// Position is the position of the item frame that had its item dropped. There must be a 'block entity'
	// present at this position.
	Position protocol.BlockPos
}

ItemFrameDropItem is sent by the client when it takes an item out of an item frame.

func (*ItemFrameDropItem) ID

func (*ItemFrameDropItem) ID() uint32

ID ...

func (*ItemFrameDropItem) Marshal

func (pk *ItemFrameDropItem) Marshal(io protocol.IO)

type ItemStackRequest

type ItemStackRequest struct {
	// Requests holds a list of item stack requests. These requests are all separate, but the client buffers
	// the requests, so you might find multiple unrelated requests in this packet.
	Requests []protocol.ItemStackRequest
}

ItemStackRequest is sent by the client to change item stacks in an inventory. It is essentially a replacement of the InventoryTransaction packet added in 1.16 for inventory specific actions, such as moving items around or crafting. The InventoryTransaction packet is still used for actions such as placing blocks and interacting with entities.

func (*ItemStackRequest) ID

func (*ItemStackRequest) ID() uint32

ID ...

func (*ItemStackRequest) Marshal

func (pk *ItemStackRequest) Marshal(io protocol.IO)

type ItemStackResponse

type ItemStackResponse struct {
	// Responses is a list of responses to ItemStackRequests sent by the client before. Responses either
	// approve or reject a request from the client.
	// Vanilla limits the size of this slice to 4096.
	Responses []protocol.ItemStackResponse
}

ItemStackResponse is sent by the server in response to an ItemStackRequest packet from the client. This packet is used to either approve or reject ItemStackRequests from the client. If a request is approved, the client will simply continue as normal. If rejected, the client will undo the actions so that the inventory should be in sync with the server again.

func (*ItemStackResponse) ID

func (*ItemStackResponse) ID() uint32

ID ...

func (*ItemStackResponse) Marshal

func (pk *ItemStackResponse) Marshal(io protocol.IO)

type LabTable

type LabTable struct {
	// ActionType is the type of the action that was executed. It is one of the constants above. Typically,
	// only LabTableActionCombine is sent by the client, whereas LabTableActionReact is sent by the server.
	ActionType byte
	// Position is the position at which the lab table used was located.
	Position protocol.BlockPos
	// ReactionType is the type of the reaction that took place as a result of the items put into the lab
	// table. The reaction type can be either that of an item or a particle, depending on whatever the result
	// was of the reaction.
	ReactionType byte
}

LabTable is sent by the client to let the server know it started a chemical reaction in Education Edition, and is sent by the server to other clients to show the effects. The packet is only functional if Education features are enabled.

func (*LabTable) ID

func (*LabTable) ID() uint32

ID ...

func (*LabTable) Marshal

func (pk *LabTable) Marshal(io protocol.IO)

type LecternUpdate

type LecternUpdate struct {
	// Page is the page number in the book that was opened by the player on the lectern.
	Page byte
	// PageCount is the number of pages that the book opened in the lectern has.
	PageCount byte
	// Position is the position of the lectern that was updated. If no lectern is at the block position,
	// the packet should be ignored.
	Position protocol.BlockPos
	// DropBook specifies if the book currently set on display in the lectern should be dropped server-side.
	DropBook bool
}

LecternUpdate is sent by the client to update the server on which page was opened in a book on a lectern, or if the book should be removed from it.

func (*LecternUpdate) ID

func (*LecternUpdate) ID() uint32

ID ...

func (*LecternUpdate) Marshal

func (pk *LecternUpdate) Marshal(io protocol.IO)

type LessonProgress

type LessonProgress struct {
	// Identifier is the identifier of the lesson that is being progressed.
	Identifier string
	// Action is the action the client should perform to show progress. This is one of the constants defined above.
	Action uint8
	// Score is the score the client should use when displaying the progress.
	Score int32
}

LessonProgress is a packet sent by the server to the client to inform the client of updated progress on a lesson. This packet only functions on the Minecraft: Education Edition version of the game.

func (*LessonProgress) ID

func (*LessonProgress) ID() uint32

ID ...

func (*LessonProgress) Marshal

func (pk *LessonProgress) Marshal(io protocol.IO)

type LevelChunk

type LevelChunk struct {
	// Position contains the X and Z coordinates of the chunk sent. You can convert a block coordinate to a chunk
	// coordinate by right-shifting it four bits.
	Position protocol.ChunkPos
	// HighestSubChunk is the highest sub-chunk at the position that is not all air. It is only set if the
	// SubChunkCount is set to protocol.SubChunkRequestModeLimited.
	HighestSubChunk uint16
	// SubChunkCount is the amount of sub-chunks that are part of the chunk
	// sent. Depending on if the cache is enabled, a list of blob hashes will be
	// sent, or, if disabled, the sub-chunk data. SubChunkCount may be set to
	// protocol.SubChunkRequestModeLimited or
	// protocol.SubChunkRequestModeLimitless to prompt the client to send a
	// SubChunkRequest in response. If this field is set to
	// protocol.SubChunkRequestModeLimited, HighestSubChunk is used.
	SubChunkCount uint32
	// CacheEnabled specifies if the client blob cache should be enabled. This system is based on hashes of
	// blobs which are consistent and saved by the client in combination with that blob, so that the server
	// does not have the same chunk multiple times. If the client does not yet have a blob with the hash sent,
	// it will send a ClientCacheBlobStatus packet containing the hashes is does not have the data of.
	CacheEnabled bool
	// BlobHashes is a list of all blob hashes used in the chunk. It is composed of SubChunkCount + 1 hashes,
	// with the first SubChunkCount hashes being those of the sub-chunks and the last one that of the biome
	// of the chunk.
	// If CacheEnabled is set to false, BlobHashes can be left empty.
	BlobHashes []uint64
	// RawPayload is a serialised string of chunk data. The data held depends on if CacheEnabled is set to
	// true. If set to false, the payload is composed of multiple sub-chunks, each of which carry a version
	// which indicates the way they are serialised, followed by biomes, border blocks and tile entities. If
	// CacheEnabled is true, the payload consists out of the border blocks and tile entities only.
	RawPayload []byte
}

LevelChunk is sent by the server to provide the client with a chunk of a world data (16xYx16 blocks). Typically, a certain amount of chunks is sent to the client before sending it the spawn PlayStatus packet, so that the client spawns in a loaded world.

func (*LevelChunk) ID

func (*LevelChunk) ID() uint32

ID ...

func (*LevelChunk) Marshal

func (pk *LevelChunk) Marshal(io protocol.IO)

type LevelEvent

type LevelEvent struct {
	// EventType is the ID of the event that is being 'called'. It is one of the events found in the constants
	// above.
	EventType int32
	// Position is the position of the level event. Practically every event requires this Vec3 set for it, as
	// particles, sounds and block editing relies on it.
	Position mgl32.Vec3
	// EventData is an integer holding additional data of the event. The type of data held depends on the
	// EventType.
	EventData int32
}

LevelEvent is sent by the server to make a certain event in the level occur. It ranges from particles, to sounds, and other events such as starting rain and block breaking.

func (*LevelEvent) ID

func (*LevelEvent) ID() uint32

ID ...

func (*LevelEvent) Marshal

func (pk *LevelEvent) Marshal(io protocol.IO)

type LevelEventGeneric

type LevelEventGeneric struct {
	// EventID is a unique identifier that identifies the event called. The data that follows has fields in
	// the NBT depending on what event it is.
	EventID int32
	// SerialisedEventData is a network little endian serialised object of event data, with fields that vary
	// depending on EventID.
	// Unlike many other NBT structures, this data is not actually in a compound but just loosely floating
	// NBT tags. To decode using the nbt package, you would need to append 0x0a00 at the start (compound id
	// and name length) and add 0x00 at the end, to manually wrap it in a compound. Likewise, you would have
	// to remove these bytes when encoding.
	// Example of the resulting data with an EventID of 2026:
	// TAG_Compound({
	//    'pos15x': TAG_Float(198),
	//    'pos11x': TAG_Float(201),
	//    'pos6y': TAG_Float(65),
	//    'pos13y': TAG_Float(64),
	//    'pos17z': TAG_Float(36),
	//    'pos8y': TAG_Float(65),
	//    'originY': TAG_Float(65.06125),
	//    'pos10z': TAG_Float(37),
	//    'pos13x': TAG_Float(201),
	//    'pos7y': TAG_Float(65),
	//    'pos9x': TAG_Float(203),
	//    'pos11y': TAG_Float(64),
	//    'pos15y': TAG_Float(65),
	//    'pos15z': TAG_Float(40),
	//    'pos7z': TAG_Float(41),
	//    'pos8x': TAG_Float(198),
	//    'pos13z': TAG_Float(40),
	//    'pos1z': TAG_Float(37),
	//    'pos6z': TAG_Float(42),
	//    'size': TAG_Int(18),
	//    'pos0x': TAG_Float(204),
	//    'pos12x': TAG_Float(200),
	//    'pos2x': TAG_Float(204),
	//    'pos9z': TAG_Float(37),
	//    'pos16y': TAG_Float(64),
	//    'pos5x': TAG_Float(204),
	//    'pos5y': TAG_Float(64),
	//    'pos17x': TAG_Float(202),
	//    'pos3y': TAG_Float(64),
	//    'pos3z': TAG_Float(36),
	//    'radius': TAG_Float(4),
	//    'pos0z': TAG_Float(38),
	//    'pos4z': TAG_Float(36),
	//    'pos8z': TAG_Float(38),
	//    'pos1x': TAG_Float(204),
	//    'pos0y': TAG_Float(64),
	//    'pos14z': TAG_Float(39),
	//    'pos16z': TAG_Float(40),
	//    'pos2y': TAG_Float(63),
	//    'pos6x': TAG_Float(203),
	//    'pos10x': TAG_Float(205),
	//    'pos12y': TAG_Float(64),
	//    'pos1y': TAG_Float(64),
	//    'pos14x': TAG_Float(200),
	//    'pos3x': TAG_Float(204),
	//    'pos9y': TAG_Float(64),
	//    'pos4y': TAG_Float(63),
	//    'pos10y': TAG_Float(63),
	//    'pos12z': TAG_Float(38),
	//    'pos16x': TAG_Float(202),
	//    'originX': TAG_Float(202.48654),
	//    'pos14y': TAG_Float(62),
	//    'pos17y': TAG_Float(62),
	//    'pos5z': TAG_Float(35),
	//    'pos4x': TAG_Float(204),
	//    'pos7x': TAG_Float(203),
	//    'originZ': TAG_Float(38.297028),
	//    'pos11z': TAG_Float(38),
	//    'pos2z': TAG_Float(39),
	// })
	// The 'originX', 'originY' and 'originZ' fields are present in every event and serve as a replacement for
	// a Position field in this packet.
	SerialisedEventData []byte
}

LevelEventGeneric is sent by the server to send a 'generic' level event to the client. This packet sends an NBT serialised object and may for that reason be used for any event holding additional data.

func (*LevelEventGeneric) ID

func (pk *LevelEventGeneric) ID() uint32

ID ...

func (*LevelEventGeneric) Marshal

func (pk *LevelEventGeneric) Marshal(io protocol.IO)

type LevelSoundEvent

type LevelSoundEvent struct {
	// SoundType is the type of the sound to play. It is one of the constants above. Some of the sound types
	// require additional data, which is set in the EventData field.
	SoundType uint32
	// Position is the position of the sound event. The player will be able to hear the direction of the sound
	// based on what position is sent here.
	Position mgl32.Vec3
	// ExtraData is a packed integer that some sound types use to provide extra data. An example of this is
	// the note sound, which is composed of a pitch and an instrument type.
	ExtraData int32
	// EntityType is the string entity type of the entity that emitted the sound, for example
	// 'minecraft:skeleton'. Some sound types use this entity type for additional data.
	EntityType string
	// BabyMob specifies if the sound should be that of a baby mob. It is most notably used for parrot
	// imitations, which will change based on if this field is set to true or not.
	BabyMob bool
	// DisableRelativeVolume specifies if the sound should be played relatively or not. If set to true, the
	// sound will have full volume, regardless of where the Position is, whereas if set to false, the sound's
	// volume will be based on the distance to Position.
	DisableRelativeVolume bool
}

LevelSoundEvent is sent by the server to make any kind of built-in sound heard to a player. It is sent to, for example, play a stepping sound or a shear sound. The packet is also sent by the client, in which case it could be forwarded by the server to the other players online. If possible, the packets from the client should be ignored however, and the server should play them on its own accord.

func (*LevelSoundEvent) ID

func (*LevelSoundEvent) ID() uint32

ID ...

func (*LevelSoundEvent) Marshal

func (pk *LevelSoundEvent) Marshal(io protocol.IO)

type Login

type Login struct {
	// ClientProtocol is the protocol version of the player. The player is disconnected if the protocol is incompatible
	// with the protocol of the server. It has been superseded by the protocol version sent in the
	// RequestNetworkSettings packet, so this should no longer be used by the server.
	ClientProtocol int32
	// ConnectionRequest is a string containing information about the player and JWTs that may be used to
	// verify if the player is connected to XBOX Live. The connection request also contains the necessary
	// client public key to initiate encryption.
	ConnectionRequest []byte
}

Login is sent when the client initially tries to join the server. It is the first packet sent and contains information specific to the player.

func (*Login) ID

func (*Login) ID() uint32

ID ...

func (*Login) Marshal

func (pk *Login) Marshal(io protocol.IO)

type MapCreateLockedCopy

type MapCreateLockedCopy struct {
	// OriginalMapID is the ID of the map that is being copied. The locked copy will obtain all content that
	// is visible on this map, except the content will not change.
	OriginalMapID int64
	// NewMapID is the ID of the map that holds the locked copy of the map that OriginalMapID points to. Its
	// contents will be impossible to change.
	NewMapID int64
}

MapCreateLockedCopy is sent by the client to create a locked copy of one map into another map. In vanilla, it is used in the cartography table to create a map that is locked and cannot be modified.

func (*MapCreateLockedCopy) ID

ID ...

func (*MapCreateLockedCopy) Marshal

func (pk *MapCreateLockedCopy) Marshal(io protocol.IO)

type MapInfoRequest

type MapInfoRequest struct {
	// MapID is the unique identifier that represents the map that is requested over network. It remains
	// consistent across sessions.
	MapID int64
	// ClientPixels is a slice of pixels sent from the client to notify the server about the pixels that it isn't aware
	// of.
	ClientPixels []protocol.PixelRequest
}

MapInfoRequest is sent by the client to request the server to deliver information of a certain map in the inventory of the player. The server should respond with a ClientBoundMapItemData packet.

func (*MapInfoRequest) ID

func (*MapInfoRequest) ID() uint32

ID ...

func (*MapInfoRequest) Marshal

func (pk *MapInfoRequest) Marshal(io protocol.IO)

type MobArmourEquipment

type MobArmourEquipment struct {
	// EntityRuntimeID is the runtime ID of the entity. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// Helmet is the equipped helmet of the entity. Items that are not wearable on the head will not be
	// rendered by the client. Unlike in Java Edition, blocks cannot be worn.
	Helmet protocol.ItemInstance
	// Chestplate is the chestplate of the entity. Items that are not wearable as chestplate will not be
	// rendered.
	Chestplate protocol.ItemInstance
	// Leggings is the item worn as leggings by the entity. Items not wearable as leggings will not be
	// rendered client-side.
	Leggings protocol.ItemInstance
	// Boots is the item worn as boots by the entity. Items not wearable as boots will not be rendered.
	Boots protocol.ItemInstance
}

MobArmourEquipment is sent by the server to the client to update the armour an entity is wearing. It is sent for both players and other entities, such as zombies.

func (*MobArmourEquipment) ID

func (*MobArmourEquipment) ID() uint32

ID ...

func (*MobArmourEquipment) Marshal

func (pk *MobArmourEquipment) Marshal(io protocol.IO)

type MobEffect

type MobEffect struct {
	// EntityRuntimeID is the runtime ID of the entity. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// Operation is the operation of the packet. It is either MobEffectAdd, MobEffectModify or MobEffectRemove
	// and specifies the result of the packet client-side.
	Operation byte
	// EffectType is the ID of the effect to be added, removed or modified. It is one of the constants that
	// may be found above.
	EffectType int32
	// Amplifier is the amplifier of the effect. Take note that the amplifier is not the same as the effect's
	// level. The level is usually one higher than the amplifier, and the amplifier can actually be negative
	// to reverse the behaviour effect.
	Amplifier int32
	// Particles specifies if viewers of the entity that gets the effect shows particles around it. If set to
	// false, no particles are emitted around the entity.
	Particles bool
	// Duration is the duration of the effect in seconds. After the duration has elapsed, the effect will be
	// removed automatically client-side.
	Duration int32
}

MobEffect is sent by the server to apply an effect to the player, for example an effect like poison. It may also be used to modify existing effects, or removing them completely.

func (*MobEffect) ID

func (*MobEffect) ID() uint32

ID ...

func (*MobEffect) Marshal

func (pk *MobEffect) Marshal(io protocol.IO)

type MobEquipment

type MobEquipment struct {
	// EntityRuntimeID is the runtime ID of the entity. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// NewItem is the new item held after sending the MobEquipment packet. The entity will be shown holding
	// that item to the player it was sent to.
	NewItem protocol.ItemInstance
	// InventorySlot is the slot in the inventory that was held. This is the same as HotBarSlot, and only
	// remains for backwards compatibility.
	InventorySlot byte
	// HotBarSlot is the slot in the hot bar that was held. It is the same as InventorySlot, which is only
	// there for backwards compatibility purposes.
	HotBarSlot byte
	// WindowID is the window ID of the window that had its equipped item changed. This is usually the window
	// ID of the normal inventory, but may also be something else, for example with the off hand.
	WindowID byte
}

MobEquipment is sent by the client to the server and the server to the client to make the other side aware of the new item that an entity is holding. It is used to show the item in the hand of entities such as zombies too.

func (*MobEquipment) ID

func (*MobEquipment) ID() uint32

ID ...

func (*MobEquipment) Marshal

func (pk *MobEquipment) Marshal(io protocol.IO)

type ModalFormRequest

type ModalFormRequest struct {
	// FormID is an ID used to identify the form. The ID is saved by the client and sent back when the player
	// submits the form, so that the server can identify which form was submitted.
	FormID uint32
	// FormData is a JSON encoded object of form data. The content of the object differs, depending on the
	// type of the form sent, which is also set in the JSON.
	FormData []byte
}

ModalFormRequest is sent by the server to make the client open a form. This form may be either a modal form which has two options, a menu form for a selection of options and a custom form for properties.

func (*ModalFormRequest) ID

func (*ModalFormRequest) ID() uint32

ID ...

func (*ModalFormRequest) Marshal

func (pk *ModalFormRequest) Marshal(io protocol.IO)

type ModalFormResponse

type ModalFormResponse struct {
	// FormID is the form ID of the form the client has responded to. It is the same as the ID sent in the
	// ModalFormRequest, and may be used to identify which form was submitted.
	FormID uint32
	// ResponseData is a JSON encoded value representing the response of the player. For a modal form, the response is
	// either true or false, for a menu form, the response is an integer specifying the index of the button clicked, and
	// for a custom form, the response is an array containing a value for each element.
	ResponseData protocol.Optional[[]byte]
	// CancelReason represents the reason why the form was cancelled. It is one of the constants above.
	CancelReason protocol.Optional[uint8]
}

ModalFormResponse is sent by the client in response to a ModalFormRequest, after the player has submitted the form sent. It contains the options/properties selected by the player, or a JSON encoded 'null' if the form was closed by clicking the X at the top right corner of the form.

func (*ModalFormResponse) ID

func (*ModalFormResponse) ID() uint32

ID ...

func (*ModalFormResponse) Marshal

func (pk *ModalFormResponse) Marshal(io protocol.IO)

type MotionPredictionHints

type MotionPredictionHints struct {
	// EntityRuntimeID is the runtime ID of the entity whose velocity is sent to the client.
	EntityRuntimeID uint64
	// Velocity is the server-calculated velocity of the entity at the point of sending the packet.
	Velocity mgl32.Vec3
	// OnGround specifies if the server currently thinks the entity is on the ground.
	OnGround bool
}

MotionPredictionHints is sent by the server to the client. There is a predictive movement component for entities. This packet fills the "history" of that component and entity movement is computed based on the points. Vanilla sends this packet instead of the SetActorMotion packet when 'spatial optimisations' are enabled.

func (*MotionPredictionHints) ID

ID ...

func (*MotionPredictionHints) Marshal

func (pk *MotionPredictionHints) Marshal(io protocol.IO)

type MoveActorAbsolute

type MoveActorAbsolute struct {
	// EntityRuntimeID is the runtime ID of the entity. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// Flags is a combination of flags that specify details of the movement. It is a combination of the flags
	// above.
	Flags byte
	// Position is the position to spawn the entity on. If the entity is on a distance that the player cannot
	// see it, the entity will still show up if the player moves closer.
	Position mgl32.Vec3
	// Rotation is a Vec3 holding the X, Y and Z rotation of the entity after the movement. This is a Vec3 for
	// the reason that projectiles like arrows don't have yaw/pitch, but do have roll.
	Rotation mgl32.Vec3
}

MoveActorAbsolute is sent by the server to move an entity to an absolute position. It is typically used for movements where high accuracy isn't needed, such as for long range teleporting.

func (*MoveActorAbsolute) ID

func (*MoveActorAbsolute) ID() uint32

ID ...

func (*MoveActorAbsolute) Marshal

func (pk *MoveActorAbsolute) Marshal(io protocol.IO)

type MoveActorDelta

type MoveActorDelta struct {
	// Flags is a list of flags that specify what data is in the packet.
	Flags uint16
	// EntityRuntimeID is the runtime ID of the entity that is being moved. The packet works provided a
	// non-player entity with this runtime ID is present.
	EntityRuntimeID uint64
	// Position is the new position that the entity was moved to.
	Position mgl32.Vec3
	// Rotation is the new absolute rotation. Unlike the position, it is not actually a delta. If any of the
	// values of this rotation are not sent, these values are 0 and no flag for them is present.
	Rotation mgl32.Vec3
}

MoveActorDelta is sent by the server to move an entity. The packet is specifically optimised to save as much space as possible, by only writing non-zero fields. As of 1.16.100, this packet no longer actually contains any deltas.

func (*MoveActorDelta) ID

func (*MoveActorDelta) ID() uint32

ID ...

func (*MoveActorDelta) Marshal

func (pk *MoveActorDelta) Marshal(io protocol.IO)

type MovePlayer

type MovePlayer struct {
	// EntityRuntimeID is the runtime ID of the player. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// Position is the position to spawn the player on. If the player is on a distance that the viewer cannot
	// see it, the player will still show up if the viewer moves closer.
	Position mgl32.Vec3
	// Pitch is the vertical rotation of the player. Facing straight forward yields a pitch of 0. Pitch is
	// measured in degrees.
	Pitch float32
	// Yaw is the horizontal rotation of the player. Yaw is also measured in degrees.
	Yaw float32
	// HeadYaw is the same as Yaw, except that it applies specifically to the head of the player. A different
	// value for HeadYaw than Yaw means that the player will have its head turned.
	HeadYaw float32
	// Mode is the mode of the movement. It specifies the way the player's movement should be shown to other
	// players. It is one of the constants above.
	Mode byte
	// OnGround specifies if the player is considered on the ground. Note that proxies or hacked clients could
	// fake this to always be true, so it should not be taken for granted.
	OnGround bool
	// RiddenEntityRuntimeID is the runtime ID of the entity that the player might currently be riding. If not
	// riding, this should be left 0.
	RiddenEntityRuntimeID uint64
	// TeleportCause is written only if Mode is MoveModeTeleport. It specifies the cause of the teleportation,
	// which is one of the constants above.
	TeleportCause int32
	// TeleportSourceEntityType is the entity type that caused the teleportation, for example an ender pearl.
	TeleportSourceEntityType int32
	// Tick is the server tick at which the packet was sent. It is used in relation to CorrectPlayerMovePrediction.
	Tick uint64
}

MovePlayer is sent by players to send their movement to the server, and by the server to update the movement of player entities to other players.

func (*MovePlayer) ID

func (*MovePlayer) ID() uint32

ID ...

func (*MovePlayer) Marshal

func (pk *MovePlayer) Marshal(io protocol.IO)

type MultiPlayerSettings

type MultiPlayerSettings struct {
	// ActionType is the action that should be done when this packet is sent. It is one of the constants that
	// may be found above.
	ActionType int32
}

MultiPlayerSettings is sent by the client to update multi-player related settings server-side and sent back to online players by the server. The MultiPlayerSettings packet is a Minecraft: Education Edition packet. It has no functionality for the base game.

func (*MultiPlayerSettings) ID

ID ...

func (*MultiPlayerSettings) Marshal

func (pk *MultiPlayerSettings) Marshal(io protocol.IO)

type NPCDialogue

type NPCDialogue struct {
	// EntityUniqueID is the unique ID of the NPC being requested.
	EntityUniqueID uint64
	// ActionType is the type of action for the packet.
	ActionType int32
	// Dialogue is the text that the client should see.
	Dialogue string
	// SceneName is the identifier of the scene. If this is left empty, the client will use the last scene sent to it.
	// https://docs.microsoft.com/en-us/minecraft/creator/documents/npcdialogue.
	SceneName string
	// NPCName is the name of the NPC to be displayed to the client.
	NPCName string
	// ActionJSON is the JSON string of the buttons/actions the server can perform.
	ActionJSON string
}

NPCDialogue is a packet that allows the client to display dialog boxes for interacting with NPCs.

func (*NPCDialogue) ID

func (*NPCDialogue) ID() uint32

ID ...

func (*NPCDialogue) Marshal

func (pk *NPCDialogue) Marshal(io protocol.IO)

type NPCRequest

type NPCRequest struct {
	// EntityRuntimeID is the runtime ID of the NPC entity that the player interacted with. It is the same
	// as sent by the server when spawning the entity.
	EntityRuntimeID uint64
	// RequestType is the type of the request, which depends on the permission that the player has. It will
	// be either a type that indicates that the NPC should show its dialog, or that it should open the
	// editing window.
	RequestType byte
	// CommandString is the command string set in the NPC. It may consist of multiple commands, depending on
	// what the player set in it.
	CommandString string
	// ActionType is the type of the action to execute.
	ActionType byte
	// SceneName is the name of the scene. This can be left empty to specify the last scene that the player
	// was sent.
	SceneName string
}

NPCRequest is sent by the client when it interacts with an NPC. The packet is specifically made for Education Edition, where NPCs are available to use.

func (*NPCRequest) ID

func (*NPCRequest) ID() uint32

ID ...

func (*NPCRequest) Marshal

func (pk *NPCRequest) Marshal(io protocol.IO)

type NetworkChunkPublisherUpdate

type NetworkChunkPublisherUpdate struct {
	// Position is the block position around which chunks loaded will remain shown to the client. Most servers
	// set this position to the position of the player itself.
	Position protocol.BlockPos
	// Radius is the radius in blocks around Position that chunks sent show up in and will remain loaded in.
	// Unlike the RequestChunkRadius and ChunkRadiusUpdated packets, this radius is in blocks rather than
	// chunks, so the chunk radius needs to be multiplied by 16. (Or shifted to the left by 4.)
	Radius uint32
	// SavedChunks ...
	// TODO: Figure out what this field is used for.
	SavedChunks []protocol.ChunkPos
}

NetworkChunkPublisherUpdate is sent by the server to change the point around which chunks are and remain loaded. This is useful for mini-game servers, where only one area is ever loaded, in which case the NetworkChunkPublisherUpdate packet can be sent in the middle of it, so that no chunks ever need to be additionally sent during the course of the game. In reality, the packet is not extraordinarily useful, and most servers just send it constantly at the position of the player. If the packet is not sent at all, no chunks will be shown to the player, regardless of where they are sent.

func (*NetworkChunkPublisherUpdate) ID

ID ...

func (*NetworkChunkPublisherUpdate) Marshal

func (pk *NetworkChunkPublisherUpdate) Marshal(io protocol.IO)

type NetworkSettings

type NetworkSettings struct {
	// CompressionThreshold is the minimum size of a packet that is compressed when sent. If the size of a
	// packet is under this value, it is not compressed.
	// When set to 0, all packets will be left uncompressed.
	CompressionThreshold uint16
	// CompressionAlgorithm is the algorithm that is used to compress packets.
	CompressionAlgorithm uint16

	// ClientThrottle regulates whether the client should throttle players when exceeding of the threshold. Players
	// outside threshold will not be ticked, improving performance on low-end devices.
	ClientThrottle bool
	// ClientThrottleThreshold is the threshold for client throttling. If the number of players exceeds this value, the
	// client will throttle players.
	ClientThrottleThreshold uint8
	// ClientThrottleScalar is the scalar for client throttling. The scalar is the amount of players that are ticked
	// when throttling is enabled.
	ClientThrottleScalar float32
}

NetworkSettings is sent by the server to update a variety of network settings. These settings modify the way packets are sent over the network stack.

func (*NetworkSettings) ID

func (*NetworkSettings) ID() uint32

ID ...

func (*NetworkSettings) Marshal

func (pk *NetworkSettings) Marshal(io protocol.IO)

type NetworkStackLatency

type NetworkStackLatency struct {
	// Timestamp is the timestamp of the network stack latency packet. The client will, if NeedsResponse is
	// set to true, send a NetworkStackLatency packet with this same timestamp packet in response.
	Timestamp int64
	// NeedsResponse specifies if the sending side of this packet wants a response to the packet, meaning that
	// the other side should send a NetworkStackLatency packet back.
	NeedsResponse bool
}

NetworkStackLatency is sent by the server (and the client, on development builds) to measure the latency over the entire Minecraft stack, rather than the RakNet latency. It has other usages too, such as the ability to be used as some kind of acknowledgement packet, to know when the client has received a certain other packet.

func (*NetworkStackLatency) ID

ID ...

func (*NetworkStackLatency) Marshal

func (pk *NetworkStackLatency) Marshal(io protocol.IO)

type OnScreenTextureAnimation

type OnScreenTextureAnimation struct {
	// AnimationType is the type of the animation to show. The packet provides no further extra data to allow
	// modifying the duration or other properties of the animation.
	AnimationType int32
}

OnScreenTextureAnimation is sent by the server to show a certain animation on the screen of the player. The packet is used, as an example, for when a raid is triggered and when a raid is defeated.

func (*OnScreenTextureAnimation) ID

ID ...

func (*OnScreenTextureAnimation) Marshal

func (pk *OnScreenTextureAnimation) Marshal(io protocol.IO)

type OpenSign

type OpenSign struct {
	// Position is the position of the sign to edit. The client uses this position to get the data of the sign, including
	// the existing text and formatting etc.
	Position protocol.BlockPos
	// FrontSide dictates whether the front side of the sign should be opened for editing. If false, the back side is
	// assumed to be edited.
	FrontSide bool
}

OpenSign is sent by the server to open a sign for editing. As of 1.19.80, the player can interact with a sign to edit the text on both sides instead of just the front.

func (*OpenSign) ID

func (*OpenSign) ID() uint32

ID ...

func (*OpenSign) Marshal

func (pk *OpenSign) Marshal(io protocol.IO)

type Packet

type Packet interface {
	// ID returns the ID of the packet. All of these identifiers of packets may be found in id.go.
	ID() uint32
	// Marshal encodes or decodes a Packet, depending on the protocol.IO
	// implementation passed. When passing a protocol.Writer, Marshal will
	// encode the Packet into its binary representation and write it to the
	// protocol.Writer. On the other hand, when passing a protocol.Reader,
	// Marshal will decode the bytes from the reader into the Packet.
	Marshal(io protocol.IO)
}

Packet represents a packet that may be sent over a Minecraft network connection. The packet needs to hold a method to encode itself to binary and decode itself from binary.

type PacketViolationWarning

type PacketViolationWarning struct {
	// Type is the type of violation. It is one of the constants above.
	Type int32
	// Severity specifies the severity of the packet violation. The action the client takes after this
	// violation depends on the severity sent.
	Severity int32
	// PacketID is the ID of the invalid packet that was received.
	PacketID int32
	// ViolationContext holds a description on the violation of the packet.
	ViolationContext string
}

PacketViolationWarning is sent by the client when it receives an invalid packet from the server. It holds some information on the error that occurred. noinspection GoNameStartsWithPackageName

func (*PacketViolationWarning) ID

ID ...

func (*PacketViolationWarning) Marshal

func (pk *PacketViolationWarning) Marshal(io protocol.IO)

type PassengerJump

type PassengerJump struct {
	// JumpStrength is the strength of the jump, depending on how long the rider has held the jump button.
	JumpStrength int32
}

PassengerJump is sent by the client to the server when it jumps while riding an entity that has the WASDControlled entity flag set, for example when riding a horse.

func (*PassengerJump) ID

func (*PassengerJump) ID() uint32

ID ...

func (*PassengerJump) Marshal

func (pk *PassengerJump) Marshal(io protocol.IO)

type PhotoInfoRequest

type PhotoInfoRequest struct {
	// PhotoID is the ID of the photo.
	PhotoID int64
}

PhotoInfoRequest is sent by the client to request photo information from the server. This packet was deprecated in 1.19.80.

func (*PhotoInfoRequest) ID

func (*PhotoInfoRequest) ID() uint32

ID ...

func (*PhotoInfoRequest) Marshal

func (pk *PhotoInfoRequest) Marshal(io protocol.IO)

type PhotoTransfer

type PhotoTransfer struct {
	// PhotoName is the name of the photo to transfer. It is the exact file name that the client will download
	// the photo as, including the extension of the file.
	PhotoName string
	// PhotoData is the raw data of the photo image. The format of this data may vary: Formats such as JPEG or
	// PNG work, as long as PhotoName has the correct extension.
	PhotoData []byte
	// BookID is the ID of the book that the photo is associated with. If the PhotoName in a book with this ID
	// is set to PhotoName, it will display the photo (provided Education Edition is used).
	// The photo image is downloaded to a sub-folder with this book ID.
	BookID string
	// PhotoType is one of the three photo types above.
	PhotoType byte
	// SourceType is the source photo type. It is one of the three photo types above.
	SourceType byte
	// OwnerEntityUniqueID is the entity unique ID of the photo's owner.
	OwnerEntityUniqueID int64
	// NewPhotoName is the new name of the photo.
	NewPhotoName string
}

PhotoTransfer is sent by the server to transfer a photo (image) file to the client. It is typically used to transfer photos so that the client can display it in a portfolio in Education Edition. While previously usable in the default Bedrock Edition, the displaying of photos in books was disabled and the packet now has little use anymore.

func (*PhotoTransfer) ID

func (*PhotoTransfer) ID() uint32

ID ...

func (*PhotoTransfer) Marshal

func (pk *PhotoTransfer) Marshal(io protocol.IO)

type PlaySound

type PlaySound struct {
	// SoundName is the name of the sound to play.
	SoundName string
	// Position is the position at which the sound was played. Some sounds do not depend on a position,
	// which will then ignore it, but most of them will play with the direction based on the position compared
	// to the player's position.
	Position mgl32.Vec3
	// Volume is the relative volume of the sound to play. It will be less loud for the player if it is
	// farther away from the position of the sound.
	Volume float32
	// Pitch is the pitch of the sound to play. Some sounds completely ignore this field, whereas others use
	// it to specify the pitch as the field is intended.
	Pitch float32
}

PlaySound is sent by the server to play a sound to the client. Some of the sounds may only be started using this packet and must be stopped using the StopSound packet.

func (*PlaySound) ID

func (*PlaySound) ID() uint32

ID ...

func (*PlaySound) Marshal

func (pk *PlaySound) Marshal(io protocol.IO)

type PlayStatus

type PlayStatus struct {
	// Status is the status of the packet. It is one of the constants found above.
	Status int32
}

PlayStatus is sent by the server to update a player on the play status. This includes failed statuses due to a mismatched version, but also success statuses.

func (*PlayStatus) ID

func (*PlayStatus) ID() uint32

ID ...

func (*PlayStatus) Marshal

func (pk *PlayStatus) Marshal(io protocol.IO)

type PlayerAction

type PlayerAction struct {
	// EntityRuntimeID is the runtime ID of the player. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// ActionType is the ID of the action that was executed by the player. It is one of the constants that may
	// be found in protocol/player.go.
	ActionType int32
	// BlockPosition is the position of the target block, if the action with the ActionType set concerned a
	// block. If that is not the case, the block position will be zero.
	BlockPosition protocol.BlockPos
	// ResultPosition is the position of the action's result. When a UseItemOn action is sent, this is the position of
	// the block clicked, but when a block is placed, this is the position at which the block will be placed.
	ResultPosition protocol.BlockPos
	// BlockFace is the face of the target block that was touched. If the action with the ActionType set
	// concerned a block. If not, the face is always 0.
	BlockFace int32
}

PlayerAction is sent by the client when it executes any action, for example starting to sprint, swim, starting the breaking of a block, dropping an item, etc.

func (*PlayerAction) ID

func (*PlayerAction) ID() uint32

ID ...

func (*PlayerAction) Marshal

func (pk *PlayerAction) Marshal(io protocol.IO)

type PlayerArmourDamage

type PlayerArmourDamage struct {
	// Bitset holds a bitset of 4 bits that indicate which pieces of armour need to have damage dealt to them.
	// The first bit, when toggled, is for a helmet, the second for the chestplate, the third for the leggings
	// and the fourth for boots.
	Bitset uint8
	// HelmetDamage is the amount of damage that should be dealt to the helmet.
	HelmetDamage int32
	// ChestplateDamage is the amount of damage that should be dealt to the chestplate.
	ChestplateDamage int32
	// LeggingsDamage is the amount of damage that should be dealt to the leggings.
	LeggingsDamage int32
	// BootsDamage is the amount of damage that should be dealt to the boots.
	BootsDamage int32
}

PlayerArmourDamage is sent by the server to damage the armour of a player. It is a very efficient packet, but generally it's much easier to just send a slot update for the damaged armour.

func (*PlayerArmourDamage) ID

func (pk *PlayerArmourDamage) ID() uint32

ID ...

func (*PlayerArmourDamage) Marshal

func (pk *PlayerArmourDamage) Marshal(io protocol.IO)

type PlayerAuthInput

type PlayerAuthInput struct {
	// Pitch and Yaw hold the rotation that the player reports it has.
	Pitch, Yaw float32
	// Position holds the position that the player reports it has.
	Position mgl32.Vec3
	// MoveVector is a Vec2 that specifies the direction in which the player moved, as a combination of X/Z
	// values which are created using the WASD/controller stick state.
	MoveVector mgl32.Vec2
	// HeadYaw is the horizontal rotation of the head that the player reports it has.
	HeadYaw float32
	// InputData is a combination of bit flags that together specify the way the player moved last tick. It
	// is a combination of the flags above.
	InputData uint64
	// InputMode specifies the way that the client inputs data to the screen. It is one of the constants that
	// may be found above.
	InputMode uint32
	// PlayMode specifies the way that the player is playing. The values it holds, which are rather random,
	// may be found above.
	PlayMode uint32
	// InteractionModel is a constant representing the interaction model the player is using. It is one of the
	// constants that may be found above.
	InteractionModel int32
	// GazeDirection is the direction in which the player is gazing, when the PlayMode is PlayModeReality: In
	// other words, when the player is playing in virtual reality.
	GazeDirection mgl32.Vec3
	// Tick is the server tick at which the packet was sent. It is used in relation to
	// CorrectPlayerMovePrediction.
	Tick uint64
	// Delta was the delta between the old and the new position. There isn't any practical use for this field
	// as it can be calculated by the server itself.
	Delta mgl32.Vec3
	// ItemInteractionData is the transaction data if the InputData includes an item interaction.
	ItemInteractionData protocol.UseItemTransactionData
	// ItemStackRequest is sent by the client to change an item in their inventory.
	ItemStackRequest protocol.ItemStackRequest
	// BlockActions is a slice of block actions that the client has interacted with.
	BlockActions []protocol.PlayerBlockAction
	// AnalogueMoveVector is a Vec2 that specifies the direction in which the player moved, as a combination of X/Z
	// values which are created using an analogue input.
	AnalogueMoveVector mgl32.Vec2
}

PlayerAuthInput is sent by the client to allow for server authoritative movement. It is used to synchronise the player input with the position server-side. The client sends this packet when the ServerAuthoritativeMovementMode field in the StartGame packet is set to true, instead of the MovePlayer packet. The client will send this packet once every tick.

func (*PlayerAuthInput) ID

func (pk *PlayerAuthInput) ID() uint32

ID ...

func (*PlayerAuthInput) Marshal

func (pk *PlayerAuthInput) Marshal(io protocol.IO)

type PlayerEnchantOptions

type PlayerEnchantOptions struct {
	// Options is a list of possible enchantment options for the item that was put into the enchantment table.
	Options []protocol.EnchantmentOption
}

PlayerEnchantOptions is sent by the server to update the enchantment options displayed when the user opens the enchantment table and puts an item in. This packet was added in 1.16 and allows the server to decide on the enchantments that can be selected by the player. The PlayerEnchantOptions packet should be sent once for every slot update of the enchantment table. The vanilla server sends an empty PlayerEnchantOptions packet when the player opens the enchantment table (air is present in the enchantment table slot) and sends the packet with actual enchantments in it when items are put in that can have enchantments.

func (*PlayerEnchantOptions) ID

ID ...

func (*PlayerEnchantOptions) Marshal

func (pk *PlayerEnchantOptions) Marshal(io protocol.IO)

type PlayerFog

type PlayerFog struct {
	// Stack is a list of fog identifiers to be sent to the client. Examples of fog identifiers are
	// "minecraft:fog_ocean" and "minecraft:fog_hell".
	Stack []string
}

PlayerFog is sent by the server to render the different fogs in the Stack. The types of fog are controlled by resource packs to change how they are rendered, and the ability to create custom fog.

func (*PlayerFog) ID

func (*PlayerFog) ID() uint32

ID ...

func (*PlayerFog) Marshal

func (pk *PlayerFog) Marshal(io protocol.IO)

type PlayerHotBar

type PlayerHotBar struct {
	// SelectedHotBarSlot ...
	SelectedHotBarSlot uint32
	// WindowID ...
	WindowID byte
	// SelectHotBarSlot ...
	SelectHotBarSlot bool
}

PlayerHotBar is sent by the server to the client. It used to be used to link hot bar slots of the player to actual slots in the inventory, but as of 1.2, this was changed and hot bar slots are no longer a free floating part of the inventory. Since 1.2, the packet has been re-purposed, but its new functionality is not clear.

func (*PlayerHotBar) ID

func (*PlayerHotBar) ID() uint32

ID ...

func (*PlayerHotBar) Marshal

func (pk *PlayerHotBar) Marshal(io protocol.IO)

type PlayerInput

type PlayerInput struct {
	// Movement is the movement vector of the input. It should be thought of in Pocket Edition controls, where
	// specific arrows (or a combination of two, resulting in a diagonal arrow) decide the direction of
	// movement. The movement vector typically has a length of 1: Either it has movement on one axis, or it
	// has a combination, resulting in sqrt(2)/2 for both axes.
	Movement mgl32.Vec2
	// Jumping indicates if the player was pressing the jump button during the input. It does not define if
	// the player was actually in the air or not.
	Jumping bool
	// Sneaking indicates if the player was sneaking during the input. Note that this may also be checked by
	// keeping the sneaking state updated using the PlayerAction packet.
	Sneaking bool
}

PlayerInput is sent by the client to the server when the player is moving but the server does not allow it to update its movement using the MovePlayer packet. It includes situations where the player is riding an entity like a boat. If this is the case, the packet is sent roughly every tick.

func (*PlayerInput) ID

func (*PlayerInput) ID() uint32

ID ...

func (*PlayerInput) Marshal

func (pk *PlayerInput) Marshal(io protocol.IO)

type PlayerList

type PlayerList struct {
	// ActionType is the action to execute upon the player list. The entries that follow specify which entries
	// are added or removed from the player list.
	ActionType byte
	// Entries is a list of all player list entries that should be added/removed from the player list,
	// depending on the ActionType set.
	Entries []protocol.PlayerListEntry
}

PlayerList is sent by the server to update the client-side player list in the in-game menu screen. It shows the icon of each player if the correct XUID is written in the packet. Sending the PlayerList packet is obligatory when sending an AddPlayer packet. The added player will not show up to a client if it has not been added to the player list, because several properties of the player are obtained from the player list, such as the skin.

func (*PlayerList) ID

func (*PlayerList) ID() uint32

ID ...

func (*PlayerList) Marshal

func (pk *PlayerList) Marshal(io protocol.IO)

type PlayerSkin

type PlayerSkin struct {
	// UUID is the UUID of the player as sent in the Login packet when the client joined the server. It must
	// match this UUID exactly for the skin to show up on the player.
	UUID uuid.UUID
	// Skin is the new skin to be applied on the player with the UUID in the field above. The skin, including
	// its animations, will be shown after sending it.
	Skin protocol.Skin
	// NewSkinName no longer has a function: The field can be left empty at all times.
	NewSkinName string
	// OldSkinName no longer has a function: The field can be left empty at all times.
	OldSkinName string
}

PlayerSkin is sent by the client to the server when it updates its own skin using the in-game skin picker. It is relayed by the server, or sent if the server changes the skin of a player on its own accord. Note that the packet can only be sent for players that are in the player list at the time of sending.

func (*PlayerSkin) ID

func (*PlayerSkin) ID() uint32

ID ...

func (*PlayerSkin) Marshal

func (pk *PlayerSkin) Marshal(io protocol.IO)

type Pool

type Pool map[uint32]func() Packet

Pool is a map holding packets indexed by a packet ID.

func NewClientPool

func NewClientPool() Pool

NewClientPool returns a new pool containing packets sent by a client. Packets may be retrieved from it simply by indexing it with the packet ID.

func NewServerPool

func NewServerPool() Pool

NewServerPool returns a new pool containing packets sent by a server. Packets may be retrieved from it simply by indexing it with the packet ID.

type PositionTrackingDBClientRequest

type PositionTrackingDBClientRequest struct {
	// RequestAction is the action that should be performed upon the receiving of the packet. It is one of the
	// constants found above.
	RequestAction byte
	// TrackingID is a unique ID used to identify the request. The server responds with a
	// PositionTrackingDBServerBroadcast packet holding the same ID, so that the client can find out what that
	// packet was in response to.
	TrackingID int32
}

PositionTrackingDBClientRequest is a packet sent by the client to request the position and dimension of a 'tracking ID'. These IDs are tracked in a database by the server. In 1.16, this is used for lodestones. The client will send this request to find the position a lodestone compass needs to point to. If found, it will point to the lodestone. If not, it will start spinning around. A PositionTrackingDBServerBroadcast packet should be sent in response to this packet.

func (*PositionTrackingDBClientRequest) ID

ID ...

func (*PositionTrackingDBClientRequest) Marshal

type PositionTrackingDBServerBroadcast

type PositionTrackingDBServerBroadcast struct {
	// BroadcastAction specifies the status of the position tracking DB response. It is one of the constants
	// above, specifying the result of the request with the ID below.
	// The Update action is sent for setting the position of a lodestone compass, the Destroy and NotFound to
	// indicate that there is not (no longer) a lodestone at that position.
	BroadcastAction byte
	// TrackingID is the ID of the PositionTrackingDBClientRequest packet that this packet was in response to.
	// The tracking ID is also present as the 'id' field in the SerialisedData field.
	TrackingID int32
	// Payload is a network little endian compound tag holding the data retrieved from the position tracking DB.
	// An example data structure sent if BroadcastAction is of the type Update:
	// TAG_Compound({
	//        'version': TAG_Byte(0x01),
	//        'dim': TAG_Int(0),
	//        'id': TAG_String(0x00000001),
	//        'pos': TAG_List<TAG_Int>({
	//                -299,
	//                86,
	//                74,
	//        }),
	//        'status': TAG_Byte(0x00), // 0x00 for updating, 0x02 for not found/block destroyed.
	// })
	Payload map[string]any
}

PositionTrackingDBServerBroadcast is sent by the server in response to the PositionTrackingDBClientRequest packet. This packet is, as of 1.16, currently only used for lodestones. The server maintains a database with tracking IDs and their position and dimension. The client will request these tracking IDs, (NBT tag set on the lodestone compass with the tracking ID?) and the server will respond with the status of those tracking IDs. What is actually done with the data sent depends on what the client chooses to do with it. For the lodestone compass, it is used to make the compass point towards lodestones and to make it spin if the lodestone at a position is no longer there.

func (*PositionTrackingDBServerBroadcast) ID

ID ...

func (*PositionTrackingDBServerBroadcast) Marshal

type PurchaseReceipt

type PurchaseReceipt struct {
	// Receipts is a list of receipts, or proofs of purchases, for the offers that have been purchased by the
	// player.
	Receipts []string
}

PurchaseReceipt is sent by the client to the server to notify the server it purchased an item from the Marketplace store that was offered by the server. The packet is only used for partnered servers.

func (*PurchaseReceipt) ID

func (*PurchaseReceipt) ID() uint32

ID ...

func (*PurchaseReceipt) Marshal

func (pk *PurchaseReceipt) Marshal(io protocol.IO)

type RemoveActor

type RemoveActor struct {
	// EntityUniqueID is the unique ID of the entity to be removed. The unique ID is a value that remains
	// consistent across different sessions of the same world, but most servers simply fill the runtime ID
	// of the entity out for this field.
	EntityUniqueID int64
}

RemoveActor is sent by the server to remove an entity that currently exists in the world from the client- side. Sending this packet if the client cannot already see this entity will have no effect.

func (*RemoveActor) ID

func (*RemoveActor) ID() uint32

ID ...

func (*RemoveActor) Marshal

func (pk *RemoveActor) Marshal(io protocol.IO)

type RemoveEntity

type RemoveEntity struct {
	// EntityNetworkID is the network ID of the entity that should be removed.
	EntityNetworkID uint64
}

RemoveEntity is sent by the server to the client. Its function is not entirely clear: It does not remove an entity in the sense of an in-game entity, but has to do with the ECS that Minecraft uses.

func (*RemoveEntity) ID

func (pk *RemoveEntity) ID() uint32

ID ...

func (*RemoveEntity) Marshal

func (pk *RemoveEntity) Marshal(io protocol.IO)

type RemoveObjective

type RemoveObjective struct {
	// ObjectiveName is the name of the objective that the scoreboard currently active has. This name must
	// be identical to the one sent in the SetDisplayObjective packet.
	ObjectiveName string
}

RemoveObjective is sent by the server to remove a scoreboard objective. It is used to stop showing a scoreboard to a player.

func (*RemoveObjective) ID

func (*RemoveObjective) ID() uint32

ID ...

func (*RemoveObjective) Marshal

func (pk *RemoveObjective) Marshal(io protocol.IO)

type RemoveVolumeEntity

type RemoveVolumeEntity struct {
	// EntityRuntimeID ...
	EntityRuntimeID uint64
	// Dimension ...
	Dimension int32
}

RemoveVolumeEntity indicates a volume entity to be removed from server to client.

func (*RemoveVolumeEntity) ID

func (*RemoveVolumeEntity) ID() uint32

ID ...

func (*RemoveVolumeEntity) Marshal

func (pk *RemoveVolumeEntity) Marshal(io protocol.IO)

type RequestAbility

type RequestAbility struct {
	// Ability is the ability that the client is requesting. This is one of the constants defined in the
	// protocol/ability.go file.
	Ability int32
	// Value represents the value of the ability. This can either be a boolean or a float32, otherwise the writer/reader
	// will panic.
	Value any
}

RequestAbility is a packet sent by the client to the server to request permission for a specific ability from the server. These abilities are defined above.

func (*RequestAbility) ID

func (*RequestAbility) ID() uint32

ID ...

func (*RequestAbility) Marshal

func (pk *RequestAbility) Marshal(io protocol.IO)

type RequestChunkRadius

type RequestChunkRadius struct {
	// ChunkRadius is the requested chunk radius. This value is always the value set in the settings of the
	// player.
	ChunkRadius int32
	// MaxChunkRadius is the maximum chunk radius that the player wants to receive. The reason for the client sending this
	// is currently unknown.
	MaxChunkRadius int32
}

RequestChunkRadius is sent by the client to the server to update the server on the chunk view radius that it has set in the settings. The server may respond with a ChunkRadiusUpdated packet with either the chunk radius requested, or a different chunk radius if the server chooses so.

func (*RequestChunkRadius) ID

func (*RequestChunkRadius) ID() uint32

ID ...

func (*RequestChunkRadius) Marshal

func (pk *RequestChunkRadius) Marshal(io protocol.IO)

type RequestNetworkSettings

type RequestNetworkSettings struct {
	// ClientProtocol is the protocol version of the player. The player is disconnected if the protocol is
	// incompatible with the protocol of the server.
	ClientProtocol int32
}

RequestNetworkSettings is sent by the client to request network settings, such as compression, from the server.

func (*RequestNetworkSettings) ID

func (pk *RequestNetworkSettings) ID() uint32

ID ...

func (*RequestNetworkSettings) Marshal

func (pk *RequestNetworkSettings) Marshal(io protocol.IO)

type RequestPermissions

type RequestPermissions struct {
	// EntityUniqueID is the unique ID of the player. The unique ID is unique for the entire world and is
	// often used in packets. Most servers send an EntityUniqueID equal to the EntityRuntimeID.
	EntityUniqueID int64
	// PermissionLevel is the current permission level of the player. This is one of the constants that may be found
	// in the AdventureSettings packet.
	PermissionLevel uint8
	// RequestedPermissions contains the requested permission flags.
	RequestedPermissions uint16
}

RequestPermissions is a packet sent from the client to the server to request permissions that the client does not currently have. It can only be sent by operators and host in vanilla Minecraft.

func (*RequestPermissions) ID

func (*RequestPermissions) ID() uint32

ID ...

func (*RequestPermissions) Marshal

func (pk *RequestPermissions) Marshal(io protocol.IO)

type ResourcePackChunkData

type ResourcePackChunkData struct {
	// UUID is the unique ID of the resource pack that the chunk of data is taken out of.
	UUID string
	// ChunkIndex is the current chunk index of the chunk. It is a number that starts at 0 and is incremented
	// for each resource pack data chunk sent to the client.
	ChunkIndex uint32
	// DataOffset is the current progress in bytes or offset in the data that the resource pack data chunk is
	// taken from.
	DataOffset uint64
	// RawPayload is a byte slice containing a chunk of data from the resource pack. It must be of the same size or
	// less than the DataChunkSize set in the ResourcePackDataInfo packet.
	Data []byte
}

ResourcePackChunkData is sent to the client so that the client can download the resource pack. Each packet holds a chunk of the compressed resource pack, of which the size is defined in the ResourcePackDataInfo packet sent before.

func (*ResourcePackChunkData) ID

ID ...

func (*ResourcePackChunkData) Marshal

func (pk *ResourcePackChunkData) Marshal(io protocol.IO)

type ResourcePackChunkRequest

type ResourcePackChunkRequest struct {
	// UUID is the unique ID of the resource pack that the chunk of data is requested from.
	UUID string
	// ChunkIndex is the requested chunk index of the chunk. It is a number that starts at 0 and is
	// incremented for each resource pack data chunk requested.
	ChunkIndex uint32
}

ResourcePackChunkRequest is sent by the client to request a chunk of data from a particular resource pack, that it has obtained information about in a ResourcePackDataInfo packet.

func (*ResourcePackChunkRequest) ID

ID ...

func (*ResourcePackChunkRequest) Marshal

func (pk *ResourcePackChunkRequest) Marshal(io protocol.IO)

type ResourcePackClientResponse

type ResourcePackClientResponse struct {
	// Response is the response type of the response. It is one of the constants found above.
	Response byte
	// PacksToDownload is a list of resource pack UUIDs combined with their version that need to be downloaded
	// (for example SomePack_1.0.0), if the Response field is PackResponseSendPacks.
	PacksToDownload []string
}

ResourcePackClientResponse is sent by the client in response to resource packets sent by the server. It is used to let the server know what action needs to be taken for the client to have all resource packs ready and set.

func (*ResourcePackClientResponse) ID

ID ...

func (*ResourcePackClientResponse) Marshal

func (pk *ResourcePackClientResponse) Marshal(io protocol.IO)

type ResourcePackDataInfo

type ResourcePackDataInfo struct {
	// UUID is the unique ID of the resource pack that the info concerns.
	UUID string
	// DataChunkSize is the maximum size in bytes of the chunks in which the total size of the resource pack
	// to be sent will be divided. A size of 1MB (1024*1024) means that a resource pack of 15.5MB will be
	// split into 16 data chunks.
	DataChunkSize uint32
	// ChunkCount is the total amount of data chunks that the sent resource pack will exist out of. It is the
	// total size of the resource pack divided by the DataChunkSize field.
	// The client doesn't actually seem to use this field. Rather, it divides the size by the chunk size to
	// calculate it itself.
	ChunkCount uint32
	// Size is the total size in bytes that the resource pack occupies. This is the size of the compressed
	// archive (zip) of the resource pack.
	Size uint64
	// Hash is a SHA256 hash of the content of the resource pack.
	Hash []byte
	// Premium specifies if the resource pack was a premium resource pack, meaning it was bought from the
	// Minecraft store.
	Premium bool
	// PackType is the type of the resource pack. It is one of the resource pack types that may be found in
	// the constants above.
	PackType byte
}

ResourcePackDataInfo is sent by the server to the client to inform the client about the data contained in one of the resource packs that are about to be sent.

func (*ResourcePackDataInfo) ID

ID ...

func (*ResourcePackDataInfo) Marshal

func (pk *ResourcePackDataInfo) Marshal(io protocol.IO)

type ResourcePackStack

type ResourcePackStack struct {
	// TexturePackRequired specifies if the client must accept the texture packs the server has in order to
	// join the server. If set to true, the client gets the option to either download the resource packs and
	// join, or quit entirely. Behaviour packs never have to be downloaded.
	TexturePackRequired bool
	// BehaviourPack is a list of behaviour packs that the client needs to download before joining the server.
	// All of these behaviour packs will be applied together, and the order does not necessarily matter.
	BehaviourPacks []protocol.StackResourcePack
	// TexturePacks is a list of texture packs that the client needs to download before joining the server.
	// The order of these texture packs specifies the order that they are applied in on the client side. The
	// first in the list will be applied first.
	TexturePacks []protocol.StackResourcePack
	// BaseGameVersion is the vanilla version that the client should set its resource pack stack to.
	BaseGameVersion string
	// Experiments holds a list of experiments that are either enabled or disabled in the world that the
	// player spawns in.
	// It is not clear why experiments are sent both here and in the StartGame packet.
	Experiments []protocol.ExperimentData
	// ExperimentsPreviouslyToggled specifies if any experiments were previously toggled in this world. It is
	// probably used for some kind of metrics.
	ExperimentsPreviouslyToggled bool
}

ResourcePackStack is sent by the server to send the order in which resource packs and behaviour packs should be applied (and downloaded) by the client.

func (*ResourcePackStack) ID

func (*ResourcePackStack) ID() uint32

ID ...

func (*ResourcePackStack) Marshal

func (pk *ResourcePackStack) Marshal(io protocol.IO)

type ResourcePacksInfo

type ResourcePacksInfo struct {
	// TexturePackRequired specifies if the client must accept the texture packs the server has in order to
	// join the server. If set to true, the client gets the option to either download the resource packs and
	// join, or quit entirely. Behaviour packs never have to be downloaded.
	TexturePackRequired bool
	// HasScripts specifies if any of the resource packs contain scripts in them. If set to true, only clients
	// that support scripts will be able to download them.
	HasScripts bool
	// BehaviourPack is a list of behaviour packs that the client needs to download before joining the server.
	// All of these behaviour packs will be applied together.
	BehaviourPacks []protocol.BehaviourPackInfo
	// TexturePacks is a list of texture packs that the client needs to download before joining the server.
	// The order of these texture packs is not relevant in this packet. It is however important in the
	// ResourcePackStack packet.
	TexturePacks []protocol.TexturePackInfo
	// ForcingServerPacks is currently an unclear field.
	ForcingServerPacks bool
}

ResourcePacksInfo is sent by the server to inform the client on what resource packs the server has. It sends a list of the resource packs it has and basic information on them like the version and description.

func (*ResourcePacksInfo) ID

func (*ResourcePacksInfo) ID() uint32

ID ...

func (*ResourcePacksInfo) Marshal

func (pk *ResourcePacksInfo) Marshal(io protocol.IO)

type Respawn

type Respawn struct {
	// Position is the position on which the player should be respawned. The position might be in a different
	// dimension, in which case the client should first be sent a ChangeDimension packet.
	Position mgl32.Vec3
	// State is the 'state' of the respawn. It is one of the constants that may be found above, and the value
	// the packet contains depends on whether the server or client sends it.
	State byte
	// EntityRuntimeID is the entity runtime ID of the player that the respawn packet concerns. This is
	// apparently for the server to recognise which player sends this packet.
	EntityRuntimeID uint64
}

Respawn is sent by the server to make a player respawn client-side. It is sent in response to a PlayerAction packet with ActionType PlayerActionRespawn. As of 1.13, the server sends two of these packets with different states, and the client sends one of these back in order to complete the respawn.

func (*Respawn) ID

func (*Respawn) ID() uint32

ID ...

func (*Respawn) Marshal

func (pk *Respawn) Marshal(io protocol.IO)

type ScriptCustomEvent

type ScriptCustomEvent struct {
	// EventName is the name of the event. The script and the server will use this event name to identify the
	// data that is sent.
	EventName string
	// EventData is the data of the event. This data is typically a JSON encoded string, that the script is
	// able to encode and decode too.
	EventData []byte
}

ScriptCustomEvent is sent by both the client and the server. It is a way to let scripts communicate with the server, so that the client can let the server know it triggered an event, or the other way around. It is essentially an RPC kind of system.

func (*ScriptCustomEvent) ID

func (*ScriptCustomEvent) ID() uint32

ID ...

func (*ScriptCustomEvent) Marshal

func (pk *ScriptCustomEvent) Marshal(io protocol.IO)

type ScriptMessage

type ScriptMessage struct {
	// Identifier is the identifier of the message, used by either party to identify the message data sent.
	Identifier string
	// Data contains the data of the message.
	Data []byte
}

ScriptMessage is used to communicate custom messages from the client to the server, or from the server to the client. While the name may suggest this packet is used for the discontinued scripting API, it is likely instead for the GameTest framework.

func (*ScriptMessage) ID

func (pk *ScriptMessage) ID() uint32

ID ...

func (*ScriptMessage) Marshal

func (pk *ScriptMessage) Marshal(io protocol.IO)

type ServerSettingsRequest

type ServerSettingsRequest struct {
}

ServerSettingsRequest is sent by the client to request the settings specific to the server. These settings are shown in a separate tab client-side, and have the same structure as a custom form.

func (*ServerSettingsRequest) ID

ID ...

func (*ServerSettingsRequest) Marshal

func (*ServerSettingsRequest) Marshal(protocol.IO)

type ServerSettingsResponse

type ServerSettingsResponse struct {
	// FormID is an ID used to identify the form. The ID is saved by the client and sent back when the player
	// submits the form, so that the server can identify which form was submitted.
	FormID uint32
	// FormData is a JSON encoded object of form data. The content of the object differs, depending on the
	// type of the form sent, which is also set in the JSON.
	FormData []byte
}

ServerSettingsResponse is optionally sent by the server in response to a ServerSettingsRequest from the client. It is structured the same as a ModalFormRequest packet, and if filled out correctly, will show a specific tab for the server in the settings of the client. A ModalFormResponse packet is sent by the client in response to a ServerSettingsResponse, when the client fills out the settings and closes the settings again.

func (*ServerSettingsResponse) ID

ID ...

func (*ServerSettingsResponse) Marshal

func (pk *ServerSettingsResponse) Marshal(io protocol.IO)

type ServerStats

type ServerStats struct {
	// ServerTime ...
	ServerTime float32
	// NetworkTime ...
	NetworkTime float32
}

ServerStats is a packet sent from the server to the client to update the client on server statistics. It is purely used for telemetry.

func (*ServerStats) ID

func (pk *ServerStats) ID() uint32

ID ...

func (*ServerStats) Marshal

func (pk *ServerStats) Marshal(io protocol.IO)

type ServerToClientHandshake

type ServerToClientHandshake struct {
	// JWT is a raw JWT token containing data such as the public key from the server, the algorithm used and
	// the server's token. It is used for the client to produce a shared secret.
	JWT []byte
}

ServerToClientHandshake is sent by the server to the client to complete the key exchange in order to initialise encryption on client and server side. It is followed up by a ClientToServerHandshake packet from the client.

func (*ServerToClientHandshake) ID

ID ...

func (*ServerToClientHandshake) Marshal

func (pk *ServerToClientHandshake) Marshal(io protocol.IO)

type SetActorData

type SetActorData struct {
	// EntityRuntimeID is the runtime ID of the entity. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// EntityMetadata is a map of entity metadata, which includes flags and data properties that alter in
	// particular the way the entity looks. Flags include ones such as 'on fire' and 'sprinting'.
	// The metadata values are indexed by their property key.
	EntityMetadata map[uint32]any
	// EntityProperties is a list of properties that the entity inhibits. These properties define and alter specific
	// attributes of the entity.
	EntityProperties protocol.EntityProperties
	// Tick is the server tick at which the packet was sent. It is used in relation to CorrectPlayerMovePrediction.
	Tick uint64
}

SetActorData is sent by the server to update the entity metadata of an entity. It includes flags such as if the entity is on fire, but also properties such as the air it has left until it starts drowning.

func (*SetActorData) ID

func (*SetActorData) ID() uint32

ID ...

func (*SetActorData) Marshal

func (pk *SetActorData) Marshal(io protocol.IO)
type SetActorLink struct {
	// EntityLink is the link to be set client-side. It links two entities together, so that one entity rides
	// another. Note that players that see those entities later will not see the link, unless it is also sent
	// in the AddActor and AddPlayer packets.
	EntityLink protocol.EntityLink
}

SetActorLink is sent by the server to initiate an entity link client-side, meaning one entity will start riding another.

func (*SetActorLink) ID

func (*SetActorLink) ID() uint32

ID ...

func (*SetActorLink) Marshal

func (pk *SetActorLink) Marshal(io protocol.IO)

type SetActorMotion

type SetActorMotion struct {
	// EntityRuntimeID is the runtime ID of the entity. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// Velocity is the new velocity the entity gets. This velocity will initiate the client-side movement of
	// the entity.
	Velocity mgl32.Vec3
}

SetActorMotion is sent by the server to change the client-side velocity of an entity. It is usually used in combination with server-side movement calculation.

func (*SetActorMotion) ID

func (*SetActorMotion) ID() uint32

ID ...

func (*SetActorMotion) Marshal

func (pk *SetActorMotion) Marshal(io protocol.IO)

type SetCommandsEnabled

type SetCommandsEnabled struct {
	// Enabled defines if the commands should be enabled, or if false, disabled.
	Enabled bool
}

SetCommandsEnabled is sent by the server to enable or disable the ability to execute commands for the client. If disabled, the client itself will stop the execution of commands.

func (*SetCommandsEnabled) ID

func (*SetCommandsEnabled) ID() uint32

ID ...

func (*SetCommandsEnabled) Marshal

func (pk *SetCommandsEnabled) Marshal(io protocol.IO)

type SetDefaultGameType

type SetDefaultGameType struct {
	// GameType is the new game type that is set. When sent by the client, this is the requested new default
	// game type.
	GameType int32
}

SetDefaultGameType is sent by the client when it toggles the default game type in the settings UI, and is sent by the server when it actually changes the default game type, resulting in the toggle being changed in the settings UI.

func (*SetDefaultGameType) ID

func (*SetDefaultGameType) ID() uint32

ID ...

func (*SetDefaultGameType) Marshal

func (pk *SetDefaultGameType) Marshal(io protocol.IO)

type SetDifficulty

type SetDifficulty struct {
	// Difficulty is the new difficulty that the world has.
	Difficulty uint32
}

SetDifficulty is sent by the server to update the client-side difficulty of the client. The actual effect of this packet on the client isn't very significant, as the difficulty is handled server-side.

func (*SetDifficulty) ID

func (*SetDifficulty) ID() uint32

ID ...

func (*SetDifficulty) Marshal

func (pk *SetDifficulty) Marshal(io protocol.IO)

type SetDisplayObjective

type SetDisplayObjective struct {
	// DisplaySlot is the slot in which the scoreboard should be displayed. Available options can be found in
	// the constants above.
	DisplaySlot string
	// ObjectiveName is the name of the objective that the scoreboard displays. Filling out a random unique
	// value for this field works: It is not displayed in the scoreboard.
	ObjectiveName string
	// DisplayName is the name, or title, that is displayed at the top of the scoreboard.
	DisplayName string
	// CriteriaName is the name of the criteria that need to be fulfilled in order for the score to be
	// increased. This can be any kind of string and does not show up client-side.
	CriteriaName string
	// SortOrder is the order in which entries on the scoreboard should be sorted. It is one of the constants
	// that may be found above.
	SortOrder int32
}

SetDisplayObjective is sent by the server to display an object as a scoreboard to the player. Once sent, it should be followed up by a SetScore packet to set the lines of the packet.

func (*SetDisplayObjective) ID

ID ...

func (*SetDisplayObjective) Marshal

func (pk *SetDisplayObjective) Marshal(io protocol.IO)

type SetHealth

type SetHealth struct {
	// Health is the new health of the player.
	Health int32
}

SetHealth is sent by the server. It sets the health of the player it is sent to. The SetHealth packet should no longer be used. Instead, the health attribute should be used so that the health and maximum health may be changed directly.

func (*SetHealth) ID

func (*SetHealth) ID() uint32

ID ...

func (*SetHealth) Marshal

func (pk *SetHealth) Marshal(io protocol.IO)

type SetLastHurtBy

type SetLastHurtBy struct {
	// EntityType is the numerical type of the entity that the player was last hurt by.
	EntityType int32
}

SetLastHurtBy is sent by the server to let the client know what entity type it was last hurt by. At this moment, the packet is useless and should not be used. There is no behaviour that depends on if this packet is sent or not.

func (*SetLastHurtBy) ID

func (*SetLastHurtBy) ID() uint32

ID ...

func (*SetLastHurtBy) Marshal

func (pk *SetLastHurtBy) Marshal(io protocol.IO)

type SetLocalPlayerAsInitialised

type SetLocalPlayerAsInitialised struct {
	// EntityRuntimeID is the entity runtime ID the player was assigned earlier in the login sequence in the
	// StartGame packet.
	EntityRuntimeID uint64
}

SetLocalPlayerAsInitialised is sent by the client in response to a PlayStatus packet with the status set to 3. The packet marks the moment at which the client is fully initialised and can receive any packet without discarding it.

func (*SetLocalPlayerAsInitialised) ID

ID ...

func (*SetLocalPlayerAsInitialised) Marshal

func (pk *SetLocalPlayerAsInitialised) Marshal(io protocol.IO)

type SetPlayerGameType

type SetPlayerGameType struct {
	// GameType is the new game type of the player. It is one of the constants that can be found above. Some
	// of these game types require additional flags to be set in an AdventureSettings packet for the game mode
	// to obtain its full functionality.
	GameType int32
}

SetPlayerGameType is sent by the server to update the game type, which is otherwise known as the game mode, of a player.

func (*SetPlayerGameType) ID

func (*SetPlayerGameType) ID() uint32

ID ...

func (*SetPlayerGameType) Marshal

func (pk *SetPlayerGameType) Marshal(io protocol.IO)

type SetScore

type SetScore struct {
	// ActionType is the type of the action to execute upon the scoreboard with the entries that the packet
	// has. If ActionType is ScoreboardActionModify, all entries will be added to the scoreboard if not yet
	// present, or modified if already present. If set to ScoreboardActionRemove, all scoreboard entries set
	// will be removed from the scoreboard.
	ActionType byte
	// Entries is a list of all entries that the client should operate on. When modifying, it will add or
	// modify all entries, whereas when removing, it will remove all entries.
	Entries []protocol.ScoreboardEntry
}

SetScore is sent by the server to send the contents of a scoreboard to the player. It may be used to either add, remove or edit entries on the scoreboard.

func (*SetScore) ID

func (*SetScore) ID() uint32

ID ...

func (*SetScore) Marshal

func (pk *SetScore) Marshal(io protocol.IO)

type SetScoreboardIdentity

type SetScoreboardIdentity struct {
	// ActionType is the type of the action to execute. The action is either ScoreboardIdentityActionRegister
	// to associate an identity with the entry, or ScoreboardIdentityActionClear to remove associations with
	// an entity.
	ActionType byte
	// Entries is a list of all entries in the packet. Each of these entries points to one of the entries on
	// a scoreboard. Depending on ActionType, their identity will either be registered or cleared.
	Entries []protocol.ScoreboardIdentityEntry
}

SetScoreboardIdentity is sent by the server to change the identity type of one of the entries on a scoreboard. This is used to change, for example, an entry pointing to a player, to a fake player when it leaves the server, and to change it back to a real player when it joins again. In non-vanilla situations, the packet is quite useless.

func (*SetScoreboardIdentity) ID

ID ...

func (*SetScoreboardIdentity) Marshal

func (pk *SetScoreboardIdentity) Marshal(io protocol.IO)

type SetSpawnPosition

type SetSpawnPosition struct {
	// SpawnType is the type of spawn to set. It is either SpawnTypePlayer or SpawnTypeWorld, and specifies
	// the behaviour of the spawn set. If SpawnTypeWorld is set, the position to which compasses will point is
	// also changed.
	SpawnType int32
	// Position is the new position of the spawn that was set. If SpawnType is SpawnTypeWorld, compasses will
	// point to this position. As of 1.16, Position is always the position of the player.
	Position protocol.BlockPos
	// Dimension is the ID of the dimension that had its spawn updated. This is specifically relevant for
	// behaviour added in 1.16 such as the respawn anchor, which allows setting the spawn in a specific
	// dimension.
	Dimension int32
	// SpawnPosition is a new field added in 1.16. It holds the spawn position of the world. This spawn
	// position is {-2147483648, -2147483648, -2147483648} for a default spawn position.
	SpawnPosition protocol.BlockPos
}

SetSpawnPosition is sent by the server to update the spawn position of a player, for example when sleeping in a bed.

func (*SetSpawnPosition) ID

func (*SetSpawnPosition) ID() uint32

ID ...

func (*SetSpawnPosition) Marshal

func (pk *SetSpawnPosition) Marshal(io protocol.IO)

type SetTime

type SetTime struct {
	// Time is the current time. The time is not limited to 24000 (time of day), but continues progressing
	// after that.
	Time int32
}

SetTime is sent by the server to update the current time client-side. The client actually advances time client-side by itself, so this packet does not need to be sent each tick. It is merely a means of synchronising time between server and client.

func (*SetTime) ID

func (*SetTime) ID() uint32

ID ...

func (*SetTime) Marshal

func (pk *SetTime) Marshal(io protocol.IO)

type SetTitle

type SetTitle struct {
	// ActionType is the type of the action that should be executed upon the title of a player. It is one of
	// the constants above and specifies the response of the client to the packet.
	ActionType int32
	// Text is the text of the title, which has a different meaning depending on the ActionType that the
	// packet has. The text is the text of a title, subtitle or action bar, depending on the type set.
	Text string
	// FadeInDuration is the duration that the title takes to fade in on the screen of the player. It is
	// measured in 20ths of a second (AKA in ticks).
	FadeInDuration int32
	// RemainDuration is the duration that the title remains on the screen of the player. It is measured in
	// 20ths of a second (AKA in ticks).
	RemainDuration int32
	// FadeOutDuration is the duration that the title takes to fade out of the screen of the player. It is
	// measured in 20ths of a second (AKA in ticks).
	FadeOutDuration int32
	// XUID is the XBOX Live user ID of the player, which will remain consistent as long as the player is
	// logged in with the XBOX Live account. It is empty if the user is not logged into its XBL account.
	XUID string
	// PlatformOnlineID is either a uint64 or an empty string.
	PlatformOnlineID string
}

SetTitle is sent by the server to make a title, subtitle or action bar shown to a player. It has several fields that allow setting the duration of the titles.

func (*SetTitle) ID

func (*SetTitle) ID() uint32

ID ...

func (*SetTitle) Marshal

func (pk *SetTitle) Marshal(io protocol.IO)

type SettingsCommand

type SettingsCommand struct {
	// CommandLine is the full command line that was sent to the server as a result of the setting that the
	// client changed.
	CommandLine string
	// SuppressOutput specifies if the client requests the suppressing of the output of the command that was
	// executed. Generally this is set to true, as the client won't need a message to confirm the output of
	// the change.
	SuppressOutput bool
}

SettingsCommand is sent by the client when it changes a setting in the settings that results in the issuing of a command to the server, such as when Show Coordinates is enabled.

func (*SettingsCommand) ID

func (*SettingsCommand) ID() uint32

ID ...

func (*SettingsCommand) Marshal

func (pk *SettingsCommand) Marshal(io protocol.IO)

type ShowCredits

type ShowCredits struct {
	// PlayerRuntimeID is the entity runtime ID of the player to show the credits to. It's not clear why this
	// field is actually here in the first place.
	PlayerRuntimeID uint64
	// StatusType is the status type of the credits. It is one of the constants above, and either starts or
	// stops the credits.
	StatusType int32
}

ShowCredits is sent by the server to show the Minecraft credits screen to the client. It is typically sent when the player beats the ender dragon and leaves the End.

func (*ShowCredits) ID

func (*ShowCredits) ID() uint32

ID ...

func (*ShowCredits) Marshal

func (pk *ShowCredits) Marshal(io protocol.IO)

type ShowProfile

type ShowProfile struct {
	// XUID is the XBOX Live User ID of the player whose profile should be shown to the player. If it is not
	// a valid XUID, the client ignores the packet.
	XUID string
}

ShowProfile is sent by the server to show the XBOX Live profile of one player to another.

func (*ShowProfile) ID

func (*ShowProfile) ID() uint32

ID ...

func (*ShowProfile) Marshal

func (pk *ShowProfile) Marshal(io protocol.IO)

type ShowStoreOffer

type ShowStoreOffer struct {
	// OfferID is a string that identifies the offer for which a window should be opened. While typically a
	// UUID, the ID could be anything.
	OfferID string
	// ShowAll specifies if all other offers of the same 'author' as the one of the offer associated with the
	// OfferID should also be displayed, alongside the target offer.
	ShowAll bool
}

ShowStoreOffer is sent by the server to show a Marketplace store offer to a player. It opens a window client-side that displays the item. The ShowStoreOffer packet only works on the partnered servers: Servers that are not partnered will not have a store buttons show up in the in-game pause menu and will, as a result, not be able to open store offers on the client side. Sending the packet does therefore not work when using a proxy that is not connected to with the domain of one of the partnered servers.

func (*ShowStoreOffer) ID

func (*ShowStoreOffer) ID() uint32

ID ...

func (*ShowStoreOffer) Marshal

func (pk *ShowStoreOffer) Marshal(io protocol.IO)

type SimpleEvent

type SimpleEvent struct {
	// EventType is the type of the event to be called. It is one of the constants that may be found above.
	EventType int16
}

SimpleEvent is sent by the server to send a 'simple event' to the client, meaning an event without any additional event data. The event is typically used by the client for telemetry.

func (*SimpleEvent) ID

func (*SimpleEvent) ID() uint32

ID ...

func (*SimpleEvent) Marshal

func (pk *SimpleEvent) Marshal(io protocol.IO)

type SimulationType

type SimulationType struct {
	// SimulationType is the simulation type selected.
	SimulationType byte
}

SimulationType is an in-progress packet. We currently do not know the use case.

func (*SimulationType) ID

func (*SimulationType) ID() uint32

ID ...

func (*SimulationType) Marshal

func (pk *SimulationType) Marshal(io protocol.IO)

type SpawnExperienceOrb

type SpawnExperienceOrb struct {
	// Position is the position to spawn the experience orb on. If the entity is on a distance that the player
	// cannot see it, the entity will still show up if the player moves closer.
	Position mgl32.Vec3
	// ExperienceAmount is the amount of experience in experience points that the orb carries. The client-side
	// size of the orb depends on the amount of experience in the orb: There are 11 possible sizes for the
	// orb, for 1–2, 3–6, 7–16, 17–36, 37–72, 73–148, 149–306, 307–616, 617–1236, 1237–2476, and 2477 and up.
	ExperienceAmount int32
}

SpawnExperienceOrb is sent by the server to spawn an experience orb entity client-side. Much like the AddPainting packet, it is one of the few packets that spawn an entity without using the AddActor packet.

func (*SpawnExperienceOrb) ID

func (*SpawnExperienceOrb) ID() uint32

ID ...

func (*SpawnExperienceOrb) Marshal

func (pk *SpawnExperienceOrb) Marshal(io protocol.IO)

type SpawnParticleEffect

type SpawnParticleEffect struct {
	// Dimension is the dimension that the particle is spawned in. Its exact usage is not clear, as the
	// dimension has no direct effect on the particle.
	Dimension byte
	// EntityUniqueID is the unique ID of the entity that the spawned particle may be attached to. If this ID
	// is not -1, the Position below will be interpreted as relative to the position of the entity associated
	// with this unique ID.
	EntityUniqueID int64
	// Position is the position that the particle should be spawned at. If the position is too far away from
	// the player, it will not show up.
	// If EntityUniqueID is not -1, the position will be relative to the position of the entity.
	Position mgl32.Vec3
	// ParticleName is the name of the particle that should be shown. This name may point to a particle effect
	// that is built-in, or to one implemented by behaviour packs.
	ParticleName string
	// MoLangVariables is an encoded JSON map of MoLang variables that may be applicable to the particle spawn. This can
	// just be left empty in most cases.
	MoLangVariables protocol.Optional[[]byte]
}

SpawnParticleEffect is sent by the server to spawn a particle effect client-side. Unlike other packets that result in the appearing of particles, this packet can show particles that are not hardcoded in the client. They can be added and changed through behaviour packs to implement custom particles.

func (*SpawnParticleEffect) ID

ID ...

func (*SpawnParticleEffect) Marshal

func (pk *SpawnParticleEffect) Marshal(io protocol.IO)

type StartGame

type StartGame struct {
	// EntityUniqueID is the unique ID of the player. The unique ID is a value that remains consistent across
	// different sessions of the same world, but most servers simply fill the runtime ID of the entity out for
	// this field.
	EntityUniqueID int64
	// EntityRuntimeID is the runtime ID of the player. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// PlayerGameMode is the game mode the player currently has. It is a value from 0-4, with 0 being
	// survival mode, 1 being creative mode, 2 being adventure mode, 3 being survival spectator and 4 being
	// creative spectator.
	// This field may be set to 5 to make the client fall back to the game mode set in the WorldGameMode
	// field.
	PlayerGameMode int32
	// PlayerPosition is the spawn position of the player in the world. In servers this is often the same as
	// the world's spawn position found below.
	PlayerPosition mgl32.Vec3
	// Pitch is the vertical rotation of the player. Facing straight forward yields a pitch of 0. Pitch is
	// measured in degrees.
	Pitch float32
	// Yaw is the horizontal rotation of the player. Yaw is also measured in degrees.
	Yaw float32
	// WorldSeed is the seed used to generate the world. Unlike in PC edition, the seed is a 32bit integer
	// here.
	WorldSeed int64
	// SpawnBiomeType specifies if the biome that the player spawns in is user defined (through behaviour
	// packs) or builtin. See the constants above.
	SpawnBiomeType int16
	// UserDefinedBiomeName is a readable name of the biome that the player spawned in, such as 'plains'. This
	// might be a custom biome name if any custom biomes are present through behaviour packs.
	UserDefinedBiomeName string
	// Dimension is the ID of the dimension that the player spawns in. It is a value from 0-2, with 0 being
	// the overworld, 1 being the nether and 2 being the end.
	Dimension int32
	// Generator is the generator used for the world. It is a value from 0-4, with 0 being old limited worlds,
	// 1 being infinite worlds, 2 being flat worlds, 3 being nether worlds and 4 being end worlds. A value of
	// 0 will actually make the client stop rendering chunks you send beyond the world limit.
	Generator int32
	// WorldGameMode is the game mode that a player gets when it first spawns in the world. It is shown in the
	// settings and is used if the PlayerGameMode is set to 5.
	WorldGameMode int32
	// Difficulty is the difficulty of the world. It is a value from 0-3, with 0 being peaceful, 1 being easy,
	// 2 being normal and 3 being hard.
	Difficulty int32
	// WorldSpawn is the block on which the world spawn of the world. This coordinate has no effect on the
	// place that the client spawns, but it does have an effect on the direction that a compass points.
	WorldSpawn protocol.BlockPos
	// AchievementsDisabled defines if achievements are disabled in the world. The client crashes if this
	// value is set to true while the player's or the world's game mode is creative, and it's recommended to
	// simply always set this to false as a server.
	AchievementsDisabled bool
	// EditorWorld is a value to dictate if the world is in editor mode, a special mode recently introduced adding
	// "powerful tools for editing worlds, intended for experienced creators."
	EditorWorld bool
	// CreatedInEditor is a value to dictate if the world was created as a project in the editor mode. The functionality
	// of this field is currently unknown.
	CreatedInEditor bool
	// ExportedFromEditor is a value to dictate if the world was exported from editor mode. The functionality of this
	// field is currently unknown.
	ExportedFromEditor bool
	// DayCycleLockTime is the time at which the day cycle was locked if the day cycle is disabled using the
	// respective game rule. The client will maintain this time as long as the day cycle is disabled.
	DayCycleLockTime int32
	// EducationEditionOffer is some Minecraft: Education Edition field that specifies what 'region' the world
	// was from, with 0 being None, 1 being RestOfWorld, and 2 being China.
	// The actual use of this field is unknown.
	EducationEditionOffer int32
	// EducationFeaturesEnabled specifies if the world has education edition features enabled, such as the
	// blocks or entities specific to education edition.
	EducationFeaturesEnabled bool
	// EducationProductID is a UUID used to identify the education edition server instance. It is generally
	// unique for education edition servers.
	EducationProductID string
	// RainLevel is the level specifying the intensity of the rain falling. When set to 0, no rain falls at
	// all.
	RainLevel float32
	// LightningLevel is the level specifying the intensity of the thunder. This may actually be set
	// independently from the RainLevel, meaning dark clouds can be produced without rain.
	LightningLevel float32
	// ConfirmedPlatformLockedContent ...
	ConfirmedPlatformLockedContent bool
	// MultiPlayerGame specifies if the world is a multi-player game. This should always be set to true for
	// servers.
	MultiPlayerGame bool
	// LANBroadcastEnabled specifies if LAN broadcast was intended to be enabled for the world.
	LANBroadcastEnabled bool
	// XBLBroadcastMode is the mode used to broadcast the joined game across XBOX Live.
	XBLBroadcastMode int32
	// PlatformBroadcastMode is the mode used to broadcast the joined game across the platform.
	PlatformBroadcastMode int32
	// CommandsEnabled specifies if commands are enabled for the player. It is recommended to always set this
	// to true on the server, as setting it to false means the player cannot, under any circumstance, use a
	// command.
	CommandsEnabled bool
	// TexturePackRequired specifies if the texture pack the world might hold is required, meaning the client
	// was forced to download it before joining.
	TexturePackRequired bool
	// GameRules defines game rules currently active with their respective values. The value of these game
	// rules may be either 'bool', 'int32' or 'float32'. Some game rules are server side only, and don't
	// necessarily need to be sent to the client.
	GameRules []protocol.GameRule
	// Experiments holds a list of experiments that are either enabled or disabled in the world that the
	// player spawns in.
	Experiments []protocol.ExperimentData
	// ExperimentsPreviouslyToggled specifies if any experiments were previously toggled in this world. It is
	// probably used for some kind of metrics.
	ExperimentsPreviouslyToggled bool
	// BonusChestEnabled specifies if the world had the bonus map setting enabled when generating it. It does
	// not have any effect client-side.
	BonusChestEnabled bool
	// StartWithMapEnabled specifies if the world has the start with map setting enabled, meaning each joining
	// player obtains a map. This should always be set to false, because the client obtains a map all on its
	// own accord if this is set to true.
	StartWithMapEnabled bool
	// PlayerPermissions is the permission level of the player. It is a value from 0-3, with 0 being visitor,
	// 1 being member, 2 being operator and 3 being custom.
	PlayerPermissions int32
	// ServerChunkTickRadius is the radius around the player in which chunks are ticked. Most servers set this
	// value to a fixed number, as it does not necessarily affect anything client-side.
	ServerChunkTickRadius int32
	// HasLockedBehaviourPack specifies if the behaviour pack of the world is locked, meaning it cannot be
	// disabled from the world. This is typically set for worlds on the marketplace that have a dedicated
	// behaviour pack.
	HasLockedBehaviourPack bool
	// HasLockedTexturePack specifies if the texture pack of the world is locked, meaning it cannot be
	// disabled from the world. This is typically set for worlds on the marketplace that have a dedicated
	// texture pack.
	HasLockedTexturePack bool
	// FromLockedWorldTemplate specifies if the world from the server was from a locked world template. For
	// servers this should always be set to false.
	FromLockedWorldTemplate bool
	// MSAGamerTagsOnly ..
	MSAGamerTagsOnly bool
	// FromWorldTemplate specifies if the world from the server was from a world template. For servers this
	// should always be set to false.
	FromWorldTemplate bool
	// WorldTemplateSettingsLocked specifies if the world was a template that locks all settings that change
	// properties above in the settings GUI. It is recommended to set this to true for servers that do not
	// allow things such as setting game rules through the GUI.
	WorldTemplateSettingsLocked bool
	// OnlySpawnV1Villagers is a hack that Mojang put in place to preserve backwards compatibility with old
	// villagers. The bool is never actually read though, so it has no functionality.
	OnlySpawnV1Villagers bool
	// PersonaDisabled is true if persona skins are disabled for the current game session.
	PersonaDisabled bool
	// CustomSkinsDisabled is true if custom skins are disabled for the current game session.
	CustomSkinsDisabled bool
	// EmoteChatMuted specifies if players will be sent a chat message when using certain emotes.
	EmoteChatMuted bool
	// BaseGameVersion is the version of the game from which Vanilla features will be used. The exact function
	// of this field isn't clear.
	BaseGameVersion string
	// LimitedWorldWidth and LimitedWorldDepth are the dimensions of the world if the world is a limited
	// world. For unlimited worlds, these may simply be left as 0.
	LimitedWorldWidth, LimitedWorldDepth int32
	// NewNether specifies if the server runs with the new nether introduced in the 1.16 update.
	NewNether bool
	// EducationSharedResourceURI is an education edition feature that transmits education resource settings to clients.
	EducationSharedResourceURI protocol.EducationSharedResourceURI
	// ForceExperimentalGameplay specifies if experimental gameplay should be force enabled. For servers this
	// should always be set to false.
	ForceExperimentalGameplay protocol.Optional[bool]
	// LevelID is a base64 encoded world ID that is used to identify the world.
	LevelID string
	// WorldName is the name of the world that the player is joining. Note that this field shows up above the
	// player list for the rest of the game session, and cannot be changed. Setting the server name to this
	// field is recommended.
	WorldName string
	// TemplateContentIdentity is a UUID specific to the premium world template that might have been used to
	// generate the world. Servers should always fill out an empty string for this.
	TemplateContentIdentity string
	// Trial specifies if the world was a trial world, meaning features are limited and there is a time limit
	// on the world.
	Trial bool
	// PlayerMovementSettings ...
	PlayerMovementSettings protocol.PlayerMovementSettings
	// Time is the total time that has elapsed since the start of the world.
	Time int64
	// EnchantmentSeed is the seed used to seed the random used to produce enchantments in the enchantment
	// table. Note that the exact correct random implementation must be used to produce the correct results
	// both client- and server-side.
	EnchantmentSeed int32
	// Blocks is a list of all custom blocks registered on the server.
	Blocks []protocol.BlockEntry
	// Items is a list of all items with their legacy IDs which are available in the game. Failing to send any
	// of the items that are in the game will crash mobile clients.
	Items []protocol.ItemEntry
	// MultiPlayerCorrelationID is a unique ID specifying the multi-player session of the player. A random
	// UUID should be filled out for this field.
	MultiPlayerCorrelationID string
	// ServerAuthoritativeInventory specifies if the server authoritative inventory system is enabled. This
	// is a new system introduced in 1.16. Backwards compatibility with the inventory transactions has to
	// some extent been preserved, but will eventually be removed.
	ServerAuthoritativeInventory bool
	// GameVersion is the version of the game the server is running. The exact function of this field isn't clear.
	GameVersion string
	// PropertyData contains properties that should be applied on the player. These properties are the same as the
	// ones that are sent in the SyncActorProperty packet.
	PropertyData map[string]any
	// ServerBlockStateChecksum is a checksum to ensure block states between the server and client match.
	// This can simply be left empty, and the client will avoid trying to verify it.
	ServerBlockStateChecksum uint64
	// ClientSideGeneration is true if the client should use the features registered in the FeatureRegistry packet to
	// generate terrain client-side to save on bandwidth.
	ClientSideGeneration bool
	// WorldTemplateID is a UUID that identifies the template that was used to generate the world. Servers that do not
	// use a world based off of a template can set this to an empty UUID.
	WorldTemplateID uuid.UUID
	// ChatRestrictionLevel specifies the level of restriction on in-game chat. It is one of the constants above.
	ChatRestrictionLevel uint8
	// DisablePlayerInteractions is true if the client should ignore other players when interacting with the world.
	DisablePlayerInteractions bool
	// UseBlockNetworkIDHashes is true if the client should use the hash of a block's name as its network ID rather than
	// its index in the expected block palette. This is useful for servers that wish to support multiple protocol versions
	// and custom blocks, but it will result in extra bytes being written for every block in a sub chunk palette.
	UseBlockNetworkIDHashes bool
	// ServerAuthoritativeSound is currently unknown as to what it does.
	ServerAuthoritativeSound bool
}

StartGame is sent by the server to send information about the world the player will be spawned in. It contains information about the position the player spawns in, and information about the world in general such as its game rules.

func (*StartGame) ID

func (*StartGame) ID() uint32

ID ...

func (*StartGame) Marshal

func (pk *StartGame) Marshal(io protocol.IO)

type StopSound

type StopSound struct {
	// SoundName is the name of the sound that should be stopped from playing. If no sound with this name is
	// currently active, the packet is ignored.
	SoundName string
	// StopAll specifies if all sounds currently playing to the player should be stopped. If set to true, the
	// SoundName field may be left empty.
	StopAll bool
}

StopSound is sent by the server to stop a sound playing to the player, such as a playing music disk track or other long-lasting sounds.

func (*StopSound) ID

func (*StopSound) ID() uint32

ID ...

func (*StopSound) Marshal

func (pk *StopSound) Marshal(io protocol.IO)

type StructureBlockUpdate

type StructureBlockUpdate struct {
	// Position is the position of the structure block that is updated.
	Position protocol.BlockPos
	// StructureName is the name of the structure that was set in the structure block's UI. This is the name
	// used to export the structure to a file.
	StructureName string
	// DataField is the name of a function to run, usually used during natural generation. A description can
	// be found here: https://minecraft.gamepedia.com/Structure_Block#Data.
	DataField string
	// IncludePlayers specifies if the 'Include Players' toggle has been enabled, meaning players are also
	// exported by the structure block.
	IncludePlayers bool
	// ShowBoundingBox specifies if the structure block should have its bounds outlined. A thin line will
	// encapsulate the bounds of the structure if set to true.
	ShowBoundingBox bool
	// StructureBlockType is the type of the structure block updated. A list of structure block types that
	// will be used can be found in the constants above.
	StructureBlockType int32
	// Settings is a struct of settings that should be used for exporting the structure. These settings are
	// identical to the last sent in the StructureBlockUpdate packet by the client.
	Settings protocol.StructureSettings
	// RedstoneSaveMode is the mode that should be used to save the structure when used with redstone. In
	// Java Edition, this is always stored in memory, but in Bedrock Edition it can be stored either to disk
	// or memory. See the constants above for the options.
	RedstoneSaveMode int32
	// ShouldTrigger specifies if the structure block should be triggered immediately after this packet
	// reaches the server.
	ShouldTrigger bool
	// Waterlogged specifies if non-air blocks replace water or combine with water.
	Waterlogged bool
}

StructureBlockUpdate is sent by the client when it updates a structure block using the in-game UI. The data it contains depends on the type of structure block that it is. In Minecraft Bedrock Edition v1.11, there is only the Export structure block type, but in v1.13 the ones present in Java Edition will, according to the wiki, be added too.

func (*StructureBlockUpdate) ID

ID ...

func (*StructureBlockUpdate) Marshal

func (pk *StructureBlockUpdate) Marshal(io protocol.IO)

type StructureTemplateDataRequest

type StructureTemplateDataRequest struct {
	// StructureName is the name of the structure that was set in the structure block's UI. This is the name
	// used to export the structure to a file.
	StructureName string
	// Position is the position of the structure block that has its template data requested.
	Position protocol.BlockPos
	// Settings is a struct of settings that should be used for exporting the structure. These settings are
	// identical to the last sent in the StructureBlockUpdate packet by the client.
	Settings protocol.StructureSettings
	// RequestType specifies the type of template data request that the player sent. It is one of the
	// constants found above.
	RequestType byte
}

StructureTemplateDataRequest is sent by the client to request data of a structure.

func (*StructureTemplateDataRequest) ID

ID ...

func (*StructureTemplateDataRequest) Marshal

func (pk *StructureTemplateDataRequest) Marshal(io protocol.IO)

type StructureTemplateDataResponse

type StructureTemplateDataResponse struct {
	// StructureName is the name of the structure that was requested. This is the name used to export the
	// structure to a file.
	StructureName string
	// Success specifies if a structure template was found by the StructureName that was sent in a
	// StructureTemplateDataRequest packet.
	Success bool
	// ResponseType specifies the response type of the packet. This depends on the RequestType field sent in
	// the StructureTemplateDataRequest packet and is one of the constants above.
	ResponseType byte
	// StructureTemplate holds the data of the structure template.
	StructureTemplate map[string]any
}

StructureTemplateDataResponse is sent by the server to send data of a structure to the client in response to a StructureTemplateDataRequest packet.

func (*StructureTemplateDataResponse) ID

ID ...

func (*StructureTemplateDataResponse) Marshal

func (pk *StructureTemplateDataResponse) Marshal(io protocol.IO)

type SubChunk

type SubChunk struct {
	// CacheEnabled is whether the sub-chunk caching is enabled or not.
	CacheEnabled bool
	// Dimension is the dimension the sub-chunks are in.
	Dimension int32
	// Position is an absolute sub-chunk center point that every SubChunkRequest uses as a reference.
	Position protocol.SubChunkPos
	// SubChunkEntries contains sub-chunk entries relative to the center point.
	SubChunkEntries []protocol.SubChunkEntry
}

SubChunk sends data about multiple sub-chunks around a center point.

func (*SubChunk) ID

func (*SubChunk) ID() uint32

ID ...

func (*SubChunk) Marshal

func (pk *SubChunk) Marshal(io protocol.IO)

type SubChunkRequest

type SubChunkRequest struct {
	// Dimension is the dimension of the sub-chunk.
	Dimension int32
	// Position is an absolute sub-chunk center point used as a base point for all sub-chunks requested. The X and Z
	// coordinates represent the chunk coordinates, while the Y coordinate is the absolute sub-chunk index.
	Position protocol.SubChunkPos
	// Offsets contains all requested offsets around the center point.
	Offsets []protocol.SubChunkOffset
}

SubChunkRequest requests specific sub-chunks from the server using a center point.

func (*SubChunkRequest) ID

func (*SubChunkRequest) ID() uint32

ID ...

func (*SubChunkRequest) Marshal

func (pk *SubChunkRequest) Marshal(io protocol.IO)

type SubClientLogin

type SubClientLogin struct {
	// ConnectionRequest is a string containing information about the player and JWTs that may be used to
	// verify if the player is connected to XBOX Live. The connection request also contains the necessary
	// client public key to initiate encryption.
	// The ConnectionRequest in this packet is identical to the one found in the Login packet.
	ConnectionRequest []byte
}

SubClientLogin is sent when a sub-client joins the server while another client is already connected to it. The packet is sent as a result of split-screen game play, and allows up to four players to play using the same network connection. After an initial Login packet from the 'main' client, each sub-client that connects sends a SubClientLogin to request their own login.

func (*SubClientLogin) ID

func (*SubClientLogin) ID() uint32

ID ...

func (*SubClientLogin) Marshal

func (pk *SubClientLogin) Marshal(io protocol.IO)

type SyncActorProperty

type SyncActorProperty struct {
	// PropertyData ...
	PropertyData map[string]any
}

SyncActorProperty is an alternative to synced actor data.

func (*SyncActorProperty) ID

func (*SyncActorProperty) ID() uint32

ID ...

func (*SyncActorProperty) Marshal

func (pk *SyncActorProperty) Marshal(io protocol.IO)

type TakeItemActor

type TakeItemActor struct {
	// ItemEntityRuntimeID is the entity runtime ID of the item that is being taken by another entity. It will
	// disappear to viewers after showing the pick-up animation.
	ItemEntityRuntimeID uint64
	// TakerEntityRuntimeID is the runtime ID of the entity that took the item, which is usually a player, but
	// could be another entity like a zombie too.
	TakerEntityRuntimeID uint64
}

TakeItemActor is sent by the server when a player picks up an item entity. It makes the item entity disappear to viewers and shows the pick-up animation.

func (*TakeItemActor) ID

func (*TakeItemActor) ID() uint32

ID ...

func (*TakeItemActor) Marshal

func (pk *TakeItemActor) Marshal(io protocol.IO)

type Text

type Text struct {
	// TextType is the type of the text sent. When a client sends this to the server, it should always be
	// TextTypeChat. If the server sends it, it may be one of the other text types above.
	TextType byte
	// NeedsTranslation specifies if any of the messages need to be translated. It seems that where % is found
	// in translatable text types, these are translated regardless of this bool. Translatable text types
	// include TextTypeTranslation, TextTypeTip, TextTypePopup and TextTypeJukeboxPopup.
	NeedsTranslation bool
	// SourceName is the name of the source of the messages. This source is displayed in text types such as
	// the TextTypeChat and TextTypeWhisper, where typically the username is shown.
	SourceName string
	// Message is the message of the packet. This field is set for each TextType and is the main component of
	// the packet.
	Message string
	// Parameters is a list of parameters that should be filled into the message. These parameters are only
	// written if the type of the packet is TextTypeTranslation, TextTypeTip, TextTypePopup or TextTypeJukeboxPopup.
	Parameters []string
	// XUID is the XBOX Live user ID of the player that sent the message. It is only set for packets of
	// TextTypeChat. When sent to a player, the player will only be shown the chat message if a player with
	// this XUID is present in the player list and not muted, or if the XUID is empty.
	XUID string
	// PlatformChatID is an identifier only set for particular platforms when chatting (presumably only for
	// Nintendo Switch). It is otherwise an empty string, and is used to decide which players are able to
	// chat with each other.
	PlatformChatID string
}

Text is sent by the client to the server to send chat messages, and by the server to the client to forward or send messages, which may be chat, popups, tips etc.

func (*Text) ID

func (*Text) ID() uint32

ID ...

func (*Text) Marshal

func (pk *Text) Marshal(io protocol.IO)

type TickSync

type TickSync struct {
	// ClientRequestTimestamp is the timestamp on which the client sent this packet to the server. The server
	// should fill out that same value when replying.
	// The ClientRequestTimestamp is always 0.
	ClientRequestTimestamp int64
	// ServerReceptionTimestamp is the timestamp on which the server received the packet sent by the client.
	// When the packet is sent by the client, this value is 0.
	// ServerReceptionTimestamp is generally the current tick of the server. It isn't an actual timestamp, as
	// the field implies.
	ServerReceptionTimestamp int64
}

TickSync is sent by the client and the server to maintain a synchronized, server-authoritative tick between the client and the server. The client sends this packet first, and the server should reply with another one of these packets, including the response time.

func (*TickSync) ID

func (*TickSync) ID() uint32

ID ...

func (*TickSync) Marshal

func (pk *TickSync) Marshal(io protocol.IO)

type TickingAreasLoadStatus

type TickingAreasLoadStatus struct {
	// Preload is true if the server is waiting for the area's preload.
	Preload bool
}

TickingAreasLoadStatus is sent by the server to the client to notify the client of a ticking area's loading status.

func (*TickingAreasLoadStatus) ID

ID ...

func (*TickingAreasLoadStatus) Marshal

func (pk *TickingAreasLoadStatus) Marshal(io protocol.IO)

type ToastRequest

type ToastRequest struct {
	// Title is the title of the toast.
	Title string
	// Message is the message that the toast may contain alongside the title.
	Message string
}

ToastRequest is a packet sent from the server to the client to display a toast to the top of the screen. These toasts are the same as the ones seen when, for example, loading a new resource pack or obtaining an achievement.

func (*ToastRequest) ID

func (*ToastRequest) ID() uint32

ID ...

func (*ToastRequest) Marshal

func (pk *ToastRequest) Marshal(io protocol.IO)

type Transfer

type Transfer struct {
	// Address is the address of the new server, which might be either a hostname or an actual IP address.
	Address string
	// Port is the UDP port of the new server.
	Port uint16
}

Transfer is sent by the server to transfer a player from the current server to another. Doing so will fully disconnect the client, bring it back to the main menu and make it connect to the next server.

func (*Transfer) ID

func (*Transfer) ID() uint32

ID ...

func (*Transfer) Marshal

func (pk *Transfer) Marshal(io protocol.IO)

type TrimData

type TrimData struct {
	// Patterns is a list of patterns that can be applied to armour. Each pattern has its own style and texture that is
	// defined through resource packs.
	Patterns []protocol.TrimPattern
	// Materials is a list of materials that can be applied to armour. These are mostly different ores that have different
	// colours for more customization.
	Materials []protocol.TrimMaterial
}

TrimData is sent by the server to the client when they first join the server. It contains a list of all the patterns and materials that can be applied via armour trims.

func (*TrimData) ID

func (*TrimData) ID() uint32

ID ...

func (*TrimData) Marshal

func (pk *TrimData) Marshal(io protocol.IO)

type Unknown

type Unknown struct {
	// PacketID is the packet ID of the packet.
	PacketID uint32
	// Payload is the raw payload of the packet.
	Payload []byte
}

Unknown is an implementation of the Packet interface for unknown/unimplemented packets. It holds the packet ID and the raw payload. It serves as a way to read raw unknown packets and forward them to another connection, without necessarily implementing them.

func (*Unknown) ID

func (pk *Unknown) ID() uint32

ID ...

func (*Unknown) Marshal

func (pk *Unknown) Marshal(io protocol.IO)

func (*Unknown) String

func (pk *Unknown) String() string

String implements a hex representation of an unknown packet, so that it is easier to read and identify unknown incoming packets.

type UnlockedRecipes

type UnlockedRecipes struct {
	// UnlockType is the type of unlock that the packet represents, and can either be adding or removing a list of recipes.
	// It is one of the constants listed above.
	UnlockType uint32
	// Recipes is a list of recipe names that have been unlocked.
	Recipes []string
}

UnlockedRecipes gives the client a list of recipes that have been unlocked, restricting the recipes that appear in the recipe book.

func (*UnlockedRecipes) ID

func (*UnlockedRecipes) ID() uint32

ID ...

func (*UnlockedRecipes) Marshal

func (pk *UnlockedRecipes) Marshal(io protocol.IO)

type UpdateAbilities

type UpdateAbilities struct {
	// AbilityData represents various data about the abilities of a player, such as ability layers or permissions.
	AbilityData protocol.AbilityData
}

UpdateAbilities is a packet sent from the server to the client to update the abilities of the player. It, along with the UpdateAdventureSettings packet, are replacements of the AdventureSettings packet since v1.19.10.

func (*UpdateAbilities) ID

func (*UpdateAbilities) ID() uint32

ID ...

func (*UpdateAbilities) Marshal

func (pk *UpdateAbilities) Marshal(io protocol.IO)

type UpdateAdventureSettings

type UpdateAdventureSettings struct {
	// NoPvM is a boolean indicating whether the player is allowed to fight mobs or not.
	NoPvM bool
	// NoMvP is a boolean indicating whether mobs are allowed to fight the player or not. It is unclear why this is sent
	// to the client.
	NoMvP bool
	// ImmutableWorld is a boolean indicating whether the player is allowed to modify the world or not.
	ImmutableWorld bool
	// ShowNameTags is a boolean indicating whether player name tags are shown or not.
	ShowNameTags bool
	// AutoJump is a boolean indicating whether the player is allowed to jump automatically or not.
	AutoJump bool
}

UpdateAdventureSettings is a packet sent from the server to the client to update the adventure settings of the player. It, along with the UpdateAbilities packet, are replacements of the AdventureSettings packet since v1.19.10.

func (*UpdateAdventureSettings) ID

ID ...

func (*UpdateAdventureSettings) Marshal

func (pk *UpdateAdventureSettings) Marshal(io protocol.IO)

type UpdateAttributes

type UpdateAttributes struct {
	// EntityRuntimeID is the runtime ID of the entity. The runtime ID is unique for each world session, and
	// entities are generally identified in packets using this runtime ID.
	EntityRuntimeID uint64
	// Attributes is a slice of new attributes that the entity gets. It includes attributes such as its
	// health, movement speed, etc. Note that only changed attributes have to be sent in this packet. It is
	// not required to send attributes that did not have their values changed.
	Attributes []protocol.Attribute
	// Tick is the server tick at which the packet was sent. It is used in relation to CorrectPlayerMovePrediction.
	Tick uint64
}

UpdateAttributes is sent by the server to update an amount of attributes of any entity in the world. These attributes include ones such as the health or the movement speed of the entity.

func (*UpdateAttributes) ID

func (*UpdateAttributes) ID() uint32

ID ...

func (*UpdateAttributes) Marshal

func (pk *UpdateAttributes) Marshal(io protocol.IO)

type UpdateBlock

type UpdateBlock struct {
	// Position is the block position at which a block is updated.
	Position protocol.BlockPos
	// NewBlockRuntimeID is the runtime ID of the block that is placed at Position after sending the packet
	// to the client.
	NewBlockRuntimeID uint32
	// Flags is a combination of flags that specify the way the block is updated client-side. It is a
	// combination of the flags above, but typically sending only the BlockUpdateNetwork flag is sufficient.
	Flags uint32
	// Layer is the world layer on which the block is updated. For most blocks, this is the first layer, as
	// that layer is the default layer to place blocks on, but for blocks inside of each other, this differs.
	Layer uint32
}

UpdateBlock is sent by the server to update a block client-side, without resending the entire chunk that the block is located in. It is particularly useful for small modifications like block breaking/placing.

func (*UpdateBlock) ID

func (*UpdateBlock) ID() uint32

ID ...

func (*UpdateBlock) Marshal

func (pk *UpdateBlock) Marshal(io protocol.IO)

type UpdateBlockSynced

type UpdateBlockSynced struct {
	// Position is the block position at which a block is updated.
	Position protocol.BlockPos
	// NewBlockRuntimeID is the runtime ID of the block that is placed at Position after sending the packet
	// to the client.
	NewBlockRuntimeID uint32
	// Flags is a combination of flags that specify the way the block is updated client-side. It is a
	// combination of the flags above, but typically sending only the BlockUpdateNetwork flag is sufficient.
	Flags uint32
	// Layer is the world layer on which the block is updated. For most blocks, this is the first layer, as
	// that layer is the default layer to place blocks on, but for blocks inside of each other, this differs.
	Layer uint32
	// EntityUniqueID is the unique ID of the falling block entity that the block transitions to or that the
	// entity transitions from.
	// Note that for both possible values for TransitionType, the EntityUniqueID should point to the falling
	// block entity involved.
	EntityUniqueID int64
	// TransitionType is the type of the transition that happened. It is either BlockToEntityTransition, when
	// a block placed becomes a falling entity, or EntityToBlockTransition, when a falling entity hits the
	// ground and becomes a solid block again.
	TransitionType uint64
}

UpdateBlockSynced is sent by the server to synchronise the falling of a falling block entity with the transitioning back and forth from and to a solid block. It is used to prevent the entity from flickering, and is used in places such as the pushing of blocks with pistons.

func (*UpdateBlockSynced) ID

func (*UpdateBlockSynced) ID() uint32

ID ...

func (*UpdateBlockSynced) Marshal

func (pk *UpdateBlockSynced) Marshal(io protocol.IO)

type UpdateClientInputLocks

type UpdateClientInputLocks struct {
	// Locks is an encoded bitset of all locks that are currently active. The locks are defined in the constants above.
	Locks uint32
	// Position is the server's position of the client at the time the packet was sent. It is unclear what the exact
	// purpose of this field is.
	Position mgl32.Vec3
}

UpdateClientInputLocks is sent by the server to the client to lock certain inputs the client usually has, such as movement, jumping, sneaking, and more.

func (*UpdateClientInputLocks) ID

func (pk *UpdateClientInputLocks) ID() uint32

ID ...

func (*UpdateClientInputLocks) Marshal

func (pk *UpdateClientInputLocks) Marshal(io protocol.IO)

type UpdateEquip

type UpdateEquip struct {
	// WindowID is the identifier associated with the window that the UpdateEquip packet concerns. It is the
	// ID sent for the horse inventory that was opened before this packet was sent.
	WindowID byte
	// WindowType is the type of the window that was opened. Generally, this is the type of a horse inventory,
	// as the packet is specifically made for that.
	WindowType byte
	// Size is the size of the horse inventory that should be opened. A bigger size does, in fact, change the
	// amount of slots displayed.
	Size int32
	// EntityUniqueID is the unique ID of the entity whose equipment was 'updated' to the player. It is
	// typically the horse entity that had its inventory opened.
	EntityUniqueID int64
	// SerialisedInventoryData is a network NBT serialised compound holding the content of the inventory of
	// the entity (the equipment) and additional data such as the allowed items for a particular slot, used to
	// make sure only saddles can be put in the saddle slot etc.
	SerialisedInventoryData []byte
}

UpdateEquip is sent by the server to the client upon opening a horse inventory. It is used to set the content of the inventory and specify additional properties, such as the items that are allowed to be put in slots of the inventory.

func (*UpdateEquip) ID

func (*UpdateEquip) ID() uint32

ID ...

func (*UpdateEquip) Marshal

func (pk *UpdateEquip) Marshal(io protocol.IO)

type UpdatePlayerGameType

type UpdatePlayerGameType struct {
	// GameType is the new game type of the player. It is one of the constants that can be found in
	// set_player_game_type.go. Some of these game types require additional flags to be set in an
	// AdventureSettings packet for the game mode to obtain its full functionality.
	GameType int32
	// PlayerUniqueID is the entity unique ID of the player that should have its game mode updated. If this
	// packet is sent to other clients with the player unique ID of another player, nothing happens.
	PlayerUniqueID int64
}

UpdatePlayerGameType is sent by the server to change the game mode of a player. It is functionally identical to the SetPlayerGameType packet.

func (*UpdatePlayerGameType) ID

ID ...

func (*UpdatePlayerGameType) Marshal

func (pk *UpdatePlayerGameType) Marshal(io protocol.IO)

type UpdateSoftEnum

type UpdateSoftEnum struct {
	// EnumType is the type of the enum. This type must be identical to the one set in the AvailableCommands
	// packet, because the client uses this to recognise which enum to update.
	EnumType string
	// Options is a list of options that should be updated. Depending on the ActionType field, either these
	// options will be added to the enum, the enum options will be set to these options or all of these
	// options will be removed from the enum.
	Options []string
	// ActionType is the type of the action to execute on the enum. The Options field has a different result,
	// depending on what ActionType is used.
	ActionType byte
}

UpdateSoftEnum is sent by the server to update a soft enum, also known as a dynamic enum, previously sent in the AvailableCommands packet. It is sent whenever the enum should get new options or when some of its options should be removed. The UpdateSoftEnum packet will apply for enums that have been set in the AvailableCommands packet with the 'Dynamic' field of the CommandEnum set to true.

func (*UpdateSoftEnum) ID

func (*UpdateSoftEnum) ID() uint32

ID ...

func (*UpdateSoftEnum) Marshal

func (pk *UpdateSoftEnum) Marshal(io protocol.IO)

type UpdateSubChunkBlocks

type UpdateSubChunkBlocks struct {
	// Position is the position of the sub-chunk being referred to.
	Position protocol.SubChunkPos
	// Blocks contains each updated block change entry.
	Blocks []protocol.BlockChangeEntry
	// Extra contains each updated block change entry for the second layer, usually for waterlogged blocks.
	Extra []protocol.BlockChangeEntry
}

UpdateSubChunkBlocks is essentially just UpdateBlock packet, however for a set of blocks in a sub-chunk.

func (*UpdateSubChunkBlocks) ID

ID ...

func (*UpdateSubChunkBlocks) Marshal

func (pk *UpdateSubChunkBlocks) Marshal(io protocol.IO)

type UpdateTrade

type UpdateTrade struct {
	// WindowID is the ID that identifies the trading window that the client currently has opened.
	WindowID byte
	// WindowType is an identifier specifying the type of the window opened. In vanilla, it appears this is
	// always filled out with 15.
	WindowType byte
	// Size is the amount of trading options that the villager has.
	Size int32
	// TradeTier is the tier of the villager that the player is trading with. The tier starts at 0 with a
	// first two offers being available, after which two additional offers are unlocked each time the tier
	// becomes one higher.
	TradeTier int32
	// VillagerUniqueID is the unique ID of the villager entity that the player is trading with. The
	// TradeTier sent above applies to this villager.
	VillagerUniqueID int64
	// EntityUniqueID is the unique ID of the entity (usually a player) for which the trades are updated. The
	// updated trades may apply only to this entity.
	EntityUniqueID int64
	// DisplayName is the name displayed at the top of the trading UI. It is usually used to represent the
	// profession of the villager in the UI.
	DisplayName string
	// NewTradeUI specifies if the villager should be using the new trade UI (The one added in 1.11.) rather
	// than the old one. This should usually be set to true.
	NewTradeUI bool
	// DemandBasedPrices specifies if the prices of the villager's offers are modified by an increase in
	// demand for the item. (A mechanic added in 1.11.) Buying more of the same item will increase the price
	// of that particular item.
	DemandBasedPrices bool
	// SerialisedOffers is a network NBT serialised compound of offers that the villager has.
	SerialisedOffers []byte
}

UpdateTrade is sent by the server to update the trades offered by a villager to a player. It is sent at the moment that a player interacts with a villager.

func (*UpdateTrade) ID

func (*UpdateTrade) ID() uint32

ID ...

func (*UpdateTrade) Marshal

func (pk *UpdateTrade) Marshal(io protocol.IO)

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL