Documentation ¶
Overview ¶
Package protocol implements structures and functions used to write or read data related to the Minecraft Bedrock Edition protocol. The functions present in this package are generally used in the minecraft/protocol/packet library, where the encoding and decoding of packets may be found.
Index ¶
- Constants
- func CommandOriginData(r IO, x *CommandOrigin)
- func FuncIOSlice[T any, S ~*[]T](r IO, x S, f func(IO, *T))
- func FuncIOSliceOfLen[T any, S ~*[]T](r IO, l uint32, x S, f func(IO, *T))
- func FuncIOSliceUint32Length[T any, S ~*[]T](r IO, x S, f func(IO, *T))
- func FuncSlice[T any, S ~*[]T](r IO, x S, f func(*T))
- func FuncSliceOfLen[T any, S ~*[]T](r IO, l uint32, x S, f func(*T))
- func FuncSliceUint16Length[T any, S ~*[]T](r IO, x S, f func(*T))
- func FuncSliceUint32Length[T any, S ~*[]T](r IO, x S, f func(*T))
- func OptionalFunc[T any](r IO, x *Optional[T], f func(*T)) any
- func OptionalMarshaler[T any, A PtrMarshaler[T]](r IO, x *Optional[T])
- func PlayerListRemoveEntry(r IO, x *PlayerListEntry)
- func PlayerMoveSettings(r IO, x *PlayerMovementSettings)
- func ScoreRemoveEntry(r IO, x *ScoreboardEntry)
- func ScoreboardIdentityClearEntry(r IO, x *ScoreboardIdentityEntry)
- func Single[T any, S PtrMarshaler[T]](r IO, x S)
- func Slice[T any, S ~*[]T, A PtrMarshaler[T]](r IO, x S)
- func SliceOfLen[T any, S ~*[]T, A PtrMarshaler[T]](r IO, l uint32, x S)
- func SliceUint16Length[T any, S ~*[]T, A PtrMarshaler[T]](r IO, x S)
- func SliceUint32Length[T any, S ~*[]T, A PtrMarshaler[T]](r IO, x S)
- func SliceUint8Length[T any, S *[]T, A PtrMarshaler[T]](r IO, x S)
- func SliceVarint32Length[T any, S ~*[]T, A PtrMarshaler[T]](r IO, x S)
- func StackReqSlotInfo(r IO, x *StackRequestSlotInfo)
- func SubChunkEntryNoCache(r IO, x *SubChunkEntry)
- func Varint32(src io.ByteReader, x *int32) error
- func Varint64(src io.ByteReader, x *int64) error
- func Varuint32(src io.ByteReader, x *uint32) error
- func Varuint64(src io.ByteReader, x *uint64) error
- func WriteVarint32(dst io.ByteWriter, x int32) error
- func WriteVarint64(dst io.ByteWriter, x int64) error
- func WriteVaruint32(dst io.ByteWriter, x uint32) error
- func WriteVaruint64(dst io.ByteWriter, x uint64) error
- type AbilityData
- type AbilityLayer
- type AchievementAwardedEvent
- type AgentCommandEvent
- type Attribute
- type AttributeModifier
- type AttributeValue
- type AutoCraftRecipeStackRequestAction
- type BeaconPaymentStackRequestAction
- type BehaviourPackInfo
- type BellUsedEvent
- type BlockChangeEntry
- type BlockEntry
- type BlockPos
- type BossKilledEvent
- type CacheBlob
- type CauldronInteractEvent
- type CauldronUsedEvent
- type ChunkPos
- type Command
- type CommandEnum
- type CommandEnumConstraint
- type CommandEnumContext
- type CommandOrigin
- type CommandOutputMessage
- type CommandOverload
- type CommandParameter
- type ComplexAliasItemDescriptor
- type ComposterInteractEvent
- type ConsumeStackRequestAction
- type CraftCreativeStackRequestAction
- type CraftGrindstoneRecipeStackRequestAction
- type CraftLoomRecipeStackRequestAction
- type CraftNonImplementedStackRequestAction
- type CraftRecipeOptionalStackRequestAction
- type CraftRecipeStackRequestAction
- type CraftResultsDeprecatedStackRequestAction
- type CreateStackRequestAction
- type CreativeItem
- type DefaultItemDescriptor
- type DeferredItemDescriptor
- type DestroyStackRequestAction
- type DeviceOS
- type DimensionDefinition
- type DropStackRequestAction
- type DynamicEnum
- type EducationExternalLinkSettings
- type EducationSharedResourceURI
- type EnchantmentInstance
- type EnchantmentOption
- type EntityDefinitionTriggerEvent
- type EntityInteractEvent
- type EntityLink
- type EntityMetadata
- type EntityProperties
- type Event
- type ExperimentData
- type ExtractHoneyEvent
- type FishBucketedEvent
- type FloatEntityProperty
- type FurnaceDataRecipe
- type FurnaceRecipe
- type GameRule
- type GenerationFeature
- type IO
- type IntegerEntityProperty
- type InvalidItemDescriptor
- type InventoryAction
- type InventoryTransactionData
- type ItemComponentEntry
- type ItemDescriptor
- type ItemDescriptorCount
- type ItemEnchantments
- type ItemEntry
- type ItemInstance
- type ItemStack
- type ItemStackRequest
- type ItemStackResponse
- type ItemTagItemDescriptor
- type ItemType
- type LabTableCombineStackRequestAction
- type LegacySetItemSlot
- type MapDecoration
- type MapTrackedObject
- type Marshaler
- type MaterialReducer
- type MaterialReducerOutput
- type MineBlockStackRequestAction
- type MismatchTransactionData
- type MoLangItemDescriptor
- type MobBornEvent
- type MobKilledEvent
- type MovementAnomalyEvent
- type MovementCorrectedEvent
- type MultiRecipe
- type NormalTransactionData
- type Optional
- type PatternRemovedEvent
- type PersonaPiece
- type PersonaPieceTintColour
- type PetDiedEvent
- type PixelRequest
- type PlaceInContainerStackRequestAction
- type PlaceStackRequestAction
- type PlayerBlockAction
- type PlayerDiedEvent
- type PlayerListEntry
- type PlayerMovementSettings
- type PortalBuiltEvent
- type PortalUsedEvent
- type PotionContainerChangeRecipe
- type PotionRecipe
- type PtrMarshaler
- type RaidUpdateEvent
- type Reader
- func (r *Reader) AbilityValue(x *any)
- func (r *Reader) BEInt32(x *int32)
- func (r *Reader) BlockPos(x *BlockPos)
- func (r *Reader) Bool(x *bool)
- func (r *Reader) ByteFloat(x *float32)
- func (r *Reader) ByteSlice(x *[]byte)
- func (r *Reader) Bytes(p *[]byte)
- func (r *Reader) ChunkPos(x *ChunkPos)
- func (r *Reader) CompressedBiomeDefinitions(x *map[string]any)
- func (r *Reader) EntityMetadata(x *map[uint32]any)
- func (r *Reader) EventType(x *Event)
- func (r *Reader) Float32(x *float32)
- func (r *Reader) GameRule(x *GameRule)
- func (r *Reader) Int16(x *int16)
- func (r *Reader) Int32(x *int32)
- func (r *Reader) Int64(x *int64)
- func (r *Reader) Int8(x *int8)
- func (r *Reader) InvalidValue(value any, forField, reason string)
- func (r *Reader) Item(x *ItemStack)
- func (r *Reader) ItemDescriptorCount(i *ItemDescriptorCount)
- func (r *Reader) ItemInstance(i *ItemInstance)
- func (r *Reader) LimitInt32(value int32, min, max int32)
- func (r *Reader) LimitUint32(value uint32, max uint32)
- func (r *Reader) MaterialReducer(m *MaterialReducer)
- func (r *Reader) NBT(m *map[string]any, encoding nbt.Encoding)
- func (r *Reader) NBTList(m *[]any, encoding nbt.Encoding)
- func (r *Reader) PlayerInventoryAction(x *UseItemTransactionData)
- func (r *Reader) RGBA(x *color.RGBA)
- func (r *Reader) Recipe(x *Recipe)
- func (r *Reader) ShieldID() int32
- func (r *Reader) SoundPos(x *mgl32.Vec3)
- func (r *Reader) StackRequestAction(x *StackRequestAction)
- func (r *Reader) String(x *string)
- func (r *Reader) StringUTF(x *string)
- func (r *Reader) SubChunkPos(x *SubChunkPos)
- func (r *Reader) TransactionDataType(x *InventoryTransactionData)
- func (r *Reader) UBlockPos(x *BlockPos)
- func (r *Reader) UUID(x *uuid.UUID)
- func (r *Reader) Uint16(x *uint16)
- func (r *Reader) Uint32(x *uint32)
- func (r *Reader) Uint64(x *uint64)
- func (r *Reader) Uint8(x *uint8)
- func (r *Reader) UnknownEnumOption(value any, enum string)
- func (r *Reader) VarRGBA(x *color.RGBA)
- func (r *Reader) Varint32(x *int32)
- func (r *Reader) Varint64(x *int64)
- func (r *Reader) Varuint32(x *uint32)
- func (r *Reader) Varuint64(x *uint64)
- func (r *Reader) Vec2(x *mgl32.Vec2)
- func (r *Reader) Vec3(x *mgl32.Vec3)
- type Recipe
- type ReleaseItemTransactionData
- type ScoreboardEntry
- type ScoreboardIdentityEntry
- type ShapedChemistryRecipe
- type ShapedRecipe
- type ShapelessChemistryRecipe
- type ShapelessRecipe
- type ShulkerBoxRecipe
- type Skin
- type SkinAnimation
- type SlashCommandExecutedEvent
- type SmithingTransformRecipe
- type SmithingTrimRecipe
- type SneakCloseToSculkSensorEvent
- type StackRequestAction
- type StackRequestSlotInfo
- type StackResourcePack
- type StackResponseContainerInfo
- type StackResponseSlotInfo
- type StructureSettings
- type SubChunkEntry
- type SubChunkOffset
- type SubChunkPos
- type SwapStackRequestAction
- type TakeOutContainerStackRequestAction
- type TakeStackRequestAction
- type TexturePackInfo
- type TrimMaterial
- type TrimPattern
- type UseItemOnEntityTransactionData
- type UseItemTransactionData
- type WaxedOrUnwaxedCopperEvent
- type Writer
- func (w *Writer) AbilityValue(x *any)
- func (w *Writer) BEInt32(x *int32)
- func (w *Writer) BlockPos(x *BlockPos)
- func (w *Writer) Bool(x *bool)
- func (w *Writer) ByteFloat(x *float32)
- func (w *Writer) ByteSlice(x *[]byte)
- func (w *Writer) Bytes(x *[]byte)
- func (w *Writer) ChunkPos(x *ChunkPos)
- func (w *Writer) CompressedBiomeDefinitions(x *map[string]any)
- func (w *Writer) EntityMetadata(x *map[uint32]any)
- func (w *Writer) EventType(x *Event)
- func (w *Writer) Float32(x *float32)
- func (w *Writer) GameRule(x *GameRule)
- func (w *Writer) Int16(x *int16)
- func (w *Writer) Int32(x *int32)
- func (w *Writer) Int64(x *int64)
- func (w *Writer) Int8(x *int8)
- func (w *Writer) InvalidValue(value any, forField, reason string)
- func (w *Writer) Item(x *ItemStack)
- func (w *Writer) ItemDescriptorCount(i *ItemDescriptorCount)
- func (w *Writer) ItemInstance(i *ItemInstance)
- func (w *Writer) MaterialReducer(m *MaterialReducer)
- func (w *Writer) NBT(x *map[string]any, encoding nbt.Encoding)
- func (w *Writer) NBTList(x *[]any, encoding nbt.Encoding)
- func (w *Writer) PlayerInventoryAction(x *UseItemTransactionData)
- func (w *Writer) RGBA(x *color.RGBA)
- func (w *Writer) Recipe(x *Recipe)
- func (w *Writer) ShieldID() int32
- func (w *Writer) SoundPos(x *mgl32.Vec3)
- func (w *Writer) StackRequestAction(x *StackRequestAction)
- func (w *Writer) String(x *string)
- func (w *Writer) StringUTF(x *string)
- func (w *Writer) SubChunkPos(x *SubChunkPos)
- func (w *Writer) TransactionDataType(x *InventoryTransactionData)
- func (w *Writer) UBlockPos(x *BlockPos)
- func (w *Writer) UUID(x *uuid.UUID)
- func (w *Writer) Uint16(x *uint16)
- func (w *Writer) Uint32(x *uint32)
- func (w *Writer) Uint64(x *uint64)
- func (w *Writer) Uint8(x *uint8)
- func (w *Writer) UnknownEnumOption(value any, enum string)
- func (w *Writer) VarRGBA(x *color.RGBA)
- func (w *Writer) Varint32(x *int32)
- func (w *Writer) Varint64(x *int64)
- func (w *Writer) Varuint32(x *uint32)
- func (w *Writer) Varuint64(x *uint64)
- func (w *Writer) Vec2(x *mgl32.Vec2)
- func (w *Writer) Vec3(x *mgl32.Vec3)
Constants ¶
const ( AbilityBuild = 1 << iota AbilityMine AbilityDoorsAndSwitches AbilityOpenContainers AbilityAttackPlayers AbilityAttackMobs AbilityOperatorCommands AbilityTeleport AbilityInvulnerable AbilityFlying AbilityMayFly AbilityInstantBuild AbilityLightning AbilityFlySpeed AbilityWalkSpeed AbilityMuted AbilityWorldBuilder AbilityNoClip AbilityPrivilegedBuilder AbilityCount )
const ( AbilityLayerTypeCustomCache = iota AbilityLayerTypeBase AbilityLayerTypeSpectator AbilityLayerTypeCommands AbilityLayerTypeEditor )
const ( AbilityBaseFlySpeed = 0.05 AbilityBaseWalkSpeed = 0.1 )
const ( AttributeModifierOperationAddition = iota AttributeModifierOperationMultiplyBase AttributeModifierOperationMultiplyTotal AttributeModifierOperationCap )
const ( AttributeModifierOperandMin = iota AttributeModifierOperandMax AttributeModifierOperandCurrent )
const ( CommandArgValid = 0x100000 CommandArgEnum = 0x200000 CommandArgSuffixed = 0x1000000 CommandArgSoftEnum = 0x4000000 CommandArgTypeInt = 1 CommandArgTypeFloat = 3 CommandArgTypeValue = 4 CommandArgTypeWildcardInt = 5 CommandArgTypeOperator = 6 CommandArgTypeCompareOperator = 7 CommandArgTypeTarget = 8 CommandArgTypeWildcardTarget = 10 CommandArgTypeFilepath = 17 CommandArgTypeIntegerRange = 23 CommandArgTypeEquipmentSlots = 43 CommandArgTypeString = 44 CommandArgTypeBlockPosition = 52 CommandArgTypePosition = 53 CommandArgTypeMessage = 55 CommandArgTypeRawText = 58 CommandArgTypeJSON = 62 CommandArgTypeBlockStates = 71 CommandArgTypeCommand = 74 )
const ( // ParamOptionCollapseEnum specifies if the enum (only if the Type is actually an enum type. If not, // setting this to true has no effect) should be collapsed. This means that the options of the enum are // never shown in the actual usage of the command, but only as auto-completion, like it automatically does // with enums that have a big amount of options. To illustrate, it can make // <false|true|yes|no> <$Name: bool>. ParamOptionCollapseEnum = iota + 1 ParamOptionHasSemanticConstraint ParamOptionAsChainedCommand )
const ( CommandEnumConstraintCheatsEnabled = iota CommandEnumConstraintOperatorPermissions CommandEnumConstraintHostPermissions )
const ( CommandOriginPlayer = iota CommandOriginBlock CommandOriginMinecartBlock CommandOriginDevConsole CommandOriginTest CommandOriginAutomationPlayer CommandOriginClientAutomation CommandOriginDedicatedServer CommandOriginEntity CommandOriginVirtual CommandOriginGameArgument CommandOriginEntityServer CommandOriginPrecompiled CommandOriginGameDirectorEntityServer CommandOriginScript CommandOriginExecutor )
const ( ContainerAnvilInput = iota ContainerAnvilMaterial ContainerAnvilResultPreview ContainerSmithingTableInput ContainerSmithingTableMaterial ContainerSmithingTableResultPreview ContainerArmor ContainerLevelEntity ContainerBeaconPayment ContainerBrewingStandInput ContainerBrewingStandResult ContainerBrewingStandFuel ContainerCombinedHotBarAndInventory ContainerCraftingInput ContainerCraftingOutputPreview ContainerRecipeConstruction ContainerRecipeNature ContainerRecipeItems ContainerRecipeSearch ContainerRecipeSearchBar ContainerRecipeEquipment ContainerRecipeBook ContainerEnchantingInput ContainerEnchantingMaterial ContainerFurnaceFuel ContainerFurnaceIngredient ContainerFurnaceResult ContainerHorseEquip ContainerHotBar ContainerInventory ContainerShulkerBox ContainerTradeIngredientOne ContainerTradeIngredientTwo ContainerTradeResultPreview ContainerOffhand ContainerCompoundCreatorInput ContainerCompoundCreatorOutputPreview ContainerElementConstructorOutputPreview ContainerMaterialReducerInput ContainerMaterialReducerOutput ContainerLabTableInput ContainerLoomInput ContainerLoomDye ContainerLoomMaterial ContainerLoomResultPreview ContainerBlastFurnaceIngredient ContainerSmokerIngredient ContainerTradeTwoIngredientOne ContainerTradeTwoIngredientTwo ContainerTradeTwoResultPreview ContainerGrindstoneInput ContainerGrindstoneAdditional ContainerGrindstoneResultPreview ContainerStonecutterInput ContainerStonecutterResultPreview ContainerCartographyInput ContainerCartographyAdditional ContainerCartographyResultPreview ContainerBarrel ContainerCursor ContainerCreatedOutput ContainerSmithingTableTemplate )
const ( ContainerTypeInventory = iota - 1 ContainerTypeContainer ContainerTypeWorkbench ContainerTypeFurnace ContainerTypeEnchantment ContainerTypeBrewingStand ContainerTypeAnvil ContainerTypeDispenser ContainerTypeDropper ContainerTypeHopper ContainerTypeCauldron ContainerTypeCartChest ContainerTypeCartHopper ContainerTypeHorse ContainerTypeBeacon ContainerTypeStructureEditor ContainerTypeTrade ContainerTypeCommandBlock ContainerTypeJukebox ContainerTypeArmour ContainerTypeHand ContainerTypeCompoundCreator ContainerTypeElementConstructor ContainerTypeMaterialReducer ContainerTypeLabTable ContainerTypeLoom ContainerTypeLectern ContainerTypeGrindstone ContainerTypeBlastFurnace ContainerTypeSmoker ContainerTypeStonecutter ContainerTypeCartography ContainerTypeHUD ContainerTypeJigsawEditor ContainerTypeSmithingTable ContainerTypeChestBoat )
const ( // EntityLinkRemove is set to remove the link between two entities. EntityLinkRemove = iota // EntityLinkRider is set for entities that have control over the entity they're riding, such as in a // minecart. EntityLinkRider // EntityLinkPassenger is set for entities being a passenger of a vehicle they enter, such as the back // sit of a boat. EntityLinkPassenger )
const ( EntityDataKeyFlags = iota EntityDataKeyStructuralIntegrity EntityDataKeyVariant EntityDataKeyColorIndex EntityDataKeyName EntityDataKeyOwner EntityDataKeyTarget EntityDataKeyAirSupply EntityDataKeyEffectColor EntityDataKeyEffectAmbience EntityDataKeyJumpDuration EntityDataKeyHurt EntityDataKeyHurtDirection EntityDataKeyRowTimeLeft EntityDataKeyRowTimeRight EntityDataKeyValue EntityDataKeyDisplayTileRuntimeID EntityDataKeyDisplayOffset EntityDataKeyCustomDisplay EntityDataKeySwell EntityDataKeyOldSwell EntityDataKeySwellDirection EntityDataKeyChargeAmount EntityDataKeyCarryBlockRuntimeID EntityDataKeyClientEvent EntityDataKeyUsingItem EntityDataKeyPlayerFlags EntityDataKeyPlayerIndex EntityDataKeyBedPosition EntityDataKeyPowerX EntityDataKeyPowerY EntityDataKeyPowerZ EntityDataKeyAuxPower EntityDataKeyFishX EntityDataKeyFishZ EntityDataKeyFishAngle EntityDataKeyAuxValueData EntityDataKeyLeashHolder EntityDataKeyScale EntityDataKeyHasNPC EntityDataKeyNPCData EntityDataKeyActions EntityDataKeyAirSupplyMax EntityDataKeyMarkVariant EntityDataKeyContainerType EntityDataKeyContainerSize EntityDataKeyContainerStrengthModifier EntityDataKeyBlockTarget EntityDataKeyInventory EntityDataKeyTargetA EntityDataKeyTargetB EntityDataKeyTargetC EntityDataKeyAerialAttack EntityDataKeyWidth EntityDataKeyHeight EntityDataKeyFuseTime EntityDataKeySeatOffset EntityDataKeySeatLockPassengerRotation EntityDataKeySeatLockPassengerRotationDegrees EntityDataKeySeatRotationOffset EntityDataKeySeatRotationOffstDegrees EntityDataKeyDataRadius EntityDataKeyDataWaiting EntityDataKeyDataParticle EntityDataKeyPeekID EntityDataKeyAttachFace EntityDataKeyAttached EntityDataKeyAttachedPosition EntityDataKeyTradeTarget EntityDataKeyCareer EntityDataKeyHasCommandBlock EntityDataKeyCommandName EntityDataKeyLastCommandOutput EntityDataKeyTrackCommandOutput EntityDataKeyControllingSeatIndex EntityDataKeyStrength EntityDataKeyStrengthMax EntityDataKeyDataSpellCastingColor EntityDataKeyDataLifetimeTicks EntityDataKeyPoseIndex EntityDataKeyDataTickOffset EntityDataKeyAlwaysShowNameTag EntityDataKeyColorTwoIndex EntityDataKeyNameAuthor EntityDataKeyScore EntityDataKeyBalloonAnchor EntityDataKeyPuffedState EntityDataKeyBubbleTime EntityDataKeyAgent EntityDataKeySittingAmount EntityDataKeySittingAmountPrevious EntityDataKeyEatingCounter EntityDataKeyFlagsTwo EntityDataKeyLayingAmount EntityDataKeyLayingAmountPrevious EntityDataKeyDataDuration EntityDataKeyDataSpawnTime EntityDataKeyDataChangeRate EntityDataKeyDataChangeOnPickup EntityDataKeyDataPickupCount EntityDataKeyInteractText EntityDataKeyTradeTier EntityDataKeyMaxTradeTier EntityDataKeyTradeExperience EntityDataKeySkinID EntityDataKeySpawningFrames EntityDataKeyCommandBlockTickDelay EntityDataKeyCommandBlockExecuteOnFirstTick EntityDataKeyAmbientSoundInterval EntityDataKeyAmbientSoundIntervalRange EntityDataKeyAmbientSoundEventName EntityDataKeyFallDamageMultiplier EntityDataKeyNameRawText EntityDataKeyCanRideTarget EntityDataKeyLowTierCuredTradeDiscount EntityDataKeyHighTierCuredTradeDiscount EntityDataKeyNearbyCuredTradeDiscount EntityDataKeyNearbyCuredDiscountTimeStamp EntityDataKeyHitBox EntityDataKeyIsBuoyant EntityDataKeyFreezingEffectStrength EntityDataKeyBuoyancyData EntityDataKeyGoatHornCount EntityDataKeyBaseRuntimeID EntityDataKeyMovementSoundDistanceOffset EntityDataKeyHeartbeatIntervalTicks EntityDataKeyHeartbeatSoundEvent EntityDataKeyPlayerLastDeathPosition EntityDataKeyPlayerLastDeathDimension EntityDataKeyPlayerHasDied )
const ( EntityDataFlagOnFire = iota EntityDataFlagSneaking EntityDataFlagRiding EntityDataFlagSprinting EntityDataFlagUsingItem EntityDataFlagInvisible EntityDataFlagTempted EntityDataFlagInLove EntityDataFlagSaddled EntityDataFlagPowered EntityDataFlagIgnited EntityDataFlagBaby EntityDataFlagConverting EntityDataFlagCritical EntityDataFlagShowName EntityDataFlagAlwaysShowName EntityDataFlagNoAI EntityDataFlagSilent EntityDataFlagWallClimbing EntityDataFlagClimb EntityDataFlagSwim EntityDataFlagFly EntityDataFlagWalk EntityDataFlagResting EntityDataFlagSitting EntityDataFlagAngry EntityDataFlagInterested EntityDataFlagCharged EntityDataFlagTamed EntityDataFlagOrphaned EntityDataFlagLeashed EntityDataFlagSheared EntityDataFlagGliding EntityDataFlagElder EntityDataFlagMoving EntityDataFlagBreathing EntityDataFlagChested EntityDataFlagStackable EntityDataFlagShowBottom EntityDataFlagStanding EntityDataFlagShaking EntityDataFlagIdling EntityDataFlagCasting EntityDataFlagCharging EntityDataFlagKeyboardControlled EntityDataFlagPowerJump EntityDataFlagDash EntityDataFlagLingering EntityDataFlagHasCollision EntityDataFlagHasGravity EntityDataFlagFireImmune EntityDataFlagDancing EntityDataFlagEnchanted EntityDataFlagReturnTrident EntityDataFlagContainerPrivate EntityDataFlagTransforming EntityDataFlagDamageNearbyMobs EntityDataFlagSwimming EntityDataFlagBribed EntityDataFlagPregnant EntityDataFlagLayingEgg EntityDataFlagPassengerCanPick EntityDataFlagTransitionSitting EntityDataFlagEating EntityDataFlagLayingDown EntityDataFlagSneezing EntityDataFlagTrusting EntityDataFlagRolling EntityDataFlagScared EntityDataFlagInScaffolding EntityDataFlagOverScaffolding EntityDataFlagDescendThroughBlock EntityDataFlagBlocking EntityDataFlagTransitionBlocking EntityDataFlagBlockedUsingShield EntityDataFlagBlockedUsingDamagedShield EntityDataFlagSleeping EntityDataFlagWantsToWake EntityDataFlagTradeInterest EntityDataFlagDoorBreaker EntityDataFlagBreakingObstruction EntityDataFlagDoorOpener EntityDataFlagCaptain EntityDataFlagStunned EntityDataFlagRoaring EntityDataFlagDelayedAttack EntityDataFlagAvoidingMobs EntityDataFlagAvoidingBlock EntityDataFlagFacingTargetToRangeAttack EntityDataFlagHiddenWhenInvisible EntityDataFlagInUI EntityDataFlagStalking EntityDataFlagEmoting EntityDataFlagCelebrating EntityDataFlagAdmiring EntityDataFlagCelebratingSpecial EntityDataFlagOutOfControl EntityDataFlagRamAttack EntityDataFlagPlayingDead EntityDataFlagInAscendingBlock EntityDataFlagOverDescendingBlock EntityDataFlagCroaking EntityDataFlagDigestMob EntityDataFlagJumpGoal EntityDataFlagEmerging EntityDataFlagSniffing EntityDataFlagDigging EntityDataFlagSonicBoom EntityDataFlagHasDashTimeout EntityDataFlagPushTowardsClosestSpace EntityDataFlagScenting EntityDataFlagRising EntityDataFlagFeelingHappy EntityDataFlagSearching )
const ( EntityDataTypeByte uint32 = iota EntityDataTypeInt16 EntityDataTypeInt32 EntityDataTypeFloat32 EntityDataTypeString EntityDataTypeCompoundTag EntityDataTypeBlockPos EntityDataTypeInt64 EntityDataTypeVec3 )
const ( EventTypeAchievementAwarded = iota EventTypeEntityInteract EventTypePortalBuilt EventTypePortalUsed EventTypeMobKilled EventTypeCauldronUsed EventTypePlayerDied EventTypeBossKilled EventTypeAgentCommand EventTypeAgentCreated // Unused for whatever reason? EventTypePatternRemoved EventTypeSlashCommandExecuted EventTypeFishBucketed EventTypeMobBorn EventTypePetDied EventTypeCauldronInteract EventTypeComposterInteract EventTypeBellUsed EventTypeEntityDefinitionTrigger EventTypeRaidUpdate EventTypeMovementAnomaly EventTypeMovementCorrected EventTypeExtractHoney EventTypeTargetBlockHit EventTypePiglinBarter EventTypePlayerWaxedOrUnwaxedCopper EventTypeCodeBuilderRuntimeAction EventTypeCodeBuilderScoreboard EventTypeStriderRiddenInLavaInOverworld EventTypeSneakCloseToSculkSensor EventTypeCarefulRestoration )
TODO: Support the last seven new events.
const ( WaxNotOxidised = uint16(0xa609) WaxExposed = uint16(0xa809) WaxWeathered = uint16(0xaa09) WaxOxidised = uint16(0xac09) UnWaxNotOxidised = uint16(0xae09) UnWaxExposed = uint16(0xb009) UnWaxWeathered = uint16(0xb209) UnWaxOxidised = uint16(0xfa0a) )
const ( // CurrentProtocol is the current protocol version for the version below. CurrentProtocol = 589 // CurrentVersion is the current version of Minecraft as supported by the `packet` package. CurrentVersion = "1.20.0" )
const ( InventoryActionSourceContainer = 0 InventoryActionSourceWorld = 2 InventoryActionSourceCreative = 3 InventoryActionSourceTODO = 99999 )
const ( WindowIDInventory = 0 WindowIDOffHand = 119 WindowIDArmour = 120 WindowIDUI = 124 )
const ( InventoryTransactionTypeNormal = iota InventoryTransactionTypeMismatch InventoryTransactionTypeUseItem InventoryTransactionTypeUseItemOnEntity InventoryTransactionTypeReleaseItem )
const ( UseItemActionClickBlock = iota UseItemActionClickAir UseItemActionBreakBlock )
const ( UseItemOnEntityActionInteract = iota UseItemOnEntityActionAttack )
const ( ReleaseItemActionRelease = iota ReleaseItemActionConsume )
const ( ItemDescriptorInvalid = iota ItemDescriptorDefault ItemDescriptorMoLang ItemDescriptorItemTag ItemDescriptorDeferred ItemDescriptorComplexAlias )
const ( FilterCauseServerChatPublic = iota FilterCauseServerChatWhisper FilterCauseSignText FilterCauseAnvilText FilterCauseBookAndQuillText FilterCauseCommandBlockText FilterCauseBlockActorDataText FilterCauseJoinEventText FilterCauseLeaveEventText FilterCauseSlashCommandChat FilterCauseCartographyText FilterCauseKickCommand FilterCauseTitleCommand FilterCauseSummonCommand )
const ( ItemStackResponseStatusOK = iota ItemStackResponseStatusError )
const ( StackRequestActionTake = iota StackRequestActionPlace StackRequestActionSwap StackRequestActionDrop StackRequestActionDestroy StackRequestActionConsume StackRequestActionCreate StackRequestActionPlaceInContainer StackRequestActionTakeOutContainer StackRequestActionLabTableCombine StackRequestActionBeaconPayment StackRequestActionMineBlock StackRequestActionCraftRecipe StackRequestActionCraftRecipeAuto StackRequestActionCraftCreative StackRequestActionCraftRecipeOptional StackRequestActionCraftGrindstone StackRequestActionCraftLoom StackRequestActionCraftNonImplementedDeprecated StackRequestActionCraftResultsDeprecated )
const ( MapObjectTypeEntity = iota MapObjectTypeBlock )
const ( PlayerActionStartBreak = iota PlayerActionAbortBreak PlayerActionStopBreak PlayerActionGetUpdatedBlock PlayerActionDropItem PlayerActionStartSleeping PlayerActionStopSleeping PlayerActionRespawn PlayerActionJump PlayerActionStartSprint PlayerActionStopSprint PlayerActionStartSneak PlayerActionStopSneak PlayerActionCreativePlayerDestroyBlock PlayerActionDimensionChangeDone PlayerActionStartGlide PlayerActionStopGlide PlayerActionBuildDenied PlayerActionCrackBreak PlayerActionChangeSkin PlayerActionSetEnchantmentSeed PlayerActionStartSwimming PlayerActionStopSwimming PlayerActionStartSpinAttack PlayerActionStopSpinAttack PlayerActionStartBuildingBlock PlayerActionPredictDestroyBlock PlayerActionContinueDestroyBlock PlayerActionStartItemUseOn PlayerActionStopItemUseOn PlayerActionHandledTeleport )
const ( PlayerMovementModeClient = iota PlayerMovementModeServer PlayerMovementModeServerWithRewind )
const ( RecipeShapeless int32 = iota RecipeShaped RecipeFurnace RecipeFurnaceData RecipeMulti RecipeShulkerBox RecipeShapelessChemistry RecipeShapedChemistry RecipeSmithingTransform RecipeSmithingTrim )
const ( ScoreboardIdentityPlayer = iota + 1 ScoreboardIdentityEntity ScoreboardIdentityFakePlayer )
const ( SkinAnimationHead = iota + 1 SkinAnimationBody32x32 SkinAnimationBody128x128 ExpressionTypeLinear = iota ExpressionTypeBlinking )
const ( StructureMirrorNone = iota StructureMirrorXAxis StructureMirrorZAxis StructureMirrorBothAxes )
const ( StructureRotationNone = iota StructureRotationRotate90 StructureRotationRotate180 StructureRotationRotate270 )
const ( AnimationModeNone = iota AnimationModeLayers AnimationModeBlocks )
const ( HeightMapDataNone = iota HeightMapDataHasData HeightMapDataTooHigh HeightMapDataTooLow )
const ( SubChunkRequestModeLimitless = math.MaxUint32 - iota SubChunkRequestModeLimited )
const ( SubChunkResultSuccess = iota + 1 SubChunkResultChunkNotFound SubChunkResultInvalidDimension SubChunkResultPlayerNotFound SubChunkResultIndexOutOfBounds SubChunkResultSuccessAllAir )
const ( GeneratorLegacy = 0 GeneratorOverworld = 1 GeneratorFlat = 2 GeneratorNether = 3 GeneratorEnd = 4 GeneratorVoid = 5 )
Variables ¶
This section is empty.
Functions ¶
func CommandOriginData ¶
func CommandOriginData(r IO, x *CommandOrigin)
CommandOriginData reads/writes a CommandOrigin x using IO r.
func FuncIOSlice ¶
FuncIOSlice reads/writes a slice of T using a function f with a varuint32 length prefix.
func FuncIOSliceOfLen ¶
FuncIOSliceOfLen reads/writes the elements of a slice of type T with length l using func f.
func FuncIOSliceUint32Length ¶
FuncIOSliceUint32Length reads/writes a slice of T using a function with a uint32 length prefix.
func FuncSlice ¶
FuncSlice reads/writes a slice of T using function f with a varuint32 length prefix.
func FuncSliceOfLen ¶
FuncSliceOfLen reads/writes the elements of a slice of type T with length l using func f.
func FuncSliceUint16Length ¶
FuncSliceUint16Length reads/writes a slice of T using function f with a uint16 length prefix.
func FuncSliceUint32Length ¶
FuncSliceUint32Length reads/writes a slice of T using function f with a uint32 length prefix.
func OptionalFunc ¶
OptionalFunc reads/writes an Optional[T].
func OptionalMarshaler ¶
func OptionalMarshaler[T any, A PtrMarshaler[T]](r IO, x *Optional[T])
OptionalMarshaler reads/writes an Optional assuming *T implements Marshaler.
func PlayerListRemoveEntry ¶
func PlayerListRemoveEntry(r IO, x *PlayerListEntry)
PlayerListRemoveEntry encodes/decodes a PlayerListEntry for removal from the list.
func PlayerMoveSettings ¶
func PlayerMoveSettings(r IO, x *PlayerMovementSettings)
PlayerMoveSettings reads/writes PlayerMovementSettings x to/from IO r.
func ScoreRemoveEntry ¶
func ScoreRemoveEntry(r IO, x *ScoreboardEntry)
ScoreRemoveEntry encodes/decodes a ScoreboardEntry x as an entry for removal.
func ScoreboardIdentityClearEntry ¶
func ScoreboardIdentityClearEntry(r IO, x *ScoreboardIdentityEntry)
ScoreboardIdentityClearEntry encodes/decodes a ScoreboardIdentityEntry for clearing the entry.
func Single ¶
func Single[T any, S PtrMarshaler[T]](r IO, x S)
Single reads/writes a single Marshaler x.
func Slice ¶
func Slice[T any, S ~*[]T, A PtrMarshaler[T]](r IO, x S)
Slice reads/writes a slice of T with a varuint32 prefix.
func SliceOfLen ¶
func SliceOfLen[T any, S ~*[]T, A PtrMarshaler[T]](r IO, l uint32, x S)
SliceOfLen reads/writes the elements of a slice of type T with length l.
func SliceUint16Length ¶
func SliceUint16Length[T any, S ~*[]T, A PtrMarshaler[T]](r IO, x S)
SliceUint16Length reads/writes a slice of T with a uint16 prefix.
func SliceUint32Length ¶
func SliceUint32Length[T any, S ~*[]T, A PtrMarshaler[T]](r IO, x S)
SliceUint32Length reads/writes a slice of T with a uint32 prefix.
func SliceUint8Length ¶
func SliceUint8Length[T any, S *[]T, A PtrMarshaler[T]](r IO, x S)
SliceUint8Length reads/writes a slice of T with a uint8 prefix.
func SliceVarint32Length ¶
func SliceVarint32Length[T any, S ~*[]T, A PtrMarshaler[T]](r IO, x S)
SliceVarint32Length reads/writes a slice of T with a varint32 prefix.
func StackReqSlotInfo ¶
func StackReqSlotInfo(r IO, x *StackRequestSlotInfo)
StackReqSlotInfo reads/writes a StackRequestSlotInfo x using IO r.
func SubChunkEntryNoCache ¶
func SubChunkEntryNoCache(r IO, x *SubChunkEntry)
SubChunkEntryNoCache encodes/decodes a SubChunkEntry assuming the blob cache is not enabled.
func Varint32 ¶
func Varint32(src io.ByteReader, x *int32) error
Varint32 reads up to 5 bytes from the source buffer passed and sets the integer produced to a pointer.
func Varint64 ¶
func Varint64(src io.ByteReader, x *int64) error
Varint64 reads up to 10 bytes from the source buffer passed and sets the integer produced to a pointer.
func Varuint32 ¶
func Varuint32(src io.ByteReader, x *uint32) error
Varuint32 reads up to 5 bytes from the source buffer passed and sets the integer produced to a pointer.
func Varuint64 ¶
func Varuint64(src io.ByteReader, x *uint64) error
Varuint64 reads up to 10 bytes from the source buffer passed and sets the integer produced to a pointer.
func WriteVarint32 ¶
func WriteVarint32(dst io.ByteWriter, x int32) error
WriteVarint32 writes an int32 to the destination buffer passed with a size of 1-5 bytes.
func WriteVarint64 ¶
func WriteVarint64(dst io.ByteWriter, x int64) error
WriteVarint64 writes an int64 to the destination buffer passed with a size of 1-10 bytes.
func WriteVaruint32 ¶
func WriteVaruint32(dst io.ByteWriter, x uint32) error
WriteVaruint32 writes a uint32 to the destination buffer passed with a size of 1-5 bytes.
func WriteVaruint64 ¶
func WriteVaruint64(dst io.ByteWriter, x uint64) error
WriteVaruint64 writes a uint64 to the destination buffer passed with a size of 1-10 bytes.
Types ¶
type AbilityData ¶
type AbilityData struct { // EntityUniqueID is a unique identifier of the player. It appears it is not required to fill this field // out with a correct value. Simply writing 0 seems to work. EntityUniqueID int64 // PlayerPermissions is the permission level of the player as it shows up in the player list built up using // the PlayerList packet. PlayerPermissions byte // CommandPermissions is a set of permissions that specify what commands a player is allowed to execute. CommandPermissions byte // Layers contains all ability layers and their potential values. This should at least have one entry, being the // base layer. Layers []AbilityLayer }
AbilityData represents various data about the abilities of a player, such as ability layers or permissions.
func (*AbilityData) Marshal ¶
func (x *AbilityData) Marshal(r IO)
Marshal encodes/decodes an AbilityData.
type AbilityLayer ¶
type AbilityLayer struct { // Type represents the type of the layer. This is one of the AbilityLayerType constants defined above. Type uint16 // Abilities is a set of abilities that are enabled for the layer. This is one of the Ability constants defined // above. Abilities uint32 // Values is a set of values that are associated with the enabled abilities, representing the values of the // abilities. Values uint32 // FlySpeed is the default fly speed of the layer. FlySpeed float32 // WalkSpeed is the default walk speed of the layer. WalkSpeed float32 }
AbilityLayer represents the abilities of a specific layer, such as the base layer or the spectator layer.
func (*AbilityLayer) Marshal ¶
func (x *AbilityLayer) Marshal(r IO)
Marshal encodes/decodes an AbilityLayer.
type AchievementAwardedEvent ¶
type AchievementAwardedEvent struct { // AchievementID is the ID for the achievement. AchievementID int32 }
AchievementAwardedEvent is the event data sent for achievements.
func (*AchievementAwardedEvent) Marshal ¶
func (a *AchievementAwardedEvent) Marshal(r IO)
Marshal ...
type AgentCommandEvent ¶
type AgentCommandEvent struct { // AgentResult ... AgentResult int32 // DataValue ... DataValue int32 // Command ... Command string // DataKey ... DataKey string // Output ... Output string }
AgentCommandEvent is an event used in Education Edition.
type Attribute ¶
type Attribute struct { AttributeValue // Default is the default value of the attribute. It's not clear why this field must be sent to the // client, but it is required regardless. Default float32 // Modifiers is a slice of AttributeModifiers that are applied to the attribute. Modifiers []AttributeModifier }
Attribute is an entity attribute, that holds specific data such as the health of the entity. Each attribute holds a default value, maximum and minimum value, name and its current value.
type AttributeModifier ¶
type AttributeModifier struct { // ID is the unique ID of the modifier. It is used to identify the modifier in the packet. ID string // Name is the name of the attribute that is modified. Name string // Amount is the amount of difference between the current value of the attribute and the new value. Amount float32 // Operation is the operation that is performed on the attribute. It can be addition, multiply base, multiply total // or cap. Operation int32 // Operand ... // TODO: Figure out what this field is used for. Operand int32 // Serializable ... // TODO: Figure out what this field is used for. Serializable bool }
AttributeModifier temporarily buffs/debuffs a given attribute until the modifier is used. In vanilla, these are mainly used for effects.
func (*AttributeModifier) Marshal ¶
func (x *AttributeModifier) Marshal(r IO)
Marshal encodes/decodes an AttributeModifier.
type AttributeValue ¶
type AttributeValue struct { // Name is the name of the attribute, for example 'minecraft:health'. These names must be identical to // the ones defined client-side. Name string // Value is the current value of the attribute. This value will be applied to the entity when sent in a // packet. Value float32 // Max and Min specify the boundaries within the value of the attribute must be. The definition of these // fields differ per attribute. The maximum health of an entity may be changed, whereas the maximum // movement speed for example may not be. Max, Min float32 }
AttributeValue holds the value of an attribute, including the min and max.
func (*AttributeValue) Marshal ¶
func (x *AttributeValue) Marshal(r IO)
Marshal encodes/decodes an AttributeValue.
type AutoCraftRecipeStackRequestAction ¶
type AutoCraftRecipeStackRequestAction struct { // RecipeNetworkID is the network ID of the recipe that is about to be crafted. This network ID matches // one of the recipes sent in the CraftingData packet, where each of the recipes have a RecipeNetworkID as // of 1.16. RecipeNetworkID uint32 // TimesCrafted is how many times the recipe was crafted. TimesCrafted byte // Ingredients is a slice of ItemDescriptorCount that contains the ingredients that were used to craft the recipe. // It is not exactly clear what this is used for, but it is sent by the vanilla client. Ingredients []ItemDescriptorCount }
AutoCraftRecipeStackRequestAction is sent by the client similarly to the CraftRecipeStackRequestAction. The only difference is that the recipe is automatically created and crafted by shift clicking the recipe book.
func (*AutoCraftRecipeStackRequestAction) Marshal ¶
func (a *AutoCraftRecipeStackRequestAction) Marshal(r IO)
Marshal ...
type BeaconPaymentStackRequestAction ¶
type BeaconPaymentStackRequestAction struct {
// PrimaryEffect and SecondaryEffect are the effects that were selected from the beacon.
PrimaryEffect, SecondaryEffect int32
}
BeaconPaymentStackRequestAction is sent by the client when it submits an item to enable effects from a beacon. These items will have been moved into the beacon item slot in advance.
func (*BeaconPaymentStackRequestAction) Marshal ¶
func (a *BeaconPaymentStackRequestAction) Marshal(r IO)
Marshal ...
type BehaviourPackInfo ¶
type BehaviourPackInfo struct { // UUID is the UUID of the behaviour pack. Each behaviour pack downloaded must have a different UUID in // order for the client to be able to handle them properly. UUID string // Version is the version of the behaviour pack. The client will cache behaviour packs sent by the server as // long as they carry the same version. Sending a behaviour pack with a different version than previously // will force the client to re-download it. Version string // Size is the total size in bytes that the behaviour pack occupies. This is the size of the compressed // archive (zip) of the behaviour pack. Size uint64 // ContentKey is the key used to decrypt the behaviour pack if it is encrypted. This is generally the case // for marketplace behaviour packs. ContentKey string // SubPackName ... SubPackName string // ContentIdentity ... ContentIdentity string // HasScripts specifies if the behaviour packs has any scripts in it. A client will only download the // behaviour pack if it supports scripts, which, up to 1.11, only includes Windows 10. HasScripts bool }
BehaviourPackInfo represents a behaviour pack's info sent over network. It holds information about the behaviour pack such as its name, description and version.
func (*BehaviourPackInfo) Marshal ¶
func (x *BehaviourPackInfo) Marshal(r IO)
Marshal encodes/decodes a BehaviourPackInfo.
type BellUsedEvent ¶
type BellUsedEvent struct { // ItemID ... ItemID int32 }
BellUsedEvent is the event data sent when a bell is used.
type BlockChangeEntry ¶
type BlockChangeEntry struct { BlockPos // BlockRuntimeID is the runtime ID of the block. BlockRuntimeID uint32 // Flags is a combination of flags that specify the way the block is updated client-side. Flags uint32 // SyncedUpdateEntityUniqueID is the unique ID of the falling block entity that the block transitions to or that the entity transitions from if the block change entry is synced. SyncedUpdateEntityUniqueID uint64 // SyncedUpdateType 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. SyncedUpdateType uint32 }
BlockChangeEntry is used by the UpdateSubChunkBlocks packet.
func (*BlockChangeEntry) Marshal ¶
func (x *BlockChangeEntry) Marshal(r IO)
Marshal encodes/decodes a BlockChangeEntry.
type BlockEntry ¶
type BlockEntry struct { // Name is the name of the custom block. Name string // Properties is a list of properties which, in combination with the name, specify a unique block. Properties map[string]any }
BlockEntry is an entry for a custom block found in the StartGame packet. The runtime ID of these custom block entries is based on the index they have in the block palette when the palette is ordered alphabetically.
func (*BlockEntry) Marshal ¶
func (x *BlockEntry) Marshal(r IO)
Marshal encodes/decodes a BlockEntry.
type BlockPos ¶
type BlockPos [3]int32
BlockPos is the position of a block. It is composed of three integers, and is typically written as either 3 varint32s or a varint32, varuint32 and varint32.
func (BlockPos) X ¶
X returns the X coordinate of the block position. It is equivalent to BlockPos[0].
type BossKilledEvent ¶
type BossKilledEvent struct { // BossEntityUniqueID ... BossEntityUniqueID int64 // PlayerPartySize ... PlayerPartySize int32 // InteractionEntityType ... InteractionEntityType int32 }
BossKilledEvent is the event data sent when a boss dies.
type CacheBlob ¶
type CacheBlob struct { // Hash is the hash of the blob. The hash is computed using xxHash, and must be deterministic for the same // chunk data. Hash uint64 // Payload is the data of the blob. When sent, the client will associate the Hash of the blob with the // Payload in it. Payload []byte }
CacheBlob represents a blob as used in the client side blob cache protocol. It holds a hash of its data and the full data of it.
type CauldronInteractEvent ¶
type CauldronInteractEvent struct { // BlockInteractionType ... BlockInteractionType int32 // ItemID ... ItemID int32 }
CauldronInteractEvent is the event data sent when a cauldron is interacted with.
type CauldronUsedEvent ¶
type CauldronUsedEvent struct { // PotionID ... PotionID int32 // Colour ... Colour int32 // FillLevel ... FillLevel int32 }
CauldronUsedEvent is the event data sent when a cauldron is used.
type ChunkPos ¶
type ChunkPos [2]int32
ChunkPos is the position of a chunk. It is composed of two integers and is written as two varint32s.
type Command ¶
type Command struct { // Name is the name of the command. The command may be executed using this name, and will be shown in the // /help list with it. It currently seems that the client crashes if the Name contains uppercase letters. Name string // Description is the description of the command. It is shown in the /help list and when starting to write // a command. Description string // Flags is a combination of flags not currently known. Leaving the Flags field empty appears to work. Flags uint16 // PermissionLevel is the command permission level that the player required to execute this command. The // field no longer seems to serve a purpose, as the client does not handle the execution of commands // anymore: The permissions should be checked server-side. PermissionLevel byte // AliasOffset is the offset to a CommandEnum that holds the values that // should be used as aliases for this command. AliasesOffset uint32 // Overloads is a list of command overloads that specify the ways in which a command may be executed. The // overloads may be completely different. Overloads []CommandOverload }
Command holds the data that a command requires to be shown to a player client-side. The command is shown in the /help command and auto-completed using this data.
type CommandEnum ¶
type CommandEnum struct { // Type is the type of the command enum. The type will show up in the command usage as the type of the // argument if it has a certain amount of arguments, or when Options is set to true in the // command holding the enum. Type string // ValueIndices holds a list of indices that point to the EnumValues slice in the // AvailableCommandsPacket. These represent the options of the enum. ValueIndices []uint }
CommandEnum represents an enum in a command usage. The enum typically has a type and a set of options that are valid. A value that is not one of the options results in a failure during execution.
type CommandEnumConstraint ¶
type CommandEnumConstraint struct { // EnumValueIndex points to an enum value in the AvailableCommands packet that this // constraint should apply to. EnumValueIndex uint32 // EnumIndex points to an enum in the AvailableCommands packet to which this // constraint should apply to. EnumIndex uint32 // Constraints holds a slice of constraints as present in the constants above. Constraints []byte }
CommandEnumConstraint is sent in the AvailableCommands packet to limit what values of an enum may be used taking in account things such as whether cheats are enabled.
func (*CommandEnumConstraint) Marshal ¶
func (c *CommandEnumConstraint) Marshal(r IO)
Marshal encodes/decodes a CommandEnumConstraint.
type CommandEnumContext ¶
type CommandEnumContext struct {
EnumValues []string
}
CommandEnumContext holds context required for encoding command enums.
func (CommandEnumContext) Marshal ¶
func (ctx CommandEnumContext) Marshal(r IO, x *CommandEnum)
Marshal encodes/decodes a CommandEnum.
type CommandOrigin ¶
type CommandOrigin struct { // Origin is one of the values above that specifies the origin of the command. The origin may change, // depending on what part of the client actually called the command. The command may be issued by a // websocket server, for example. Origin uint32 // UUID is the UUID of the command called. This UUID is a bit odd as it is not specified by the server. It // is not clear what exactly this UUID is meant to identify, but it is unique for each command called. UUID uuid.UUID // RequestID is an ID that identifies the request of the client. The server should send a CommandOrigin // with the same request ID to ensure it can be matched with the request by the caller of the command. // This is especially important for websocket servers and it seems that this field is only non-empty for // these websocket servers. RequestID string // PlayerUniqueID is an ID that identifies the player, the same as the one found in the AdventureSettings // packet. Filling it out with 0 seems to work. // PlayerUniqueID is only written if Origin is CommandOriginDevConsole or CommandOriginTest. PlayerUniqueID int64 }
CommandOrigin holds data that identifies the origin of the requesting of a command. It holds several fields that may be used to get specific information. When sent in a CommandRequest packet, the same CommandOrigin should be sent in a CommandOutput packet.
type CommandOutputMessage ¶
type CommandOutputMessage struct { // Success indicates if the output message was one of a successful command execution. If set to true, the // output message is by default coloured white, whereas if set to false, the message is by default // coloured red. Success bool // Message is the message that is sent to the client in the chat window. It may either be simply a // message or a translated built-in string like 'commands.tp.success.coordinates', combined with specific // parameters below. Message string // Parameters is a list of parameters that serve to supply the message sent with additional information, // such as the position that a player was teleported to or the effect that was applied to an entity. // These parameters only apply for the Minecraft built-in command output. Parameters []string }
CommandOutputMessage represents a message sent by a command that holds the output of one of the commands executed.
func (*CommandOutputMessage) Marshal ¶
func (x *CommandOutputMessage) Marshal(r IO)
Marshal encodes/decodes a CommandOutputMessage.
type CommandOverload ¶
type CommandOverload struct { // Parameters is a list of command parameters that are part of the overload. These parameters specify the // usage of the command when this overload is applied. Parameters []CommandParameter }
CommandOverload represents an overload of a command. This overload can be compared to function overloading in languages such as java. It represents a single usage of the command. A command may have multiple different overloads, which are handled differently.
func (*CommandOverload) Marshal ¶
func (c *CommandOverload) Marshal(r IO)
type CommandParameter ¶
type CommandParameter struct { // Name is the name of the command parameter. It shows up in the usage like <$Name: $Type>, with the // exception of enum types, which show up simply as a list of options if the list is short enough and // Options is set to false. Name string // Type is a rather odd combination of type(flag)s that result in a certain parameter type to show up // client-side. It is a combination of the flags above. The basic types must be combined with the // ArgumentTypeFlagBasic flag (and integers with a suffix ArgumentTypeFlagSuffixed), whereas enums are // combined with the ArgumentTypeFlagEnum flag. Type uint32 // Optional specifies if the command parameter is optional to enter. Note that no non-optional parameter // should ever be present in a command overload after an optional parameter. When optional, the parameter // shows up like so: [$Name: $Type], whereas when mandatory, it shows up like so: <$Name: $Type>. Optional bool // Options holds a combinations of options that additionally apply to the command parameter. The list of // options can be found above. Options byte }
CommandParameter represents a single parameter of a command overload, which accepts a certain type of input values. It has a name and a type which show up client-side when a player is entering the command.
func (*CommandParameter) Marshal ¶
func (c *CommandParameter) Marshal(r IO)
type ComplexAliasItemDescriptor ¶
type ComplexAliasItemDescriptor struct { // Name is the name of the item, which is a name like 'minecraft:stick'. Name string }
ComplexAliasItemDescriptor represents an item descriptor that uses a single name to identify the item. There is no clear benefit of using this item descriptor and only seem to be used for specific recipes.
func (*ComplexAliasItemDescriptor) Marshal ¶
func (x *ComplexAliasItemDescriptor) Marshal(r IO)
Marshal ...
type ComposterInteractEvent ¶
type ComposterInteractEvent struct { // BlockInteractionType ... BlockInteractionType int32 // ItemID ... ItemID int32 }
ComposterInteractEvent is the event data sent when a composter is interacted with.
type ConsumeStackRequestAction ¶
type ConsumeStackRequestAction struct {
DestroyStackRequestAction
}
ConsumeStackRequestAction is sent by the client when it uses an item to craft another item. The original item is 'consumed'.
type CraftCreativeStackRequestAction ¶
type CraftCreativeStackRequestAction struct { // CreativeItemNetworkID is the network ID of the creative item that is being created. This is one of the // creative item network IDs sent in the CreativeContent packet. CreativeItemNetworkID uint32 }
CraftCreativeStackRequestAction is sent by the client when it takes an item out fo the creative inventory. The item is thus not really crafted, but instantly created.
func (*CraftCreativeStackRequestAction) Marshal ¶
func (a *CraftCreativeStackRequestAction) Marshal(r IO)
Marshal ...
type CraftGrindstoneRecipeStackRequestAction ¶
type CraftGrindstoneRecipeStackRequestAction struct { // RecipeNetworkID is the network ID of the recipe that is about to be crafted. This network ID matches // one of the recipes sent in the CraftingData packet, where each of the recipes have a RecipeNetworkID as // of 1.16. RecipeNetworkID uint32 // Cost is the cost of the recipe that was crafted. Cost int32 }
CraftGrindstoneRecipeStackRequestAction is sent when a grindstone recipe is crafted. It contains the RecipeNetworkID to identify the recipe crafted, and the cost for crafting the recipe.
func (*CraftGrindstoneRecipeStackRequestAction) Marshal ¶
func (c *CraftGrindstoneRecipeStackRequestAction) Marshal(r IO)
Marshal ...
type CraftLoomRecipeStackRequestAction ¶
type CraftLoomRecipeStackRequestAction struct { // Pattern is the pattern identifier for the loom recipe. Pattern string }
CraftLoomRecipeStackRequestAction is sent when a loom recipe is crafted. It simply contains the pattern identifier to figure out what pattern is meant to be applied to the item.
func (*CraftLoomRecipeStackRequestAction) Marshal ¶
func (c *CraftLoomRecipeStackRequestAction) Marshal(r IO)
Marshal ...
type CraftNonImplementedStackRequestAction ¶
type CraftNonImplementedStackRequestAction struct{}
CraftNonImplementedStackRequestAction is an action sent for inventory actions that aren't yet implemented in the new system. These include, for example, anvils.
func (*CraftNonImplementedStackRequestAction) Marshal ¶
func (*CraftNonImplementedStackRequestAction) Marshal(IO)
Marshal ...
type CraftRecipeOptionalStackRequestAction ¶
type CraftRecipeOptionalStackRequestAction struct { // RecipeNetworkID is the network ID of the multi-recipe that is about to be crafted. This network ID matches // one of the multi-recipes sent in the CraftingData packet, where each of the recipes have a RecipeNetworkID as // of 1.16. RecipeNetworkID uint32 // FilterStringIndex is the index of a filter string sent in a ItemStackRequest. FilterStringIndex int32 }
CraftRecipeOptionalStackRequestAction is sent when using an anvil. When this action is sent, the FilterStrings field in the respective stack request is non-empty and contains the name of the item created using the anvil or cartography table.
func (*CraftRecipeOptionalStackRequestAction) Marshal ¶
func (c *CraftRecipeOptionalStackRequestAction) Marshal(r IO)
Marshal ...
type CraftRecipeStackRequestAction ¶
type CraftRecipeStackRequestAction struct { // RecipeNetworkID is the network ID of the recipe that is about to be crafted. This network ID matches // one of the recipes sent in the CraftingData packet, where each of the recipes have a RecipeNetworkID as // of 1.16. RecipeNetworkID uint32 }
CraftRecipeStackRequestAction is sent by the client the moment it begins crafting an item. This is the first action sent, before the Consume and Create item stack request actions. This action is also sent when an item is enchanted. Enchanting should be treated mostly the same way as crafting, where the old item is consumed.
func (*CraftRecipeStackRequestAction) Marshal ¶
func (a *CraftRecipeStackRequestAction) Marshal(r IO)
Marshal ...
type CraftResultsDeprecatedStackRequestAction ¶
CraftResultsDeprecatedStackRequestAction is an additional, deprecated packet sent by the client after crafting. It holds the final results and the amount of times the recipe was crafted. It shouldn't be used. This action is also sent when an item is enchanted. Enchanting should be treated mostly the same way as crafting, where the old item is consumed.
func (*CraftResultsDeprecatedStackRequestAction) Marshal ¶
func (a *CraftResultsDeprecatedStackRequestAction) Marshal(r IO)
Marshal ...
type CreateStackRequestAction ¶
type CreateStackRequestAction struct { // ResultsSlot is the slot in the inventory in which the results of the crafting ingredients are to be // placed. ResultsSlot byte }
CreateStackRequestAction is sent by the client when an item is created through being used as part of a recipe. For example, when milk is used to craft a cake, the buckets are leftover. The buckets are moved to the slot sent by the client here. Note that before this is sent, an action for consuming all items in the crafting table/grid is sent. Items that are not fully consumed when used for a recipe should not be destroyed there, but instead, should be turned into their respective resulting items.
func (*CreateStackRequestAction) Marshal ¶
func (a *CreateStackRequestAction) Marshal(r IO)
Marshal ...
type CreativeItem ¶
type CreativeItem struct { // CreativeItemNetworkID is a unique ID for the creative item. It has to be unique for each creative item // sent to the client. An incrementing ID per creative item does the job. CreativeItemNetworkID uint32 // Item is the item that should be added to the creative inventory. Item ItemStack }
CreativeItem represents a creative item present in the creative inventory.
func (*CreativeItem) Marshal ¶
func (x *CreativeItem) Marshal(r IO)
Marshal encodes/decodes a CreativeItem.
type DefaultItemDescriptor ¶
type DefaultItemDescriptor struct { // NetworkID is the numerical network ID of the item. This is sometimes a positive ID, and sometimes a // negative ID, depending on what item it concerns. NetworkID int16 // MetadataValue is the metadata value of the item. For some items, this is the damage value, whereas for // other items it is simply an identifier of a variant of the item. MetadataValue int16 }
DefaultItemDescriptor represents an item descriptor for regular items. This is used for the significant majority of items.
type DeferredItemDescriptor ¶
type DeferredItemDescriptor struct { // Name is the name of the item, which is a name like 'minecraft:stick'. Name string // MetadataValue is the metadata value of the item. For some items, this is the damage value, whereas for // other items it is simply an identifier of a variant of the item. MetadataValue int16 }
DeferredItemDescriptor represents an item descriptor that uses a namespace and metadata value to identify the item. There is no clear benefit of using this item descriptor.
type DestroyStackRequestAction ¶
type DestroyStackRequestAction struct { // Count is the count of the item in the source slot that was destroyed. Count byte // Source is the source slot from which items came that were destroyed by moving them into the creative // inventory. Source StackRequestSlotInfo }
DestroyStackRequestAction is sent by the client when it destroys an item in creative mode by moving it back into the creative inventory.
func (*DestroyStackRequestAction) Marshal ¶
func (a *DestroyStackRequestAction) Marshal(r IO)
Marshal ...
type DeviceOS ¶
type DeviceOS int
DeviceOS is a device DeviceOS identifier. It holds a value of one of the constants below and may be found in packets such as the Login packet.
type DimensionDefinition ¶
type DimensionDefinition struct { // Name specifies the name of the dimension. Name string // Range is the height range of the dimension, where the first value is the minimum and the second is the maximum. Range [2]int32 // Generator is the variant of generator that exists in the provided dimension. These can be one of the constants // defined above. If this is set to GeneratorLegacy, the legacy horizontal world limits will be enforced. Generator int32 }
DimensionDefinition contains information specifying dimension-specific properties, used for data-driven dimensions. These include the range (the height min/max), generator variant, and more.
func (*DimensionDefinition) Marshal ¶
func (x *DimensionDefinition) Marshal(r IO)
Marshal encodes/decodes a DimensionDefinition.
type DropStackRequestAction ¶
type DropStackRequestAction struct { // Count is the count of the item in the source slot that was taken towards the destination slot. Count byte // Source is the source slot from which items were dropped to the ground. Source StackRequestSlotInfo // Randomly seems to be set to false in most cases. I'm not entirely sure what this does, but this is what // vanilla calls this field. Randomly bool }
DropStackRequestAction is sent by the client when it drops an item out of the inventory when it has its inventory opened. This action is not sent when a player drops an item out of the hotbar using the Q button (or the equivalent on mobile). The InventoryTransaction packet is still used for that action, regardless of whether the item stack network IDs are used or not.
type DynamicEnum ¶
type DynamicEnum struct { // Type is the type of the command enum. The type will show up in the command usage as the type of the // argument if it has a certain amount of arguments, or when Options is set to true in the // command holding the enum. Type string // Values is a slice of possible options for the enum. Values []string }
DynamicEnum is an enum variant that can have its options changed during runtime, without sending a new AvailableCommands packet.
func (*DynamicEnum) Marshal ¶
func (x *DynamicEnum) Marshal(r IO)
Marshal encodes/decodes a DynamicEnum.
type EducationExternalLinkSettings ¶
type EducationExternalLinkSettings struct { // URL is the external link URL. URL string // DisplayName is the display name in game. DisplayName string }
EducationExternalLinkSettings ...
func (*EducationExternalLinkSettings) Marshal ¶
func (x *EducationExternalLinkSettings) Marshal(r IO)
Marshal encodes/decodes an EducationExternalLinkSettings.
type EducationSharedResourceURI ¶
EducationSharedResourceURI is an education edition feature that is used for transmitting education resource settings to clients. It contains a button name and a link URL.
func (*EducationSharedResourceURI) Marshal ¶
func (x *EducationSharedResourceURI) Marshal(r IO)
Marshal reads/writes an EducationSharedResourceURI to an IO.
type EnchantmentInstance ¶
EnchantmentInstance represents a single enchantment instance with the type of the enchantment and its level.
func (*EnchantmentInstance) Marshal ¶
func (x *EnchantmentInstance) Marshal(r IO)
Marshal encodes/decodes an EnchantmentInstance.
type EnchantmentOption ¶
type EnchantmentOption struct { // Cost is the cost of the option. This is the amount of XP levels required to select this enchantment // option. Cost uint32 // Enchantments holds the enchantments that will be applied to the item when this option is clicked. Enchantments ItemEnchantments // Name is a name that will be translated to the 'Standard Galactic Alphabet' // (https://minecraft.gamepedia.com/Enchanting_Table#Standard_Galactic_Alphabet) client-side. The names // generally have no meaning, such as: // 'animal imbue range galvanize ' // 'bless inside creature shrink ' // 'elder free of inside ' Name string // RecipeNetworkID is a unique network ID for this enchantment option. When enchanting, the client // will submit this network ID in a ItemStackRequest packet with the CraftRecipe action, so that the // server knows which enchantment was selected. // Note that this ID should still be unique with other actual recipes. It's recommended to start counting // for enchantment network IDs from the counter used for producing network IDs for the normal recipes. RecipeNetworkID uint32 }
EnchantmentOption represents a single option in the enchantment table for a single item.
func (*EnchantmentOption) Marshal ¶
func (x *EnchantmentOption) Marshal(r IO)
Marshal encodes/decodes an EnchantmentOption.
type EntityDefinitionTriggerEvent ¶
type EntityDefinitionTriggerEvent struct { // EventName ... EventName string }
EntityDefinitionTriggerEvent is an event used for an unknown purpose.
func (*EntityDefinitionTriggerEvent) Marshal ¶
func (e *EntityDefinitionTriggerEvent) Marshal(r IO)
Marshal ...
type EntityInteractEvent ¶
type EntityInteractEvent struct { // InteractionType ... InteractionType int32 // InteractionEntityType ... InteractionEntityType int32 // EntityVariant ... EntityVariant int32 // EntityColour ... EntityColour uint8 }
EntityInteractEvent is the event data sent for entity interactions.
type EntityLink ¶
type EntityLink struct { // RiddenEntityUniqueID is the entity unique ID of the entity that is being ridden. For a player sitting // in a boat, this is the unique ID of the boat. RiddenEntityUniqueID int64 // RiderEntityUniqueID is the entity unique ID of the entity that is riding. For a player sitting in a // boat, this is the unique ID of the player. RiderEntityUniqueID int64 // Type is one of the types above. It specifies the way the entity is linked to another entity. Type byte // Immediate is set to immediately dismount an entity from another. This should be set when the mount of // an entity is killed. Immediate bool // RiderInitiated specifies if the link was created by the rider, for example the player starting to ride // a horse by itself. This is generally true in vanilla environment for players. RiderInitiated bool }
EntityLink is a link between two entities, typically being one entity riding another.
func (*EntityLink) Marshal ¶
func (x *EntityLink) Marshal(r IO)
Marshal encodes/decodes a single entity link.
type EntityMetadata ¶
EntityMetadata represents a map that holds metadata associated with an entity. The data held in the map depends on the entity and varies on a per-entity basis.
func NewEntityMetadata ¶
func NewEntityMetadata() EntityMetadata
NewEntityMetadata initializes and returns a new entity metadata map.
func (EntityMetadata) Flag ¶
func (m EntityMetadata) Flag(key uint32, index uint8) bool
Flag returns true if the flag with the index passed is set within the entity metadata.
func (EntityMetadata) SetFlag ¶
func (m EntityMetadata) SetFlag(key uint32, index uint8)
SetFlag sets a flag with a given index and value within the entity metadata map.
type EntityProperties ¶
type EntityProperties struct { // IntegerProperties is a list of entity properties that contain integer values. IntegerProperties []IntegerEntityProperty // FloatProperties is a list of entity properties that contain float values. FloatProperties []FloatEntityProperty }
EntityProperties holds lists of entity properties that define specific attributes of an entity. As of v1.19.40, the vanilla server does not use these properties, however they are still supported by the protocol.
type Event ¶
type Event interface { // Marshal encodes/decodes a serialised event data object. Marshal(r IO) }
Event represents an object that holds data specific to an event. The data it holds depends on the type.
type ExperimentData ¶
type ExperimentData struct { // Name is the name of the experiment. Name string // Enabled specifies if the experiment is enabled. Vanilla typically always sets this to true for any // experiments sent. Enabled bool }
ExperimentData holds data on an experiment that is either enabled or disabled.
func (*ExperimentData) Marshal ¶
func (x *ExperimentData) Marshal(r IO)
Marshal encodes/decodes an ExperimentData.
type ExtractHoneyEvent ¶
type ExtractHoneyEvent struct{}
ExtractHoneyEvent is an event with no purpose.
type FishBucketedEvent ¶
type FishBucketedEvent struct { // Pattern ... Pattern int32 // Preset ... Preset int32 // BucketedEntityType ... BucketedEntityType int32 // Release ... Release bool }
FishBucketedEvent is the event data sent when a fish is bucketed.
type FloatEntityProperty ¶
type FloatEntityProperty struct { // Index represents the index of the property. It is unclear what the exact purpose of this is. Index uint32 // Value is the value of the property. Value float32 }
FloatEntityProperty is an entity property that contains a float value.
type FurnaceDataRecipe ¶
type FurnaceDataRecipe struct {
FurnaceRecipe
}
FurnaceDataRecipe is a recipe specifically used for furnace-type crafting stations. It is equal to FurnaceRecipe, except it has an input item with a specific metadata value, instead of any metadata value.
func (*FurnaceDataRecipe) Unmarshal ¶
func (recipe *FurnaceDataRecipe) Unmarshal(r *Reader)
Unmarshal ...
type FurnaceRecipe ¶
type FurnaceRecipe struct { // InputType is the item type of the input item. The metadata value of the item is not used in the // FurnaceRecipe. Use FurnaceDataRecipe to allow an item with only one metadata value. InputType ItemType // Output is the item that is created as a result of smelting/cooking an item in the furnace. Output ItemStack // Block is the block name that is required to create the output of the recipe. The block is not prefixed // with 'minecraft:', so it will look like 'furnace' as an example. Block string }
FurnaceRecipe is a recipe that is specifically used for all kinds of furnaces. These recipes don't just apply to furnaces, but also blast furnaces and smokers.
type GameRule ¶
type GameRule struct { // Name is the name of the game rule. Name string // CanBeModifiedByPlayer specifies if the game rule can be modified by the player through the in-game UI. CanBeModifiedByPlayer bool // Value is the new value of the game rule. This is either a bool, uint32 or float32. Value any }
GameRule contains game rule data.
type GenerationFeature ¶
type GenerationFeature struct { // Name is the name of the feature. Name string // JSON is the encoded JSON data instructing the client on how to generate the feature. JSON []byte }
GenerationFeature represents a world generation feature, used when encoding the FeatureRegistry to the client.
func (*GenerationFeature) Marshal ¶
func (x *GenerationFeature) Marshal(r IO)
Marshal encodes/decodes a GenerationFeature.
type IO ¶
type IO interface { Uint16(x *uint16) Int16(x *int16) Uint32(x *uint32) Int32(x *int32) BEInt32(x *int32) Uint64(x *uint64) Int64(x *int64) Float32(x *float32) Uint8(x *uint8) Int8(x *int8) Bool(x *bool) Varint64(x *int64) Varuint64(x *uint64) Varint32(x *int32) Varuint32(x *uint32) String(x *string) StringUTF(x *string) ByteSlice(x *[]byte) Vec3(x *mgl32.Vec3) Vec2(x *mgl32.Vec2) BlockPos(x *BlockPos) UBlockPos(x *BlockPos) ChunkPos(x *ChunkPos) SubChunkPos(x *SubChunkPos) SoundPos(x *mgl32.Vec3) ByteFloat(x *float32) Bytes(p *[]byte) NBT(m *map[string]any, encoding nbt.Encoding) NBTList(m *[]any, encoding nbt.Encoding) UUID(x *uuid.UUID) RGBA(x *color.RGBA) VarRGBA(x *color.RGBA) EntityMetadata(x *map[uint32]any) Item(x *ItemStack) ItemInstance(i *ItemInstance) ItemDescriptorCount(i *ItemDescriptorCount) StackRequestAction(x *StackRequestAction) MaterialReducer(x *MaterialReducer) Recipe(x *Recipe) EventType(x *Event) TransactionDataType(x *InventoryTransactionData) PlayerInventoryAction(x *UseItemTransactionData) GameRule(x *GameRule) AbilityValue(x *any) CompressedBiomeDefinitions(x *map[string]any) ShieldID() int32 UnknownEnumOption(value any, enum string) InvalidValue(value any, forField, reason string) }
IO represents a packet IO direction. Implementations of this interface are Reader and Writer. Reader reads data from the input stream into the pointers passed, whereas Writer writes the values the pointers point to to the output stream.
type IntegerEntityProperty ¶
type IntegerEntityProperty struct { // Index represents the index of the property. It is unclear what the exact purpose of this is. Index uint32 // Value is the value of the property. Value int32 }
IntegerEntityProperty is an entity property that contains an integer value.
type InvalidItemDescriptor ¶
type InvalidItemDescriptor struct{}
InvalidItemDescriptor represents an invalid item descriptor. This is usually sent by the vanilla server for empty slots or ingredients.
type InventoryAction ¶
type InventoryAction struct { // SourceType is the source type of the inventory action. It is one of the constants above. SourceType uint32 // WindowID is the ID of the window that the client has opened. The window ID is not set if the SourceType // is InventoryActionSourceWorld. WindowID int32 // SourceFlags is a combination of flags that is only set if the SourceType is InventoryActionSourceWorld. SourceFlags uint32 // InventorySlot is the slot in which the action took place. Each action only describes the change of item // in a single slot. InventorySlot uint32 // OldItem is the item that was present in the slot before the inventory action. It should be checked by // the server to ensure the inventories were not out of sync. OldItem ItemInstance // NewItem is the new item that was put in the InventorySlot that the OldItem was in. It must be checked // in combination with other inventory actions to ensure that the transaction is balanced. NewItem ItemInstance }
InventoryAction represents a single action that took place during an inventory transaction. On itself, this inventory action is always unbalanced: It must be combined with other actions in an inventory transaction to form a balanced transaction.
func (*InventoryAction) Marshal ¶
func (x *InventoryAction) Marshal(r IO)
Marshal encodes/decodes an InventoryAction.
type InventoryTransactionData ¶
type InventoryTransactionData interface { // Marshal encodes/decodes a serialised inventory transaction data object. Marshal(r IO) }
InventoryTransactionData represents an object that holds data specific to an inventory transaction type. The data it holds depends on the type.
type ItemComponentEntry ¶
type ItemComponentEntry struct { // Name is the name of the item, which is a name like 'minecraft:stick'. Name string // Data is a map containing the components and properties of the item. Data map[string]any }
ItemComponentEntry is sent in the ItemComponent item table. It holds a name and all of the components and properties associated to the item.
func (*ItemComponentEntry) Marshal ¶
func (x *ItemComponentEntry) Marshal(r IO)
Marshal encodes/decodes an ItemComponentEntry.
type ItemDescriptor ¶
type ItemDescriptor interface { Marshaler }
ItemDescriptor represents a type of item descriptor. This is one of the concrete types below. It is an alias of Marshaler.
type ItemDescriptorCount ¶
type ItemDescriptorCount struct { // Descriptor represents how the item is described over the network. It is one of the descriptors above. Descriptor ItemDescriptor // Count is the count of items that the item descriptor is required to have. Count int32 }
ItemDescriptorCount represents an item descriptor that has a count attached with it, such as a recipe ingredient.
type ItemEnchantments ¶
type ItemEnchantments struct { // Slot is either 0, 1 or 2. Its exact usage is not clear. Slot int32 // Enchantments is an array of 3 slices of enchantment instances. Each array represents enchantments that // will be added to the item with a different activation type. The arrays in which enchantments are sent // by the vanilla server are as follows: // slice 1 { protection, fire protection, feather falling, blast protection, projectile protection, // thorns, respiration, depth strider, aqua affinity, frost walker, soul speed } // slice 2 { sharpness, smite, bane of arthropods, fire aspect, looting, silk touch, unbreaking, fortune, // flame, luck of the sea, impaling } // slice 3 { knockback, efficiency, power, punch, infinity, lure, mending, curse of binding, // curse of vanishing, riptide, loyalty, channeling, multishot, piercing, quick charge } // The first slice holds armour enchantments, the differences between the slice 2 and slice 3 are more // vaguely defined. Enchantments [3][]EnchantmentInstance }
ItemEnchantments holds information on the enchantments that are applied to an item when a specific button is clicked in the enchantment table.
func (*ItemEnchantments) Marshal ¶
func (x *ItemEnchantments) Marshal(r IO)
Marshal encodes/decodes an ItemEnchantments.
type ItemEntry ¶
type ItemEntry struct { // Name if the name of the item, which is a name like 'minecraft:stick'. Name string // RuntimeID is the ID that is used to identify the item over network. After sending all items in the // StartGame packet, items will then be identified using these numerical IDs. RuntimeID int16 // ComponentBased specifies if the item was created using components, meaning the item is a custom item. ComponentBased bool }
ItemEntry is an item sent in the StartGame item table. It holds a name and a legacy ID, which is used to point back to that name.
type ItemInstance ¶
type ItemInstance struct { // StackNetworkID is the network ID of the item stack. If the stack is empty, 0 is always written for this // field. If not, the field should be set to 1 if the server authoritative inventories are disabled in the // StartGame packet, or to a unique stack ID if it is enabled. StackNetworkID int32 // Stack is the actual item stack of the item instance. Stack ItemStack }
ItemInstance represents a unique instance of an item stack. These instances carry a specific network ID that is persistent for the stack.
type ItemStack ¶
type ItemStack struct { ItemType // BlockRuntimeID ... BlockRuntimeID int32 // Count is the count of items that the item stack holds. Count uint16 // NBTData is a map that is serialised to its NBT representation when sent in a packet. NBTData map[string]any // CanBePlacedOn is a list of block identifiers like 'minecraft:stone' which the item, if it is an item // that can be placed, can be placed on top of. CanBePlacedOn []string // CanBreak is a list of block identifiers like 'minecraft:dirt' that the item is able to break. CanBreak []string // HasNetworkID ... HasNetworkID bool }
ItemStack represents an item instance/stack over network. It has a network ID and a metadata value that define its type.
type ItemStackRequest ¶
type ItemStackRequest struct { // RequestID is a unique ID for the request. This ID is used by the server to send a response for this // specific request in the ItemStackResponse packet. RequestID int32 // Actions is a list of actions performed by the client. The actual type of the actions depends on which // ID was present, and is one of the concrete types below. Actions []StackRequestAction // FilterStrings is a list of filter strings involved in the request. This is typically filled with one string // when an anvil or cartography is used. FilterStrings []string // FilterCause represents the cause of any potential filtering. This is one of the constants above. FilterCause int32 }
ItemStackRequest represents a single request present in an ItemStackRequest packet sent by the client to change an item in an inventory. Item stack requests are either approved or rejected by the server using the ItemStackResponse packet.
func (*ItemStackRequest) Marshal ¶
func (x *ItemStackRequest) Marshal(r IO)
Marshal encodes/decodes an ItemStackRequest.
type ItemStackResponse ¶
type ItemStackResponse struct { // Status specifies if the request with the RequestID below was successful. If this is the case, the // ContainerInfo below will have information on what slots ended up changing. If not, the container info // will be empty. // A non-0 status means an error occurred and will result in the action being reverted. Status uint8 // RequestID is the unique ID of the request that this response is in reaction to. If rejected, the client // will undo the actions from the request with this ID. RequestID int32 // ContainerInfo holds information on the containers that had their contents changed as a result of the // request. ContainerInfo []StackResponseContainerInfo }
ItemStackResponse is a response to an individual ItemStackRequest.
func (*ItemStackResponse) Marshal ¶
func (x *ItemStackResponse) Marshal(r IO)
Marshal encodes/decodes an ItemStackResponse.
type ItemTagItemDescriptor ¶
type ItemTagItemDescriptor struct { // Tag represents the tag that the item is part of. Tag string }
ItemTagItemDescriptor represents an item descriptor that uses item tagging. This should be used to reduce duplicative entries for items that can be grouped under a single tag.
type ItemType ¶
type ItemType struct { // NetworkID is the numerical network ID of the item. This is sometimes a positive ID, and sometimes a // negative ID, depending on what item it concerns. NetworkID int32 // MetadataValue is the metadata value of the item. For some items, this is the damage value, whereas for // other items it is simply an identifier of a variant of the item. MetadataValue uint32 }
ItemType represents a consistent combination of network ID and metadata value of an item. It cannot usually be changed unless a new item is obtained.
type LabTableCombineStackRequestAction ¶
type LabTableCombineStackRequestAction struct{}
LabTableCombineStackRequestAction is sent by the client when it uses a lab table to combine item stacks.
func (*LabTableCombineStackRequestAction) Marshal ¶
func (a *LabTableCombineStackRequestAction) Marshal(IO)
Marshal ...
type LegacySetItemSlot ¶
LegacySetItemSlot represents a slot that was changed during an InventoryTransaction. These slots have to have their values set accordingly for actions such as when dropping an item out of the hotbar, where the inventory container and the slot that had its item dropped is passed.
func (*LegacySetItemSlot) Marshal ¶
func (x *LegacySetItemSlot) Marshal(r IO)
Marshal encodes/decodes a LegacySetItemSlot.
type MapDecoration ¶
type MapDecoration struct { // Type is the type of the map decoration. The type specifies the shape (and sometimes the colour) that // the map decoration gets. Type byte // Rotation is the rotation of the map decoration. It is byte due to the 16 fixed directions that the // map decoration may face. Rotation byte // X is the offset on the X axis in pixels of the decoration. X byte // Y is the offset on the Y axis in pixels of the decoration. Y byte // Label is the name of the map decoration. This name may be of any value. Label string // Colour is the colour of the map decoration. Some map decoration types have a specific colour set // automatically, whereas others may be changed. Colour color.RGBA }
MapDecoration is a fixed decoration on a map: Its position or other properties do not change automatically client-side.
func (*MapDecoration) Marshal ¶
func (x *MapDecoration) Marshal(r IO)
Marshal encodes/decodes a MapDecoration.
type MapTrackedObject ¶
type MapTrackedObject struct { // Type is the type of the tracked object. It is either MapObjectTypeEntity or MapObjectTypeBlock. Type int32 // EntityUniqueID is the unique ID of the entity, if the tracked object was an entity. It needs not to be // filled out if Type is not MapObjectTypeEntity. EntityUniqueID int64 // BlockPosition is the position of the block, if the tracked object was a block. It needs not to be // filled out if Type is not MapObjectTypeBlock. BlockPosition BlockPos }
MapTrackedObject is an object on a map that is 'tracked' by the client, such as an entity or a block. This object may move, which is handled client-side.
func (*MapTrackedObject) Marshal ¶
func (x *MapTrackedObject) Marshal(r IO)
Marshal encodes/decodes a MapTrackedObject.
type Marshaler ¶
type Marshaler interface {
Marshal(r IO)
}
Marshaler is a type that can be written to or read from an IO.
type MaterialReducer ¶
type MaterialReducer struct { // InputItem is the starting item. InputItem ItemType // Outputs contain all outputting items. Outputs []MaterialReducerOutput }
MaterialReducer is a craft in a material reducer block in education edition.
type MaterialReducerOutput ¶
type MaterialReducerOutput struct { // NetworkID is the network ID of the output. NetworkID int32 // Count is the quantity of the output. Count int32 }
MaterialReducerOutput is an output from a material reducer.
func (*MaterialReducerOutput) Marshal ¶
func (x *MaterialReducerOutput) Marshal(r IO)
Marshal encodes/decodes a MaterialReducerOutput.
type MineBlockStackRequestAction ¶
type MineBlockStackRequestAction struct { // HotbarSlot is the slot held by the player while mining a block. HotbarSlot int32 // PredictedDurability is the durability of the item that the client assumes to be present at the time. PredictedDurability int32 // StackNetworkID is the unique stack ID that the client assumes to be present at the time. The server // must check if these IDs match. If they do not match, servers should reject the stack request that the // action holding this info was in. StackNetworkID int32 }
MineBlockStackRequestAction is sent by the client when it breaks a block.
func (*MineBlockStackRequestAction) Marshal ¶
func (a *MineBlockStackRequestAction) Marshal(r IO)
Marshal ...
type MismatchTransactionData ¶
type MismatchTransactionData struct{}
MismatchTransactionData represents a mismatched inventory transaction's data object.
type MoLangItemDescriptor ¶
type MoLangItemDescriptor struct { // Expression represents the MoLang expression used to identify the item/it's associated tag. Expression string // Version represents the version of MoLang to use. Version uint8 }
MoLangItemDescriptor represents an item descriptor for items that use MoLang (e.g. behaviour packs).
type MobBornEvent ¶
type MobBornEvent struct { // EntityType ... EntityType int32 // Variant ... Variant int32 // Colour ... Colour uint8 }
MobBornEvent is the event data sent when a mob is born.
type MobKilledEvent ¶
type MobKilledEvent struct { // KillerEntityUniqueID ... KillerEntityUniqueID int64 // VictimEntityUniqueID ... VictimEntityUniqueID int64 // KillerEntityType ... KillerEntityType int32 // EntityDamageCause ... EntityDamageCause int32 // VillagerTradeTier ... VillagerTradeTier int32 // VillagerDisplayName ... VillagerDisplayName string }
MobKilledEvent is the event data sent when a mob is killed.
type MovementAnomalyEvent ¶
type MovementAnomalyEvent struct { // EventType ... EventType uint8 // CheatingScore ... CheatingScore float32 // AveragePositionDelta ... AveragePositionDelta float32 // TotalPositionDelta ... TotalPositionDelta float32 // MinPositionDelta ... MinPositionDelta float32 // MaxPositionDelta ... MaxPositionDelta float32 }
MovementAnomalyEvent is an event used for updating the other party on movement data.
type MovementCorrectedEvent ¶
type MovementCorrectedEvent struct { // PositionDelta ... PositionDelta float32 // CheatingScore ... CheatingScore float32 // ScoreThreshold ... ScoreThreshold float32 // DistanceThreshold ... DistanceThreshold float32 // DurationThreshold ... DurationThreshold int32 }
MovementCorrectedEvent is an event sent by the server to correct movement client side.
type MultiRecipe ¶
type MultiRecipe struct { // UUID is a UUID identifying the recipe. This can actually be set to an empty UUID if the CraftingEvent // packet is not used. UUID uuid.UUID // RecipeNetworkID is a unique ID used to identify the recipe over network. Each recipe must have a unique // network ID. Recommended is to just increment a variable for each unique recipe registered. // This field must never be 0. RecipeNetworkID uint32 }
MultiRecipe serves as an 'enable' switch for multi-shape recipes.
type NormalTransactionData ¶
type NormalTransactionData struct{}
NormalTransactionData represents an inventory transaction data object for normal transactions, such as crafting. It has no content.
type Optional ¶
type Optional[T any] struct { // contains filtered or unexported fields }
Optional is an optional type in the protocol. If not set, only a false bool is written. If set, a true bool is written and the Marshaler.
type PatternRemovedEvent ¶
type PatternRemovedEvent struct { // ItemID ... ItemID int32 // AuxValue ... AuxValue int32 // PatternsSize ... PatternsSize int32 // PatternIndex ... PatternIndex int32 // PatternColour ... PatternColour int32 }
PatternRemovedEvent is the event data sent when a pattern is removed. This is now deprecated.
type PersonaPiece ¶
type PersonaPiece struct { // PieceId is a UUID that identifies the piece itself, which is unique for each separate piece. PieceID string // PieceType holds the type of the piece. Several types I was able to find immediately are listed below. // - persona_skeleton // - persona_body // - persona_skin // - persona_bottom // - persona_feet // - persona_top // - persona_mouth // - persona_hair // - persona_eyes // - persona_facial_hair PieceType string // PackID is a UUID that identifies the pack that the persona piece belongs to. PackID string // Default specifies if the piece is one of the default pieces. This is true when the piece is one of // those that a Steve or Alex skin have. Default bool // ProductID is a UUID that identifies the piece when it comes to purchases. It is empty for pieces that // have the 'Default' field set to true. ProductID string }
PersonaPiece represents a piece of a persona skin. All pieces are sent separately.
func (*PersonaPiece) Marshal ¶
func (x *PersonaPiece) Marshal(r IO)
Marshal encodes/decodes a PersonaPiece.
type PersonaPieceTintColour ¶
type PersonaPieceTintColour struct { // PieceType is the type of the persona skin piece that this tint colour concerns. The piece type must // always be present in the persona pieces list, but not each piece type has a tint colour sent. // Pieces that do have a tint colour that I was able to find immediately are listed below. // - persona_mouth // - persona_eyes // - persona_hair PieceType string // Colours is a list four colours written in hex notation (note, that unlike the SkinColour field in // the ClientData struct, this is actually ARGB, not just RGB). // The colours refer to different parts of the skin piece. The 'persona_eyes' may have the following // colours: ["#ffa12722","#ff2f1f0f","#ff3aafd9","#0"] // The first hex colour represents the tint colour of the iris, the second hex colour represents the // eyebrows and the third represents the sclera. The fourth is #0 because there are only 3 parts of the // persona_eyes skin piece. Colours []string }
PersonaPieceTintColour describes the tint colours of a specific piece of a persona skin.
func (*PersonaPieceTintColour) Marshal ¶
func (x *PersonaPieceTintColour) Marshal(r IO)
Marshal encodes/decodes a PersonaPieceTintColour.
type PetDiedEvent ¶
type PetDiedEvent struct { // KilledByOwner ... KilledByOwner bool // KillerEntityUniqueID ... KillerEntityUniqueID int64 // PetEntityUniqueID ... PetEntityUniqueID int64 // EntityDamageCause ... EntityDamageCause int32 // PetEntityType ... PetEntityType int32 }
PetDiedEvent is the event data sent when a pet dies. This is now deprecated.
type PixelRequest ¶
PixelRequest is the request for the colour of a pixel in a MapInfoRequest packet.
func (*PixelRequest) Marshal ¶
func (x *PixelRequest) Marshal(r IO)
Marshal encodes/decodes a PixelRequest.
type PlaceInContainerStackRequestAction ¶
type PlaceInContainerStackRequestAction struct {
// contains filtered or unexported fields
}
PlaceInContainerStackRequestAction currently has no known purpose.
type PlaceStackRequestAction ¶
type PlaceStackRequestAction struct {
// contains filtered or unexported fields
}
PlaceStackRequestAction is sent by the client to the server to place x amount of items from one slot into another slot, such as when shift clicking an item in the inventory to move it around or when moving an item in the cursor into a slot.
type PlayerBlockAction ¶
type PlayerBlockAction struct { // Action is the action to be performed, and is one of the constants listed above. Action int32 // BlockPos is the position of the block that was interacted with. BlockPos BlockPos // Face is the face of the block that was interacted with. Face int32 }
PlayerBlockAction ...
func (*PlayerBlockAction) Marshal ¶
func (x *PlayerBlockAction) Marshal(r IO)
Marshal encodes/decodes a PlayerBlockAction.
type PlayerDiedEvent ¶
type PlayerDiedEvent struct { // AttackerEntityID ... AttackerEntityID int32 // AttackerVariant ... AttackerVariant int32 // EntityDamageCause ... EntityDamageCause int32 // InRaid ... InRaid bool }
PlayerDiedEvent is the event data sent when a player dies.
type PlayerListEntry ¶
type PlayerListEntry 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 correct XBOX Live icon to show up in the list. UUID uuid.UUID // EntityUniqueID is the unique entity ID of the player. This ID typically stays consistent during the // lifetime of a world, but servers often send the runtime ID for this. EntityUniqueID int64 // Username is the username that is shown in the player list of the player that obtains a PlayerList // packet with this entry. It does not have to be the same as the actual username of the player. Username string // 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. 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 // BuildPlatform is the platform of the player as sent by that player in the Login packet. BuildPlatform int32 // Skin is the skin of the player that should be added to the player list. Once sent here, it will not // have to be sent again. Skin Skin // Teacher is a Minecraft: Education Edition field. It specifies if the player to be added to the player // list is a teacher. Teacher bool // Host specifies if the player that is added to the player list is the host of the game. Host bool }
PlayerListEntry is an entry found in the PlayerList packet. It represents a single player using the UUID found in the entry, and contains several properties such as the skin.
func (*PlayerListEntry) Marshal ¶
func (x *PlayerListEntry) Marshal(r IO)
Marshal encodes/decodes a PlayerListEntry.
type PlayerMovementSettings ¶
type PlayerMovementSettings struct { // MovementType specifies the way the server handles player movement. Available options are // protocol.PlayerMovementModeClient, protocol.PlayerMovementModeServer and // protocol.PlayerMovementModeServerWithRewind, where the server authoritative types result // in the client sending PlayerAuthInput packets instead of MovePlayer packets and the rewind mode // requires sending the tick of movement and several actions. MovementType int32 // RewindHistorySize is the amount of history to keep at maximum if MovementType is // protocol.PlayerMovementModeServerWithRewind. RewindHistorySize int32 // ServerAuthoritativeBlockBreaking specifies if block breaking should be sent through // packet.PlayerAuthInput or not. This field is somewhat redundant as it is always enabled if // MovementType is packet.AuthoritativeMovementModeServer or // protocol.PlayerMovementModeServerWithRewind ServerAuthoritativeBlockBreaking bool }
PlayerMovementSettings represents the different server authoritative movement settings. These control how the client will provide input to the server.
type PortalBuiltEvent ¶
type PortalBuiltEvent struct { // DimensionID ... DimensionID int32 }
PortalBuiltEvent is the event data sent when a portal is built.
type PortalUsedEvent ¶
type PortalUsedEvent struct { // FromDimensionID ... FromDimensionID int32 // ToDimensionID ... ToDimensionID int32 }
PortalUsedEvent is the event data sent when a portal is used.
type PotionContainerChangeRecipe ¶
type PotionContainerChangeRecipe struct { // InputItemID is the item ID of the item to be put in. This is typically either the ID of a normal potion // or a splash potion. InputItemID int32 // ReagentItemID is the item ID of the item that needs to be added to the container in order to create the // output item. ReagentItemID int32 // OutputItemID is the item that is created using a combination of the InputItem and ReagentItem, which is // typically either the ID of a splash potion or a lingering potion. OutputItemID int32 }
PotionContainerChangeRecipe represents a recipe to turn a potion from one type to another. This means from a drinkable potion + gunpowder -> splash potion, and from a splash potion + dragon breath -> lingering potion.
func (*PotionContainerChangeRecipe) Marshal ¶
func (x *PotionContainerChangeRecipe) Marshal(r IO)
Marshal encodes/decodes a PotionContainerChangeRecipe.
type PotionRecipe ¶
type PotionRecipe struct { // InputPotionID is the item ID of the potion to be put in. InputPotionID int32 // InputPotionMetadata is the type of the potion to be put in. This is typically the meta of the // awkward potion (or water bottle to create an awkward potion). InputPotionMetadata int32 // ReagentItemID is the item ID of the item that needs to be added to the brewing stand in order to brew // the output potion. ReagentItemID int32 // ReagentItemMetadata is the metadata value of the item that needs to be added to the brewing stand in // order to brew the output potion. ReagentItemMetadata int32 // OutputPotionID is the item ID of the potion obtained as a result of the brewing recipe. OutputPotionID int32 // OutputPotionMetadata is the type of the potion that is obtained as a result of brewing the input // potion with the reagent item. OutputPotionMetadata int32 }
PotionRecipe represents a potion mixing recipe which may be used in a brewing stand.
func (*PotionRecipe) Marshal ¶
func (x *PotionRecipe) Marshal(r IO)
Marshal encodes/decodes a PotionRecipe.
type PtrMarshaler ¶
PtrMarshaler represents a type that implements Marshaler for its pointer.
type RaidUpdateEvent ¶
type RaidUpdateEvent struct { // CurrentRaidWave ... CurrentRaidWave int32 // TotalRaidWaves ... TotalRaidWaves int32 // WonRaid ... WonRaid bool }
RaidUpdateEvent is an event used to update a raids progress client side.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader implements reading operations for reading types from Minecraft packets. Each Packet implementation has one passed to it. Reader's uses should always be encapsulated with a deferred recovery. Reader panics on invalid data.
func NewReader ¶
NewReader creates a new Reader using the io.ByteReader passed as underlying source to read bytes from.
func (*Reader) AbilityValue ¶
AbilityValue reads an ability value from the reader.
func (*Reader) BlockPos ¶
BlockPos reads three varint32s into a BlockPos from the underlying buffer.
func (*Reader) ByteSlice ¶
ByteSlice reads a byte slice from the underlying buffer, similarly to String.
func (*Reader) CompressedBiomeDefinitions ¶
CompressedBiomeDefinitions reads a list of compressed biome definitions from the reader. Minecraft decided to make their own type of compression for this, so we have to implement it ourselves. It uses a dictionary of repeated byte sequences to reduce the size of the data. The compressed data is read byte-by-byte, and if the byte is 0xff then it is assumed that the next two bytes are an int16 for the dictionary index. Otherwise, the byte is copied to the output. The dictionary index is then used to look up the byte sequence to be appended to the output.
func (*Reader) EntityMetadata ¶
EntityMetadata reads an entity metadata map from the underlying buffer into map x.
func (*Reader) InvalidValue ¶
InvalidValue panics with an error indicating that the value passed is not valid for a specific field.
func (*Reader) ItemDescriptorCount ¶
func (r *Reader) ItemDescriptorCount(i *ItemDescriptorCount)
ItemDescriptorCount reads an ItemDescriptorCount i from the underlying buffer.
func (*Reader) ItemInstance ¶
func (r *Reader) ItemInstance(i *ItemInstance)
ItemInstance reads an ItemInstance i from the underlying buffer.
func (*Reader) LimitInt32 ¶
LimitInt32 checks if the value passed is lower than the limit passed and higher than the minimum. If not, the Reader panics.
func (*Reader) LimitUint32 ¶
LimitUint32 checks if the value passed is lower than the limit passed. If not, the Reader panics.
func (*Reader) MaterialReducer ¶
func (r *Reader) MaterialReducer(m *MaterialReducer)
MaterialReducer reads a material reducer from the reader.
func (*Reader) PlayerInventoryAction ¶
func (r *Reader) PlayerInventoryAction(x *UseItemTransactionData)
PlayerInventoryAction reads a PlayerInventoryAction.
func (*Reader) StackRequestAction ¶
func (r *Reader) StackRequestAction(x *StackRequestAction)
StackRequestAction reads a StackRequestAction from the reader.
func (*Reader) SubChunkPos ¶
func (r *Reader) SubChunkPos(x *SubChunkPos)
SubChunkPos writes a SubChunkPos as 3 varint32s to the underlying buffer.
func (*Reader) TransactionDataType ¶
func (r *Reader) TransactionDataType(x *InventoryTransactionData)
TransactionDataType reads an InventoryTransactionData type from the reader.
func (*Reader) UBlockPos ¶
UBlockPos reads three varint32s, one unsigned for the y, into a BlockPos from the underlying buffer.
func (*Reader) UnknownEnumOption ¶
UnknownEnumOption panics with an unknown enum option error.
type Recipe ¶
type Recipe interface { // Marshal encodes the recipe data to its binary representation into buf. Marshal(w *Writer) // Unmarshal decodes a serialised recipe from Reader r into the recipe instance. Unmarshal(r *Reader) }
Recipe represents a recipe that may be sent in a CraftingData packet to let the client know what recipes are available server-side.
type ReleaseItemTransactionData ¶
type ReleaseItemTransactionData struct { // ActionType is the type of the ReleaseItem inventory transaction. It is one of the action types found // in the constants above, and specifies the way the item was released. // As of 1.13, the ActionType is always 0. This field can be ignored, because releasing food (by consuming // it) or releasing a bow (to shoot an arrow) is essentially the same. ActionType uint32 // HotBarSlot is the hot bar slot that the player was holding while releasing the item. It should be used // to ensure that the hot bar slot and held item are correctly synchronised with the server. HotBarSlot int32 // HeldItem is the item that was released. The server should check if this item is actually present in the // HotBarSlot. HeldItem ItemInstance // HeadPosition is the position of the player's head at the time of releasing the item. This is used // mainly for purposes such as spawning eating particles at that position. HeadPosition mgl32.Vec3 }
ReleaseItemTransactionData represents an inventory transaction data object sent when the client releases the item it was using, for example when stopping while eating or stopping the charging of a bow.
func (*ReleaseItemTransactionData) Marshal ¶
func (data *ReleaseItemTransactionData) Marshal(r IO)
Marshal ...
type ScoreboardEntry ¶
type ScoreboardEntry struct { // EntryID is a unique identifier of this entry. Each entry that represents a different value should get // its own entry ID. When modifying a scoreboard, entries that represent the same line should have the // same entry ID. EntryID int64 // ObjectiveName is the name of the objective that this scoreboard entry is for. It must be identical to // the one set in the SetDisplayObjective packet previously sent. ObjectiveName string // Score is the score that the entry represents. Scoreboard entries are ordered using this score, so in // order to get the scoreboard to be ordered as expected when trying to write non-score related text on // a scoreboard, this score should be incremented for each entry. Score int32 // IdentityType is the identity type of the scoreboard entry. The entry may represent an entity, player or // a fake player, as the constants above indicate. // In order to write plain text to the scoreboard, ScoreboardIdentityFakePlayer should always be used, in // combination with the DisplayName field. A different identity type will use the name of the entity. IdentityType byte // EntityUniqueID is the unique ID of either the player or the entity represented by the scoreboard entry. // This field is only used if IdentityType is either ScoreboardIdentityEntity or ScoreboardIdentityPlayer. EntityUniqueID int64 // DisplayName is the custom name of the scoreboard entry. This field is only used if IdentityType is // ScoreboardIdentityFakePlayer. If this identity type is not used, the name of the entity/player will be // shown instead. DisplayName string }
ScoreboardEntry represents a single entry that may be found on a scoreboard. These entries represent a line on the scoreboard each.
func (*ScoreboardEntry) Marshal ¶
func (x *ScoreboardEntry) Marshal(r IO)
Marshal encodes/decodes a ScoreboardEntry x as an entry for modification.
type ScoreboardIdentityEntry ¶
type ScoreboardIdentityEntry struct { // EntryID is the unique identifier of the entry that the identity should be associated with, or that // associations should be cleared from. EntryID int64 // EntityUniqueID is the unique ID that the entry should be associated with. It is empty if the // SetScoreboardIdentity packet is sent to remove associations with identities. EntityUniqueID int64 }
ScoreboardIdentityEntry holds an entry to either associate an identity with one of the entries in a scoreboard, or to remove associations.
func (*ScoreboardIdentityEntry) Marshal ¶
func (x *ScoreboardIdentityEntry) Marshal(r IO)
Marshal encodes/decodes a ScoreboardIdentityEntry.
type ShapedChemistryRecipe ¶
type ShapedChemistryRecipe struct {
ShapedRecipe
}
ShapedChemistryRecipe is a recipe specifically made for chemistry related features, which exist only in the Education Edition. It functions the same as a normal ShapedRecipe.
func (*ShapedChemistryRecipe) Marshal ¶
func (recipe *ShapedChemistryRecipe) Marshal(w *Writer)
Marshal ...
func (*ShapedChemistryRecipe) Unmarshal ¶
func (recipe *ShapedChemistryRecipe) Unmarshal(r *Reader)
Unmarshal ...
type ShapedRecipe ¶
type ShapedRecipe struct { // RecipeID is a unique ID of the recipe. This ID must be unique amongst all other types of recipes too, // but its functionality is not exactly known. RecipeID string // Width is the width of the recipe's shape. Width int32 // Height is the height of the recipe's shape. Height int32 // Input is a list of items that serve as the input of the shapeless recipe. These items are the items // required to craft the output. The amount of input items must be exactly equal to Width * Height. Input []ItemDescriptorCount // Output is a list of items that are created as a result of crafting the recipe. Output []ItemStack // UUID is a UUID identifying the recipe. This can actually be set to an empty UUID if the CraftingEvent // packet is not used. UUID uuid.UUID // Block is the block name that is required to craft the output of the recipe. The block is not prefixed // with 'minecraft:', so it will look like 'crafting_table' as an example. Block string // Priority ... Priority int32 // RecipeNetworkID is a unique ID used to identify the recipe over network. Each recipe must have a unique // network ID. Recommended is to just increment a variable for each unique recipe registered. // This field must never be 0. RecipeNetworkID uint32 }
ShapedRecipe is a recipe that has a specific shape that must be used to craft the output of the recipe. Trying to craft the item in any other shape will not work. The ShapedRecipe is of the same structure as the ShapedChemistryRecipe.
type ShapelessChemistryRecipe ¶
type ShapelessChemistryRecipe struct {
ShapelessRecipe
}
ShapelessChemistryRecipe is a recipe specifically made for chemistry related features, which exist only in the Education Edition. They function the same as shapeless recipes do.
func (*ShapelessChemistryRecipe) Marshal ¶
func (recipe *ShapelessChemistryRecipe) Marshal(w *Writer)
Marshal ...
func (*ShapelessChemistryRecipe) Unmarshal ¶
func (recipe *ShapelessChemistryRecipe) Unmarshal(r *Reader)
Unmarshal ...
type ShapelessRecipe ¶
type ShapelessRecipe struct { // RecipeID is a unique ID of the recipe. This ID must be unique amongst all other types of recipes too, // but its functionality is not exactly known. RecipeID string // Input is a list of items that serve as the input of the shapeless recipe. These items are the items // required to craft the output. Input []ItemDescriptorCount // Output is a list of items that are created as a result of crafting the recipe. Output []ItemStack // UUID is a UUID identifying the recipe. This can actually be set to an empty UUID if the CraftingEvent // packet is not used. UUID uuid.UUID // Block is the block name that is required to craft the output of the recipe. The block is not prefixed // with 'minecraft:', so it will look like 'crafting_table' as an example. // The available blocks are: // - crafting_table // - cartography_table // - stonecutter // - furnace // - blast_furnace // - smoker // - campfire Block string // Priority ... Priority int32 // RecipeNetworkID is a unique ID used to identify the recipe over network. Each recipe must have a unique // network ID. Recommended is to just increment a variable for each unique recipe registered. // This field must never be 0. RecipeNetworkID uint32 }
ShapelessRecipe is a recipe that has no particular shape. Its functionality is shared with the RecipeShulkerBox and RecipeShapelessChemistry types.
func (*ShapelessRecipe) Unmarshal ¶
func (recipe *ShapelessRecipe) Unmarshal(r *Reader)
Unmarshal ...
type ShulkerBoxRecipe ¶
type ShulkerBoxRecipe struct {
ShapelessRecipe
}
ShulkerBoxRecipe is a shapeless recipe made specifically for shulker box crafting, so that they don't lose their user data when dyeing a shulker box.
func (*ShulkerBoxRecipe) Unmarshal ¶
func (recipe *ShulkerBoxRecipe) Unmarshal(r *Reader)
Unmarshal ...
type Skin ¶
type Skin struct { // SkinID is a unique ID produced for the skin, for example 'c18e65aa-7b21-4637-9b63-8ad63622ef01_Alex' // for the default Alex skin. SkinID string // PlayFabID is the PlayFab ID produced for the skin. PlayFab is the company that hosts the Marketplace, // skins and other related features from the game. This ID is the ID of the skin used to store the skin // inside of PlayFab. PlayFabID string // SkinResourcePatch is a JSON encoded object holding some fields that point to the geometry that the // skin has. // The JSON object that this holds specifies the way that the geometry of animations and the default skin // of the player are combined. SkinResourcePatch []byte // SkinImageWidth and SkinImageHeight hold the dimensions of the skin image. Note that these are not the // dimensions in bytes, but in pixels. SkinImageWidth, SkinImageHeight uint32 // SkinData is a byte slice of SkinImageWidth * SkinImageHeight bytes. It is an RGBA ordered byte // representation of the skin pixels. SkinData []byte // Animations is a list of all animations that the skin has. Animations []SkinAnimation // CapeImageWidth and CapeImageHeight hold the dimensions of the cape image. Note that these are not the // dimensions in bytes, but in pixels. CapeImageWidth, CapeImageHeight uint32 // CapeData is a byte slice of 64*32*4 bytes. It is a RGBA ordered byte representation of the cape // colours, much like the SkinData. CapeData []byte // SkinGeometry is a JSON encoded structure of the geometry data of a skin, containing properties // such as bones, uv, pivot etc. SkinGeometry []byte // TODO: Find out what value AnimationData holds and when it does hold something. AnimationData []byte // GeometryDataEngineVersion ... GeometryDataEngineVersion []byte // PremiumSkin specifies if this is a skin that was purchased from the marketplace. PremiumSkin bool // PersonaSkin specifies if this is a skin that was created using the in-game skin creator. PersonaSkin bool // PersonaCapeOnClassicSkin specifies if the skin had a Persona cape (in-game skin creator cape) equipped // on a classic skin. PersonaCapeOnClassicSkin bool // PrimaryUser ... PrimaryUser bool // CapeID is a unique identifier that identifies the cape. It usually holds a UUID in it. CapeID string // FullID is an ID that represents the skin in full. The actual functionality is unknown: The client // does not seem to send a value for this. FullID string // SkinColour is a hex representation (including #) of the base colour of the skin. An example of the // colour sent here is '#b37b62'. SkinColour string // ArmSize is the size of the arms of the player's model. This is either 'wide' (generally for male skins) // or 'slim' (generally for female skins). ArmSize string // PersonaPieces is a list of all persona pieces that the skin is composed of. PersonaPieces []PersonaPiece // PieceTintColours is a list of specific tint colours for (some of) the persona pieces found in the list // above. PieceTintColours []PersonaPieceTintColour // Trusted specifies if the skin is 'trusted'. No code should rely on this field, as any proxy or client // can easily change it. Trusted bool // OverrideAppearance specifies if the skin should override the player's skin that is equipped client-side. // When false, the client will reject the skin and continue to use the skin that the player has equipped. OverrideAppearance bool }
Skin represents the skin of a player as sent over network. The skin holds a texture and a model, and optional animations which may be present when the skin is created using persona or bought from the marketplace.
type SkinAnimation ¶
type SkinAnimation struct {
// ImageWidth and ImageHeight hold the dimensions of the animation image. Note that these are not the
// dimensions in bytes, but in pixels.
ImageWidth, ImageHeight uint32
// ImageData is a byte slice of ImageWidth * ImageHeight bytes. It is an RGBA ordered byte representation
// of the animation image pixels. The ImageData contains FrameCount images in it, which each represent one
// stage of the animation. The actual part of the skin that this field holds depends on the AnimationType,
// where SkinAnimationHead holds only the head and its hat, whereas the other animations hold the entire
// body of the skin.
ImageData []byte
// AnimationType is the type of the animation, which is one of the types found above. The data that
// ImageData contains depends on this type.
AnimationType uint32
// FrameCount is the amount of frames that the skin animation holds. The number of frames here is the
// amount of images that may be found in the ImageData field.
FrameCount float32
// ExpressionType is the type of expression made by the skin, which is one the types found above.
ExpressionType uint32
}
SkinAnimation represents an animation that may be added to a skin. The client plays the animation itself, without the server having to do so. The rate at which these animations play appears to be decided by the client.
func (*SkinAnimation) Marshal ¶
func (x *SkinAnimation) Marshal(r IO)
Marshal encodes/decodes a SkinAnimation.
type SlashCommandExecutedEvent ¶
type SlashCommandExecutedEvent struct { // CommandName ... CommandName string // SuccessCount ... SuccessCount int32 // MessageCount indicates the amount of OutputMessages present. MessageCount int32 // OutputMessages is a list of messages joint with ;. OutputMessages string }
SlashCommandExecutedEvent is the event data sent when a slash command is executed.
func (*SlashCommandExecutedEvent) Marshal ¶
func (s *SlashCommandExecutedEvent) Marshal(r IO)
Marshal ...
type SmithingTransformRecipe ¶
type SmithingTransformRecipe struct { // RecipeNetworkID is a unique ID used to identify the recipe over network. Each recipe must have a unique // network ID. Recommended is to just increment a variable for each unique recipe registered. // This field must never be 0. RecipeNetworkID uint32 // RecipeID is a unique ID of the recipe. This ID must be unique amongst all other types of recipes too, // but its functionality is not exactly known. RecipeID string // Template is the item that is used to shape the Base item based on the Addition being applied. Template ItemDescriptorCount // Base is the item that the Addition is being applied to in the smithing table. Base ItemDescriptorCount // Addition is the item that is being added to the Base item to result in a modified item. Addition ItemDescriptorCount // Result is the resulting item from the two items being added together. Result ItemStack // Block is the block name that is required to create the output of the recipe. The block is not prefixed with // 'minecraft:', so it will look like 'smithing_table' as an example. Block string }
SmithingTransformRecipe is a recipe specifically used for smithing tables. It has three input items and adds them together, resulting in a new item.
func (*SmithingTransformRecipe) Marshal ¶
func (recipe *SmithingTransformRecipe) Marshal(w *Writer)
Marshal ...
func (*SmithingTransformRecipe) Unmarshal ¶
func (recipe *SmithingTransformRecipe) Unmarshal(r *Reader)
Unmarshal ...
type SmithingTrimRecipe ¶
type SmithingTrimRecipe struct { // RecipeNetworkID is a unique ID used to identify the recipe over network. Each recipe must have a unique // network ID. Recommended is to just increment a variable for each unique recipe registered. // This field must never be 0. RecipeNetworkID uint32 // RecipeID is a unique ID of the recipe. This ID must be unique amongst all other types of recipes too, // but its functionality is not exactly known. RecipeID string // Template is the item that is used to shape the Base item based on the Addition being applied. Template ItemDescriptorCount // Base is the item that the Addition is being applied to in the smithing table. Base ItemDescriptorCount // Addition is the item that is being added to the Base item to result in a modified item. Addition ItemDescriptorCount // Block is the block name that is required to create the output of the recipe. The block is not prefixed with // 'minecraft:', so it will look like 'smithing_table' as an example. Block string }
SmithingTrimRecipe is a recipe specifically used for applying armour trims to an armour piece inside a smithing table.
func (*SmithingTrimRecipe) Marshal ¶
func (recipe *SmithingTrimRecipe) Marshal(w *Writer)
Marshal ...
func (*SmithingTrimRecipe) Unmarshal ¶
func (recipe *SmithingTrimRecipe) Unmarshal(r *Reader)
Unmarshal ...
type SneakCloseToSculkSensorEvent ¶
type SneakCloseToSculkSensorEvent struct{}
SneakCloseToSculkSensorEvent is an event sent by the server when a player sneaks close to an sculk block.
func (*SneakCloseToSculkSensorEvent) Marshal ¶
func (u *SneakCloseToSculkSensorEvent) Marshal(r IO)
Marshal ...
type StackRequestAction ¶
type StackRequestAction interface { Marshaler }
StackRequestAction represents a single action related to the inventory present in an ItemStackRequest. The action is one of the concrete types below, each of which are indicative of a different action by the client, such as moving an item around the inventory or placing a block. It is an alias of Marshaler.
type StackRequestSlotInfo ¶
type StackRequestSlotInfo struct { // ContainerID is the ID of the container that the slot was in. ContainerID byte // Slot is the index of the slot within the container with the ContainerID above. Slot byte // StackNetworkID is the unique stack ID that the client assumes to be present in this slot. The server // must check if these IDs match. If they do not match, servers should reject the stack request that the // action holding this info was in. StackNetworkID int32 }
StackRequestSlotInfo holds information on a specific slot client-side.
type StackResourcePack ¶
type StackResourcePack struct { // UUID is the UUID of the resource pack. Each resource pack downloaded must have a different UUID in // order for the client to be able to handle them properly. UUID string // Version is the version of the resource pack. The client will cache resource packs sent by the server as // long as they carry the same version. Sending a resource pack with a different version than previously // will force the client to re-download it. Version string // SubPackName ... SubPackName string }
StackResourcePack represents a resource pack sent on the stack of the client. When sent, the client will apply them in the order of the stack sent.
func (*StackResourcePack) Marshal ¶
func (x *StackResourcePack) Marshal(r IO)
Marshal encodes/decodes a StackResourcePack.
type StackResponseContainerInfo ¶
type StackResponseContainerInfo struct { // ContainerID is the container ID of the container that the slots that follow are in. For the main // inventory, this value seems to be 0x1b. For the cursor, this value seems to be 0x3a. For the crafting // grid, this value seems to be 0x0d. ContainerID byte // SlotInfo holds information on what item stack should be present in specific slots in the container. SlotInfo []StackResponseSlotInfo }
StackResponseContainerInfo holds information on what slots in a container have what item stack in them.
func (*StackResponseContainerInfo) Marshal ¶
func (x *StackResponseContainerInfo) Marshal(r IO)
Marshal encodes/decodes a StackResponseContainerInfo.
type StackResponseSlotInfo ¶
type StackResponseSlotInfo struct {
// Slot and HotbarSlot seem to be the same value every time: The slot that was actually changed. I'm not
// sure if these slots ever differ.
Slot, HotbarSlot byte
// Count is the total count of the item stack. This count will be shown client-side after the response is
// sent to the client.
Count byte
// StackNetworkID is the network ID of the new stack at a specific slot.
StackNetworkID int32
// CustomName is the custom name of the item stack. It is used in relation to text filtering.
CustomName string
// DurabilityCorrection is the current durability of the item stack. This durability will be shown
// client-side after the response is sent to the client.
DurabilityCorrection int32
}
StackResponseSlotInfo holds information on what item stack should be present in a specific slot.
func (*StackResponseSlotInfo) Marshal ¶
func (x *StackResponseSlotInfo) Marshal(r IO)
Marshal encodes/decodes a StackResponseSlotInfo.
type StructureSettings ¶
type StructureSettings struct { // PaletteName is the name of the palette used in the structure. Currently, it seems that this field is // always 'default'. PaletteName string // IgnoreEntities specifies if the structure should ignore entities or include them. If set to false, // entities will also show up in the exported structure. IgnoreEntities bool // IgnoreBlocks specifies if the structure should ignore blocks or include them. If set to false, blocks // will show up in the exported structure. IgnoreBlocks bool // AllowNonTickingChunks specifies if the structure should allow non-ticking chunks. If set to false, the structure // will export non-ticking chunks. AllowNonTickingChunks bool // Size is the size of the area that is about to be exported. The area exported will start at the // Position + Offset, and will extend as far as Size specifies. Size BlockPos // Offset is the offset position that was set in the structure block. The area exported is offset by this // position. Offset BlockPos // LastEditingPlayerUniqueID is the unique ID of the player that last edited the structure block that // these settings concern. LastEditingPlayerUniqueID int64 // Rotation is the rotation that the structure block should obtain. See the constants above for available // options. Rotation byte // Mirror specifies the way the structure should be mirrored. It is either no mirror at all, mirror on the // x/z axis or both. Mirror byte // AnimationMode ... AnimationMode byte // AnimationDuration ... AnimationDuration float32 // Integrity is usually 1, but may be set to a number between 0 and 1 to omit blocks randomly, using // the Seed that follows. Integrity float32 // Seed is the seed used to omit blocks if Integrity is not equal to one. If the Seed is 0, a random // seed is selected to omit blocks. Seed uint32 // Pivot is the pivot around which the structure may be rotated. Pivot mgl32.Vec3 }
StructureSettings is a struct holding settings of a structure block. Its fields may be changed using the in-game UI on the client-side.
func (*StructureSettings) Marshal ¶
func (x *StructureSettings) Marshal(r IO)
Marshal reads/writes StructureSettings x using IO r.
type SubChunkEntry ¶
type SubChunkEntry struct { // Offset contains the offset between the sub-chunk position and the center position. Offset SubChunkOffset // Result is always one of the constants defined in the SubChunkResult constants. Result byte // RawPayload contains the serialized sub-chunk data. RawPayload []byte // HeightMapType is always one of the constants defined in the HeightMapData constants. HeightMapType byte // HeightMapData is the data for the height map. HeightMapData []int8 // BlobHash is the hash of the blob. BlobHash uint64 }
SubChunkEntry contains the data of a sub-chunk entry relative to a center sub chunk position, used for the sub-chunk requesting system introduced in v1.18.10.
func (*SubChunkEntry) Marshal ¶
func (x *SubChunkEntry) Marshal(r IO)
Marshal encodes/decodes a SubChunkEntry assuming the blob cache is enabled.
type SubChunkOffset ¶
type SubChunkOffset [3]int8
SubChunkOffset represents an offset from the base position of another sub chunk.
func (*SubChunkOffset) Marshal ¶
func (x *SubChunkOffset) Marshal(r IO)
Marshal encodes/decodes a SubChunkOffset.
type SubChunkPos ¶
type SubChunkPos [3]int32
SubChunkPos is the position of a sub-chunk. The X and Z coordinates are the coordinates of the chunk, and the Y coordinate is the absolute sub-chunk index.
func (SubChunkPos) X ¶
func (pos SubChunkPos) X() int32
X returns the X coordinate of the sub-chunk position. It is equivalent to SubChunkPos[0].
func (SubChunkPos) Y ¶
func (pos SubChunkPos) Y() int32
Y returns the Y coordinate of the sub-chunk position. It is equivalent to SubChunkPos[1].
func (SubChunkPos) Z ¶
func (pos SubChunkPos) Z() int32
Z returns the Z coordinate of the sub-chunk position. It is equivalent to SubChunkPos[2].
type SwapStackRequestAction ¶
type SwapStackRequestAction struct {
// Source and Destination point to the source slot from which Count of the item stack were taken and the
// destination slot to which this item was moved.
Source, Destination StackRequestSlotInfo
}
SwapStackRequestAction is sent by the client to swap the item in its cursor with an item present in another container. The two item stacks swap places.
type TakeOutContainerStackRequestAction ¶
type TakeOutContainerStackRequestAction struct {
// contains filtered or unexported fields
}
TakeOutContainerStackRequestAction currently has no known purpose.
type TakeStackRequestAction ¶
type TakeStackRequestAction struct {
// contains filtered or unexported fields
}
TakeStackRequestAction is sent by the client to the server to take x amount of items from one slot in a container to the cursor.
type TexturePackInfo ¶
type TexturePackInfo struct { // UUID is the UUID of the texture pack. Each texture pack downloaded must have a different UUID in // order for the client to be able to handle them properly. UUID string // Version is the version of the texture pack. The client will cache texture packs sent by the server as // long as they carry the same version. Sending a texture pack with a different version than previously // will force the client to re-download it. Version string // Size is the total size in bytes that the texture pack occupies. This is the size of the compressed // archive (zip) of the texture pack. Size uint64 // ContentKey is the key used to decrypt the behaviour pack if it is encrypted. This is generally the case // for marketplace texture packs. ContentKey string // SubPackName ... SubPackName string // ContentIdentity is another UUID for the resource pack, and is generally set for marketplace texture // packs. It is also required for client-side validations when the resource pack is encrypted. ContentIdentity string // HasScripts specifies if the texture packs has any scripts in it. A client will only download the // behaviour pack if it supports scripts, which, up to 1.11, only includes Windows 10. HasScripts bool // RTXEnabled specifies if the texture pack uses the raytracing technology introduced in 1.16.200. RTXEnabled bool }
TexturePackInfo represents a texture pack's info sent over network. It holds information about the texture pack such as its name, description and version.
func (*TexturePackInfo) Marshal ¶
func (x *TexturePackInfo) Marshal(r IO)
Marshal encodes/decodes a TexturePackInfo.
type TrimMaterial ¶
type TrimMaterial struct { // MaterialID is the identifier of the material, for example 'netherite'. MaterialID string // Colour is the colour code used for text formatting, for example '§j'. Colour string // ItemName is the identifier of the item that represents the material, for example 'minecraft:netherite_ingot'. ItemName string }
TrimMaterial represents a material that can be used when applying an armour trim.
type TrimPattern ¶
type TrimPattern struct { // ItemName is the identifier of the item that represents the pattern, for example // 'minecraft:wayfinder_armor_trim_smithing_template'. ItemName string // PatternID is the identifier of the pattern, for example 'wayfinder'. PatternID string }
TrimPattern represnets a pattern that can be applied to an armour pice in combination with a TrimMaterial.
type UseItemOnEntityTransactionData ¶
type UseItemOnEntityTransactionData struct { // TargetEntityRuntimeID is the entity runtime ID of the target that was clicked. It is the runtime ID // that was assigned to it in the AddEntity packet. TargetEntityRuntimeID uint64 // ActionType is the type of the UseItemOnEntity inventory transaction. It is one of the action types // found in the constants above, and specifies the way the player interacted with the entity. ActionType uint32 // HotBarSlot is the hot bar slot that the player was holding while clicking the entity. It should be used // to ensure that the hot bar slot and held item are correctly synchronised with the server. HotBarSlot int32 // HeldItem is the item that was held to interact with the entity. The server should check if this item // is actually present in the HotBarSlot. HeldItem ItemInstance // Position is the position of the player at the time of clicking the entity. Position mgl32.Vec3 // ClickedPosition is the position that was clicked relative to the entity's base coordinate. It can be // used to find out exactly where a player clicked the entity. ClickedPosition mgl32.Vec3 }
UseItemOnEntityTransactionData represents an inventory transaction data object sent when the client uses an item on an entity.
func (*UseItemOnEntityTransactionData) Marshal ¶
func (data *UseItemOnEntityTransactionData) Marshal(r IO)
Marshal ...
type UseItemTransactionData ¶
type UseItemTransactionData 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 []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 []InventoryAction // ActionType is the type of the UseItem inventory transaction. It is one of the action types found above, // and specifies the way the player interacted with the block. ActionType uint32 // BlockPosition is the position of the block that was interacted with. This is only really a correct // block position if ActionType is not UseItemActionClickAir. BlockPosition BlockPos // BlockFace is the face of the block that was interacted with. When clicking the block, it is the face // clicked. When breaking the block, it is the face that was last being hit until the block broke. BlockFace int32 // HotBarSlot is the hot bar slot that the player was holding while clicking the block. It should be used // to ensure that the hot bar slot and held item are correctly synchronised with the server. HotBarSlot int32 // HeldItem is the item that was held to interact with the block. The server should check if this item // is actually present in the HotBarSlot. HeldItem ItemInstance // Position is the position of the player at the time of interaction. For clicking a block, this is the // position at that time, whereas for breaking the block it is the position at the time of breaking. Position mgl32.Vec3 // ClickedPosition is the position that was clicked relative to the block's base coordinate. It can be // used to find out exactly where a player clicked the block. ClickedPosition mgl32.Vec3 // BlockRuntimeID is the runtime ID of the block that was clicked. It may be used by the server to verify // that the player's world client-side is synchronised with the server's. BlockRuntimeID uint32 }
UseItemTransactionData represents an inventory transaction data object sent when the client uses an item on a block.
func (*UseItemTransactionData) Marshal ¶
func (data *UseItemTransactionData) Marshal(r IO)
Marshal ...
type WaxedOrUnwaxedCopperEvent ¶
type WaxedOrUnwaxedCopperEvent struct {
Type uint16
}
WaxedOrUnwaxedCopperEvent is an event sent by the server when a copper block is waxed or unwaxed.
func (*WaxedOrUnwaxedCopperEvent) Marshal ¶
func (w *WaxedOrUnwaxedCopperEvent) Marshal(r IO)
Marshal ...
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer implements writing methods for data types from Minecraft packets. Each Packet implementation has one passed to it when writing. Writer implements methods where values are passed using a pointer, so that Reader and Writer have a synonymous interface and both implement the IO interface.
func NewWriter ¶
NewWriter creates a new initialised Writer with an underlying io.ByteWriter to write to.
func (*Writer) AbilityValue ¶
AbilityValue writes an ability value to the writer.
func (*Writer) ByteFloat ¶
ByteFloat writes a rotational float32 as a single byte to the underlying buffer.
func (*Writer) ByteSlice ¶
ByteSlice writes a []byte, prefixed with a varuint32, to the underlying buffer.
func (*Writer) CompressedBiomeDefinitions ¶
CompressedBiomeDefinitions reads a list of compressed biome definitions from the reader. Minecraft decided to make their own type of compression for this, so we have to implement it ourselves. It uses a dictionary of repeated byte sequences to reduce the size of the data. The compressed data is read byte-by-byte, and if the byte is 0xff then it is assumed that the next two bytes are an int16 for the dictionary index. Otherwise, the byte is copied to the output. The dictionary index is then used to look up the byte sequence to be appended to the output.
func (*Writer) EntityMetadata ¶
EntityMetadata writes an entity metadata map x to the underlying buffer.
func (*Writer) InvalidValue ¶
InvalidValue panics with an invalid value error.
func (*Writer) ItemDescriptorCount ¶
func (w *Writer) ItemDescriptorCount(i *ItemDescriptorCount)
ItemDescriptorCount writes an ItemDescriptorCount i to the underlying buffer.
func (*Writer) ItemInstance ¶
func (w *Writer) ItemInstance(i *ItemInstance)
ItemInstance writes an ItemInstance i to the underlying buffer.
func (*Writer) MaterialReducer ¶
func (w *Writer) MaterialReducer(m *MaterialReducer)
MaterialReducer writes a material reducer to the writer.
func (*Writer) NBTList ¶
NBTList writes a slice as NBT to the underlying buffer using the encoding passed.
func (*Writer) PlayerInventoryAction ¶
func (w *Writer) PlayerInventoryAction(x *UseItemTransactionData)
PlayerInventoryAction writes a PlayerInventoryAction.
func (*Writer) StackRequestAction ¶
func (w *Writer) StackRequestAction(x *StackRequestAction)
StackRequestAction writes a StackRequestAction to the writer.
func (*Writer) String ¶
String writes a string, prefixed with a varuint32, to the underlying buffer.
func (*Writer) SubChunkPos ¶
func (w *Writer) SubChunkPos(x *SubChunkPos)
SubChunkPos writes a SubChunkPos as 3 varint32s to the underlying buffer.
func (*Writer) TransactionDataType ¶
func (w *Writer) TransactionDataType(x *InventoryTransactionData)
TransactionDataType writes an InventoryTransactionData type to the writer.
func (*Writer) UBlockPos ¶
UBlockPos writes a BlockPos as 2 varint32s and a varuint32 to the underlying buffer.
func (*Writer) UnknownEnumOption ¶
UnknownEnumOption panics with an unknown enum option error.
Source Files ¶
- ability.go
- attribute.go
- blob_cache.go
- block.go
- block_pos.go
- chunk_pos.go
- command.go
- container.go
- creative.go
- doc.go
- education.go
- enchant.go
- entity_link.go
- entity_metadata.go
- entity_properties.go
- events.go
- experiments.go
- game_rule.go
- info.go
- inventory.go
- io.go
- item.go
- item_descriptor.go
- item_stack.go
- map.go
- os.go
- player.go
- reader.go
- reader_little_endian.go
- recipe.go
- resource_pack.go
- scoreboard.go
- skin.go
- structure.go
- sub_chunk.go
- trim.go
- varint.go
- world.go
- writer.go
- writer_little_endian.go
Directories ¶
Path | Synopsis |
---|---|
Package login provides functions to decode and encode Minecraft login requests found in the Login packet connection request.
|
Package login provides functions to decode and encode Minecraft login requests found in the Login packet connection request. |
Package packet implements every packet in the Minecraft Bedrock Edition protocol using the functions found in the minecraft/protocol package.
|
Package packet implements every packet in the Minecraft Bedrock Edition protocol using the functions found in the minecraft/protocol package. |