event

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AcquisitionPickedUp
	AcquisitionCrafted
	AcquisitionTakenFromContainer

	AcquisitionForged
	AcquisitionSmelted
	AcquisitionBrewed
	AcquisitionFilledBottle
	AcquistionTraded
	AcquisitionFished
)
View Source
const (
	InteractedUse = iota
	InteractedPlace
)
View Source
const (
	ItemWorn = iota
	ItemEaten

	ItemDrunk
	ItemThrown
	ItemReleased
	ItemBlockEntityCreated // This is sent when a music disk is put in a music box, when an item frame is placed, when a brewing stand is placed, but also when a cake is placed...
	ItemBottleFilled
	ItemBucketFilled
	ItemBucketEmptied
	ItemUsedOnBlock
)
View Source
const (
	InteractTame

	InteractWithGolem
	InteractShave
	InteractMilk
	InteractTrade
	InteractFeed
	InteractIgnite
	InteractDye
	InteractNamed
	InteractLeash
	InteractUnleash

	InteractToggleSitting
)
View Source
const (
	KillMeleeAttack  = 2
	KillShot         = 3
	KillExplosion    = 11
	KillSplashPotion = 14
)
View Source
const (
	TeleportationCommand = iota
	TeleportationEnderPearl
	TeleportationChorusFruit
)
View Source
const (
	TravelWalking = iota
	TravelSwimmingInWater
	TravelFalling
	TravelClimbing
	TravelSwimmingInLava
	TravelFlying
	TravelVehicle
	TravelSneaking
	TravelSprinting
	TravelBouncing
)
View Source
const (
	ScreenStart                    = "start_screen"
	ScreenSettingsGame             = "screen_world_controls_and_settings - game_tab"
	ScreenSettingsMultiplayer      = "screen_world_controls_and_settings - multiplayer_tab"
	ScreenSettingsKeyboardAndMouse = "screen_world_controls_and_settings - keyboard_and_mouse_tab"
	ScreenSettingsController       = "screen_world_controls_and_settings - controller_tab"
	ScreenSettingsTouch            = "screen_world_controls_and_settings - touch_tab"
	ScreenSettingsProfile          = "screen_world_controls_and_settings - profile_tab"
	ScreenSettingsVideo            = "screen_world_controls_and_settings - video_tab"
	ScreenSettingsSound            = "screen_world_controls_and_settings - sound_tab"
	ScreenSettingsGlobalResources  = "screen_world_controls_and_settings - global_texture_pack_tab"
	ScreenSettingsHowToPlay        = "screen_world_controls_and_settings - how_to_play"
	ScreenSettingsResourcePacks    = "screen_world_controls_and_settings - level_texture_pack_tab"
	ScreenSettingsBehaviourPacks   = "screen_world_controls_and_settings - addon_tab"
	ScreenSettingsLanguage         = "screen_controls_and_settings - language_tab"
	ScreenSettingsStorage          = "screen_controls_and_settings - storage_tab"
	ScreenAchievement              = "achievement_screen"
	ScreenStore                    = "store_data_driven_screen - store_home_screen"

	ScreenWorlds                    = "play_screen - worlds"
	ScreenWorldTemplates            = "world_templates_screen"
	ScreenWorldCreateGame           = "screen_world_create - game_tab"
	ScreenWorldCreateMultiplayer    = "screen_world_create - multiplayer_tab"
	ScreenWorldCreateTexturePacks   = "screen_world_create - level_texture_pack_tab"
	ScreenWorldCreateBehaviourPacks = "screen_world_create - addon_tab"

	ScreenRealmCreate     = "realms_create_screen"
	ScreenRealmJoinByCode = "friends  - join_by_code"

	ScreenWorldLoadingProgress                 = "world_loading_progress_screen - local_world_load"
	ScreenWorldLoadingJoiningMultiplayerServer = "world_loading_progress_screen - joining_multiplayer_external_server"
	ScreenWorldSavingProgress                  = "world_saving_progress_screen"

	ScreenRatingPrompt = "rating_prompt_screen"

	ScreenFriends            = "play_screen - friends"
	ScreenServers            = "play_screen - servers"
	ScreenAddExternalServer  = "add_external_server_screen_new"
	ScreenEditExternalServer = "add_external_server_screen_edit"

	ScreenInGamePlay       = "in_game_play_screen"
	ScreenChat             = "chat_screen"
	ScreenPause            = "pause_screen"
	ScreenInventory        = "inventory_screen"
	ScreenFeedback         = "feedbackScreen.title - feedbackScreen.body"
	ScreenSkinPicker       = "skin_picker_screen"
	ScreenExpandedSkinPack = "expanded_skin_pack_screen"
	ScreenInvite           = "invite_screen"
	ScreenHowToPlay        = "how_to_play_screen"
)

Many of the available screen names are listed below. Note that various screens, such as realms error screens, marketplace screens etc. are dynamic and are thus not listed below.

View Source
const (
	AchievementRenewableEnergy = 40
)
View Source
const (
	DestructionBreak = iota
)
View Source
const (
	PlacementDefault = iota
)

Variables

View Source
var Events = map[Name]func() interface{}{
	NameAwardAchievement:     func() interface{} { return &AwardAchievement{} },
	NameBlockPlaced:          func() interface{} { return &BlockPlaced{} },
	NameBlockBroken:          func() interface{} { return &BlockBroken{} },
	NameEndOfDay:             func() interface{} { return &EndOfDay{} },
	NameGameRulesLoaded:      func() interface{} { return &GameRulesLoaded{} },
	NameGameRulesUpdated:     func() interface{} { return &GameRulesUpdated{} },
	NamePlayerMessage:        func() interface{} { return &PlayerMessage{} },
	NamePlayerTeleported:     func() interface{} { return &PlayerTeleported{} },
	NamePlayerTravelled:      func() interface{} { return &PlayerTravelled{} },
	NamePlayerTransform:      func() interface{} { return &PlayerTransform{} },
	NameItemAcquired:         func() interface{} { return &ItemAcquired{} },
	NameItemCrafted:          func() interface{} { return &ItemCrafted{} },
	NameItemDropped:          func() interface{} { return &ItemDropped{} },
	NameItemEquipped:         func() interface{} { return &ItemEquipped{} },
	NameItemInteracted:       func() interface{} { return &ItemInteracted{} },
	NameItemNamed:            func() interface{} { return &ItemNamed{} },
	NameItemSmelted:          func() interface{} { return &ItemSmelted{} },
	NameItemUsed:             func() interface{} { return &ItemUsed{} },
	NameBookEdited:           func() interface{} { return &BookEdited{} },
	NameSignedBookOpened:     func() interface{} { return &SignedBookOpened{} },
	NameMobBorn:              func() interface{} { return &MobBorn{} },
	NameMobInteracted:        func() interface{} { return &MobInteracted{} },
	NameMobKilled:            func() interface{} { return &MobKilled{} },
	NameStartWorld:           func() interface{} { return &StartWorld{} },
	NameWorldLoaded:          func() interface{} { return &WorldLoaded{} },
	NameWorldGenerated:       func() interface{} { return &WorldGenerated{} },
	NameScriptLoaded:         func() interface{} { return &ScriptLoaded{} },
	NameScriptRan:            func() interface{} { return &ScriptRan{} },
	NameScreenChanged:        func() interface{} { return &ScreenChanged{} },
	NameSlashCommandExecuted: func() interface{} { return &SlashCommandExecuted{} },
	NameSignInToXBOXLive:     func() interface{} { return &SignInToXBOXLive{} },
	NameSignOutOfXBOXLive:    func() interface{} { return &SignOutOfXBOXLive{} },
	NameVehicleExited:        func() interface{} { return &VehicleExited{} },
}

Events is a map used to find the corresponding event for an event name.

Functions

This section is empty.

Types

type AwardAchievement

type AwardAchievement struct {
	// AchievementID is the numerical ID of the achievement.
	AchievementID int
}

AwardAchievement is called when a player is awarded an achievement in game. Note that achievements are only awarded if cheats are disabled in the world.

type BlockBroken

type BlockBroken struct {
	Block             mctype.Block
	Count             int
	DestructionMethod int
	Player            mctype.Player
	Tool              mctype.Tool
	Variant           int
}

BlockBroken is sent by the client when it breaks a block.

type BlockPlaced

type BlockPlaced struct {
	Block            mctype.Block
	Count            int
	PlacedUnderWater bool
	PlacementMethod  int
	Player           mctype.Player
	Tool             mctype.Tool
}

BlockPlaced is called by a client when it places a block.

type BookEdited

type BookEdited struct {
	// Type is the type of the book after it was edited. If the book was signed, this means that the type is
	// 387 (written book), whereas if the book was only edited, the type is 386. (writable book)
	Type int
	// PageCount is the amount of pages that the book had after editing.
	PageCount int
}

BookEdited is sent by the client when it edits a book and closes the entire display. This means that this event is sent as soon as a player clicks the cross in the top right corner or signs the book.

type EndOfDay

type EndOfDay struct {
}

EndOfDay is sent by the client when a day progresses naturally. The event is called at sunrise if the time was not modified using a command. (daytime = 23000)

type GameRulesLoaded

type GameRulesLoaded struct {
	CommandBlockOutput    bool `json:"commandblockoutput"`
	CommandBlocksEnabled  bool `json:"commandblocksenabled"`
	DoDaylightCycle       bool `json:"dodaylightcycle"`
	DoEntityDrops         bool `json:"doentitydrops"`
	DoFireTick            bool `json:"dofiretick"`
	DoImmediateRespawn    bool `json:"doimmediaterespawn"`
	DoInsomnia            bool `json:"doinsomnia"`
	DoMobLoot             bool `json:"domobloot"`
	DoMobSpawning         bool `json:"domobspawning"`
	DoTileDrops           bool `json:"dotiledrops"`
	DoWeatherCycle        bool `json:"doweathercycle"`
	DrowningDamage        bool `json:"drowningdamage"`
	ExperimentalGamePlay  bool `json:"experimentalgameplay"`
	FallDamage            bool `json:"falldamage"`
	FireDamage            bool `json:"firedamage"`
	FunctionCommandLimit  int  `json:"functioncommandlimit"`
	KeepInventory         bool `json:"keepinventory"`
	MaxCommandChainLength int  `json:"maxcommandchainlength"`
	MobGriefing           bool `json:"mobgriefing"`
	NaturalRegeneration   bool `json:"naturalregeneration"`
	PVP                   bool `json:"pvp"`
	RandomTickSpeed       int  `json:"randomtickspeed"`
	SendCommandFeedback   bool `json:"sendcommandfeedback"`
	ShowCoordinates       bool `json:"showcoordinates"`
	ShowDeathMessages     bool `json:"showdeathmessages"`
	TNTExplodes           bool `json:"tntexplodes"`
}

GameRulesLoaded gets sent by the client when it has its game rules loaded. It contains a list of all game rules and their values.

type GameRulesUpdated

type GameRulesUpdated struct {
	// GameRuleName is the name of the game rule that was updated.
	GameRuleName string `json:"UpdatedOptionName"`
	// NewValue is the new value of the game rule that was updated. This may be either a bool, a float64 or
	// an int.
	NewValue interface{} `json:"UpdatedOptionNewValue"`
	// OldValue is the value before the game rule was updated. This may be either a bool, a float64 or an int,
	// but is guaranteed to be of the same type as NewValue.
	OldValue interface{} `json:"UpdatedOptionOldValue"`
}

GameRulesUpdated is sent by the client when a game rule was updated. It is sent for each specific game rule change.

type ItemAcquired

type ItemAcquired struct {
	AcquisitionMethodId int
	Count               int
	Item                mctype.Block
	Player              mctype.Player
}

ItemAcquired is sent by the client when it acquires an item. This is most notably done when a player picks an item up from the ground, but also when it crafts a new item, gets one from a chest etc.

type ItemCrafted

type ItemCrafted struct {
	// Type is the numerical type of the crafted item. For wooden planks for example, this is 5.
	Type int
	// AuxType is the metadata or variant of the item. For oak wooden planks for example, this is 0.
	AuxType int
	// UsedCraftingTable indicates if the player was using a crafting table to craft this item. If the
	// inventory itself was used, this is false.
	UsedCraftingTable bool
	// CraftingSessionID is an ID identifying this crafting session.
	CraftingSessionID int

	// RecipeBookShown indicates if a player had its recipe book shown. If so, the fields below apply.
	RecipeBookShown bool
	// NumberOfTabsChanged is the number of times a player changed the inventory tabs while having the
	// recipe book open. There are 5 tabs in total, (Construction, Equipment, Items, Nature and Craftable) but
	// the NumberOfTabsChanged may exceed this number.
	NumberOfTabsChanged int
	// EndingTabID is the ID of the last tab the player had opened in the recipe book. The tabs Construction,
	// Equipment, Items, Nature and Craftable have the IDs 1, 2, 3, 4 and 5 respectively.
	EndingTabID int
	// StartingTabID is the ID of the first tab the player had opened when it opened the recipe book in its
	// crafting inventory. The tabs Construction, Equipment, Items, Nature and Craftable have the IDs 1, 2, 3,
	// 4 and 5 respectively.
	StartingTabID int
	// HasCraftableFilterOn indicates if the Craftable filter was enabled (it is enabled by default). When
	// disabled, the recipe book shows items that cannot be crafted with the collected items with a red
	// background.
	HasCraftableFilterOn bool
	// CraftedAutomatically indicates if the item was directly crafted using the recipe book. This is done by
	// shift clicking an item in the recipe book, causing the products to be put directly into the inventory.
	CraftedAutomatically bool
	// UsedSearchBar indicates if the search bar was used to find the recipe of the item crafted.
	UsedSearchBar bool
}

ItemCrafted is sent by the client when it crafts an item either in its inventory or in a crafting table.

type ItemDropped

type ItemDropped struct {
	// Type is the numerical ID/type of the item dropped.
	Type int
	// AuxType is the metadata value of the item dropped.
	AuxType int
}

ItemDropped is sent by the client when it drops an item on the ground from its inventory.

type ItemEquipped

type ItemEquipped struct {
	// ItemEnchantmentCount is the number of enchants the item equipped has. Even though this event only has 3
	// enchantment types, an item may have more than 3 enchantments on it. That means that the ItemEnchantment
	// Count may exceed 3.
	ItemEnchantmentCount int `json:"ItemEnchantCount"`
	// ItemEnchantmentTypeA is the enchantment type/ID of the first enchantment on the item.
	ItemEnchantmentTypeA int `json:"ItemEnchantTypeA"`
	// ItemEnchantmentLevelA is the level of the first enchantment on the item.
	ItemEnchantmentLevelA int `json:"ItemEnchantLevelA"`
	// ItemEnchantmentTypeB is the enchantment type/ID of the second enchantment on the item.
	ItemEnchantmentTypeB int `json:"ItemEnchantTypeB"`
	// ItemEnchantmentLevelB is the level of the second enchantment on the item.
	ItemEnchantmentLevelB int `json:"ItemEnchantLevelB"`
	// ItemEnchantmentTypeB is the enchantment type/ID of the second enchantment on the item.
	ItemEnchantmentTypeC int `json:"ItemEnchantTypeC"`
	// ItemEnchantmentLevelC is the level of the third enchantment on the item.
	ItemEnchantmentLevelC int `json:"ItemEnchantLevelC"`

	// Slot is the slot the item was equipped in. This is a number ranging from 2-5, with 2 being the helmet
	// and 5 being the boots.
	Slot mctype.ArmourSlot
	// Type is the numerical ID of the item equipped.
	Type int
	// AuxType is the aux value of the item equipped. For most items equipped, this will be the durability or
	// damage of the item.
	AuxType int
}

ItemEquipped is sent by the client when it equips an item. This includes armour, elytras, pumpkins and other items that may be worn.

type ItemInteracted

type ItemInteracted struct {
	// AuxType is the metadata value or variant of the item.
	AuxType int `json:"Aux"`
	// Item is the item string of the item, excluding the namespace. For example 'wooden_door'. If no item is
	// held, this string is empty.
	Item string `json:"Id"`
	// Count is the count of the item stack the player held. If no item was held, the count is 0.
	Count int
	// Method is the method of the interaction. The method is one of the constants above.
	Method int
}

ItemInteracted is sent by the client when it interacts with a block using an item.

type ItemNamed

type ItemNamed struct {
	// AuxType is the metadata value of the item named.
	AuxType int
	// Type is the numerical ID of the item named.
	Type int
}

ItemNamed is sent by the client when it names an item using an anvil.

type ItemSmelted

type ItemSmelted struct {
	// AuxType is the metadata value of the resulting item.
	AuxType int
	// Type is the numerical ID of the resulting item.
	Type int
	// FuelSourceAuxType is the metadata value of the fuel item.
	FuelSourceAuxType int
	// FuelSourceType is the numerical ID of the fuel item.
	FuelSourceType int
}

ItemSmelted is sent by the client when it smelts an item and takes the item out of the result slot. It is not sent when the item is actually smelted.

type ItemUsed

type ItemUsed struct {
	// Type is the numerical type of the item used.
	Type int
	// AuxType is the metadata value (variant) of the item used.
	AuxType int
	// ItemUseMethod is the method of the item usage.
	ItemUseMethod int
}

ItemUsed is sent when a player uses an item.

type Measurable

type Measurable interface {
	// ConsumeMeasurements consumes the measurements passed and stores it in fields in the event.
	ConsumeMeasurements(measurements Measurements)
}

Measurable is implemented by events that have information stored in the measurements JSON object, such as the PlayerTravelled event.

type Measurements

type Measurements struct {
	// Count ...
	Count int `json:"count"`
	// RecordCount ...
	RecordCount int `json:"recordCnt"`
	// SequenceMax ...
	SequenceMax int `json:"seqMax"`
	// SequenceMin ...
	SequenceMin int `json:"seqMin"`

	// MetresTravelled is the amount of metres travelled since the last PlayerTravelled event.
	MetresTravelled float64 `json:"MetersTravelled"`
	// NewBiome is the new biome to which the player moved.
	NewBiome int
	// PositionAverageX is the average position on the X axis of a player during a travelled event.
	PositionAverageX float64 `json:"PosAvgX"`
	// PositionAverageY is the average position on the Y axis of a player during a travelled event.
	PositionAverageY float64 `json:"PosAvgY"`
	// PositionAverageZ is the average position on the Z axis of a player during a travelled event.
	PositionAverageZ float64 `json:"PosAvgZ"`
}

Measurements contains information about measurements made for this event. Most events use only the top 4 fields, others such as player travelled event use the others too.

type MobBorn

type MobBorn struct {
	// BabyColour is the colour of the baby. This is 0 for all animals that do not have a colour. For sheep
	// and horses, this colour is set.
	BabyColour int `json:"BabyColor"`
	// BabyType is the numerical ID of the entity born. For a chicken for example, this is 10.
	BabyType int
	// BabyVariant is the variant of the baby born. This variant is 0 for most mobs.
	BabyVariant int
}

MobBorn is sent by the client when a mob is born by having 2 mobs breed.

type MobInteracted

type MobInteracted struct {
	// InteractionType is the method that was used to interact with an entity.
	InteractionType int
	// MobType is the numerical type of an entity.
	MobType int
	// MobColor is the colour of the mob after a dye was used on it. This is present with sheep and dogs that
	// have their collar dyed.
	MobColor int
	// MobVariant is the variant of the mob. This is present with for example horses, that have different
	// markings and colours.
	MobVariant int
}

MobInteracted is sent when a player interacts with a mob in a way that activates something. Simply right clicking a mob seems not to send the event.

type MobKilled

type MobKilled struct {
	// ArmourFeetAuxType is the aux value/metadata of the boots item worn.
	ArmourFeetAuxType int `json:"ArmorFeetAuxType"`
	// ArmourFeetID is the numerical ID of the boots item worn.
	ArmourFeetID int `json:"ArmorFeetId"`
	// ArmourHeadAuxType is the aux value/metadata of the helmet item worn.
	ArmourHeadAuxType int `json:"ArmorHeadAuxType"`
	// ArmourHeadID is the numerical ID of the helmet item worn.
	ArmourHeadID int `json:"ArmorHeadId"`
	// ArmourLegsAuxType is the aux value/metadata of the leggings item worn.
	AmourLegsAuxType int `json:"ArmorLegsAuxType"`
	// ArmourLegsID is the numerical ID of the leggings item worn.
	ArmourLegsID int `json:"ArmorLegsId"`
	// ArmourTorsoAuxType is the aux value/metadata of the torso item worn.
	ArmourTorsoAuxType int `json:"ArmorTorsoAuxType"`
	// ArmourTorsoID is the numerical ID of the torso item worn.
	ArmourTorsoID int `json:"ArmorTorsoId"`
	// IsMonster indicates if the living entity killed was a monster. Note that this is not true for neutral
	// entities such as wolves that turn angry.
	IsMonster bool
	// KillMethodType is the method used to kill the entity. This is one of the methods above, but there are
	// more methods that are currently unknown.
	KillMethodType int
	// MobType is the numerical monster ID.
	MobType int
	// PlayerIsHiddenFrom indicates if the player was hidden from the entity killed.
	PlayerIsHiddenFrom bool
	// WeaponType is the numerical item ID of the item used to kill the entity. If no item was held, this type
	// is 0.
	WeaponType int
}

MobKilled is sent by the client when it kills a living entity.

type Name

type Name string

Name is the name of an event.

const (
	NameAwardAchievement     Name = "AwardAchievement"
	NameBlockPlaced          Name = "BlockPlaced"
	NameBlockBroken          Name = "BlockBroken"
	NameEndOfDay             Name = "EndOfDay"
	NameGameRulesLoaded      Name = "GameRulesLoaded"
	NameGameRulesUpdated     Name = "GameRulesUpdated"
	NamePlayerMessage        Name = "PlayerMessage"
	NamePlayerTeleported     Name = "PlayerTeleported"
	NamePlayerTravelled      Name = "PlayerTravelled"
	NamePlayerTransform      Name = "PlayerTransform"
	NameItemAcquired         Name = "ItemAcquired"
	NameItemCrafted          Name = "ItemCrafted"
	NameItemDropped          Name = "ItemDropped"
	NameItemEquipped         Name = "ItemEquipped"
	NameItemInteracted       Name = "ItemInteracted"
	NameItemNamed            Name = "ItemNamed"
	NameItemSmelted          Name = "ItemSmelted"
	NameItemUsed             Name = "ItemUsed"
	NameBookEdited           Name = "BookEdited"
	NameSignedBookOpened     Name = "SignedBookOpened"
	NameMobBorn              Name = "MobBorn"
	NameMobInteracted        Name = "MobInteracted"
	NameMobKilled            Name = "MobKilled"
	NameStartWorld           Name = "StartWorld"
	NameWorldLoaded          Name = "WorldLoaded"
	NameWorldGenerated       Name = "WorldGenerated"
	NameScriptLoaded         Name = "ScriptLoaded"
	NameScriptRan            Name = "ScriptRan"
	NameScreenChanged        Name = "ScreenChanged"
	NameSlashCommandExecuted Name = "SlashCommandExecuted"
	NameSignInToXBOXLive     Name = "SignInToXboxLive"
	NameSignOutOfXBOXLive    Name = "SignOutOfXboxLive"
	NameVehicleExited        Name = "VehicleExited"
)

type PlayerMessage

type PlayerMessage struct {
	// Message is the message sent by the sender.
	Message string
	// Type is the type of the message, for example 'chat'.
	Type string
	// Sender is the name of the sender of the message. This may be the name of the receiver if the receiver
	// sent a message.
	Sender string
	// Receiver is the receiver of the text message.
	Receiver string `json:",omitempty"`
}

PlayerMessage is sent when a player receives a message. This happens for any message type, including when the player itself sends a message.

type PlayerTeleported

type PlayerTeleported struct {
	// MetersTravelled is the total distance that was travelled with the teleportation.
	MetersTravelled float64
	// TeleportationCause is the cause of the teleportation. This is one of the constant values above.
	TeleportationCause int
	// TeleporationItem is the item used to teleport. If teleported using a command, this item value is 0. For
	// an ender pearl, this is 87.
	TeleportationItem int
}

PlayerTeleported is sent by the client when the player teleports. This is sent for example when using the /tp command, but also when, for example, eating a chorus fruit.

type PlayerTransform

type PlayerTransform struct {
	// PlayerYRot is the Y rotation of the player after the transformation.
	PlayerYRotation float64 `json:"PlayerYRot"`
	// PlayerID is the UUID of the player.
	PlayerID string `json:"PlayerId"`
	// Dimension is the dimension of the player.
	Dimension int `json:"Dimension"`
	// PositionX is the position on the X axis of the player after the transformation.
	PositionX float64 `json:"PosX"`
	// PositionY is the position on the Y axis of the player after the transformation.
	PositionY float64 `json:"PosY"`
	// PositionZ is the position on the Z axis of the player after the transformation.
	PositionZ float64 `json:"PosZ"`
}

PlayerTransform is sent by the client when it is 'transformed', meaning it was moved from one place to another. This appears not to be sent during movement, (see PlayerTravelled for that) but rather when the player is, for example, teleported.

type PlayerTravelled

type PlayerTravelled struct {

	// TravelMethodType is the method type indicating the way the player travelled.
	TravelMethodType int
	// HasRelevantBuff specifies if a player has an effect that affects its movement, such as slowness, jump
	// boost, slow falling etc.
	HasRelevantBuff bool
	// MobType no longer seems to be used. It appears always to be 0.
	MobType int
	// IsUnderwater indicates if the movement was underwater.
	IsUnderwater bool `json:",omitempty"`
	// contains filtered or unexported fields
}

PlayerTravelled is sent by the client when it travels to a new destination.

func (*PlayerTravelled) ConsumeMeasurements

func (event *PlayerTravelled) ConsumeMeasurements(measurements Measurements)

ConsumeMeasurements takes the movement measurements from the Measurements struct.

func (*PlayerTravelled) Measurements

func (event *PlayerTravelled) Measurements() Measurements

Measurements returns all measurements associated with the player travelled event.

type Properties

type Properties struct {
	AccountType                    int
	ActiveSessionID                string
	AppSessionID                   string
	Biome                          int
	Build                          string
	BuildPlatform                  int    `json:"BuildPlat"`
	Achievements                   bool   `json:"Cheevos"`
	ClientID                       string `json:"ClientId"`
	CurrentInput                   int
	CurrentNumPlayers              int    `json:",omitempty"`
	DeviceSessionID                string `json:"DeviceSessionId"`
	Dimension                      int    `json:"Dim"`
	GlobalMultiplayerCorrelationID string `json:"GlobalMultiplayerCorrelationId,omitempty"`
	Mode                           int
	MultiplayerCorrelationID       string `json:"MultiplayerCorrelationId"`
	NetworkType                    int
	Platform                       string `json:"Plat"`
	PlayerGameMode                 int
	SchemaCommitHash               string
	Sequence                       int    `json:"Seq,omitempty"`
	ServerID                       string `json:"ServerId"`
	Treatments                     string
	// UserID is a UUID that is only set when a player is logged into XBOX Live.
	UserID         string `json:"UserId,omitempty"`
	WorldFeature   int
	WorldSessionID string `json:"WorldSessionId,omitempty"`
	IsTrial        int    `json:"isTrial"`
	EditionType    string `json:"editionType"`
	Locale         string `json:"locale"`
	VRMode         bool   `json:"vrMode"`
	// BuildTypeID is a key that is only set when the Minecraft build is a development build. It is not
	// present for normal clients.
	BuildTypeID int `json:",omitempty"`
}

Properties is a list of properties sent in an event response that are shared among every event.

type ScreenChanged

type ScreenChanged struct {
	// Direction seems to always be 'forward'. It's unclear when this is not forward.
	Direction mctype.Direction
	// PreviousScreenName is the name of the screen displayed before it was changed to this new screen.
	PreviousScreenName string
	// ScreenName is the name of the new screen opened. For options this field might contain, see the
	// constants above. Not all screen names are listed above, provided some of them are dynamic.
	ScreenName string
	// ScreenVersion is the version of the screen. Currently, it appears this value is always '1'.
	ScreenVersion string
	// Seconds is a float describing how long the previous screen was open for.
	Seconds float64
	// Timestamp is a timestamp indicating the time the screen was changed relative to the time the player
	// opened the game.
	Timestamp float64 `json:"TimeStamp"`
}

ScreenChanged is sent by the client when it changes from one screen to another. This does not include just 'any' screen change, but only when the screen 'state' changes, for example when opening the chat screen.

type ScriptLoaded

type ScriptLoaded struct {
	// ScriptHash is the numerical hash of the script.
	ScriptHash int
	// ScriptName is the name/path of the script that was loaded.
	ScriptName string
}

ScriptLoaded is sent by the client after it loaded a script that was sent, but before the script was actually ran.

type ScriptRan

type ScriptRan struct {
	// ScriptHash is a numeric hash of the script that was ran.
	ScriptHash int
	// ScriptName is the name/path of the script that was ran.
	ScriptName string
	// ScriptRanClientSide indicates if the script that was ran was running client side.
	ScriptRanClientSide bool `json:"ScriptRanClientside"`
	// ScriptSucceeded indicates if the script that was ran ran without any errors occurring. If an error was
	// encountered, this is sent in either a ScriptError event or a ScriptInternalError event.
	ScriptSucceeded bool
}

ScriptRan is sent by the client when it initially runs a script after having downloaded it from the world the client joined.

type SignInToXBOXLive

type SignInToXBOXLive struct {
	// SignInUI ...
	SignInUI bool
	// Stage ...
	Stage int
	// Timestamp is the timestamp at which the user was logged into XBOX Live.
	Timestamp float64
}

SignInToXBOXLive is sent by the client when it signs into XBOX Live by clicking the button in the Minecraft app.

type SignOutOfXBOXLive

type SignOutOfXBOXLive struct {
}

SignOutOfXBOXLive is sent by the client when it signs out of XBOX Live. For Windows 10, this is done through the XBOX app.

type SignedBookOpened

type SignedBookOpened struct {
	// IsAuthor reports if the player that opened the book was the author of the book.
	IsAuthor bool
	// NetworkType no longer seems to be used. It is always 0.
	NetworkType int
}

SignedBookOpened is sent by the client when it opens a book that was signed.

type SlashCommandExecuted

type SlashCommandExecuted struct {
	// CommandName is the name of the command executed, for example 'setblock'. This command is guaranteed to
	// be registered. Attempting to execute commands that do not exist will not call this event.
	CommandName string
	// ErrorCount is the amount of errors the command encountered. For normal commands, this will always be
	// either 0 or 1. For the so called 'functions', the possible amount of errors encountered depends on the
	// amount of commands executed in the function.
	ErrorCount int
	// ErrorList is a list of the command error codes encountered, joined by '\n'. For example
	// 'commands.generic.num.tooBig'
	ErrorList string `json:",omitempty"`
	// SuccessCount is the amount of success returns the command encountered. For normal commands, this will
	// always be either 0 or 1. For the so called 'functions', the possible amount of success returns depends
	// on the amount of commands executed in the function.
	SuccessCount int
}

SlashCommandExecuted is called by the command when it executes a command that existed.

type StartWorld

type StartWorld struct {
	// Host is the host IP address of the world. For local worlds, this field is not set and is empty. For
	// servers, this is the IP address of the server.
	Host string `json:",omitempty"`
}

StartWorld is sent by the client when it starts a world by clicking it in the main menu.

type VehicleExited

type VehicleExited struct {
	// FurthestAxisMetersTravelled is the total amount of blocks that was travelled during the time that the
	// client was on the vehicle.
	FurthestAxisMetersTravelled int
	// MobType is the numerical ID of the mob that was ridden. For minecarts as an example, this is 84.
	MobType int
	// TravelMethodID is the ID of the travel method. This always appears to be 0.
	TravelMethodID int
	// TripDuration is the duration the trip took. This is measured in seconds, rather than minutes, as the
	// field actually implies.
	TripDuration int `json:"TripDurationMinutes"`
}

VehicleExited is sent by the client when it exits a vehicle such as a horse or a minecart.

type WorldGenerated

type WorldGenerated struct {
	// EducationFeaturesEnabled indicates if the newly generated world has education features enabled. Once
	// enabled, it cannot be disabled again.
	EducationFeaturesEnabled bool
	// WorldSeed is the seed of the world that was generated.
	WorldSeed int
	// IsFromWorldTemplate indicates if the world was generated from a world template, or in other words, was
	// bought from the marketplace.
	IsFromWorldTemplate bool `json:"fromTemplate"`
	// SaveID is a base64 encoded string that identifies the save folder of the world.
	SaveID string `json:"SaveId,omitempty"`
}

WorldGenerated is sent by the client when it generates a new singleplayer world.

type WorldLoaded

type WorldLoaded struct {
	// ContainsBehaviourPacks indicates if the world that is loaded has any global behaviour packs/addons
	// enabled for it.
	ContainsBehaviourPacks bool `json:"ContainsAddons"`
	// ContainsTexturePacks indicates if the world that is loaded has any texture packs enabled for it.
	ContainsTexturePacks bool `json:"ContainsTextures"`
	// IsFromWorldTemplate indicates if the world that is loaded is from a world template, or in other words,
	// comes from a template bought from the marketplace.
	IsFromWorldTemplate bool
	// RequiredHostTexturesToJoin indicates if the texture pack of the world was required to be downloaded to
	// join the world.
	RequiredHostTexturesToJoin bool
	// SaveID is the save ID of the world. This is a base64 string.
	SaveID string `json:"SaveId"`
	// UsingExperimentalGameplay indicates if the world had experimental gameplay enabled in it.
	UsingExperimentalGameplay bool
	// WorldSeed is the numerical seed of the world.
	WorldSeed int
}

WorldLoaded is sent by the client when its world is loaded. (or, more specifically, when it receives the StartGamePacket) This is sent for both multiplayer and singleplayer worlds.

Jump to

Keyboard shortcuts

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