session

package
v0.0.0-...-79cc62c Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 53 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Nop = &Session{}

Nop represents a no-operation session. It does not do anything when sending a packet to it.

Functions

func BuildAvailableCommands

func BuildAvailableCommands(
	commands map[string]cmd.Command,
	src cmd.Source,
	softEnums map[string]struct{},
) (*packet.AvailableCommands, map[string]map[int]cmd.Runnable)

BuildAvailableCommands builds an AvailableCommands packet and the runnable command map for the Source passed. The input map may contain aliases. It returns the AvailableCommands packet and the runnable command map for the commands that the Source can execute.

Types

type BlockActorDataHandler

type BlockActorDataHandler struct{}

BlockActorDataHandler handles an incoming BlockActorData packet from the client, sent for some block entities like signs when they are edited.

func (BlockActorDataHandler) Handle

Handle ...

type BlockPickRequestHandler

type BlockPickRequestHandler struct{}

BlockPickRequestHandler handles the BlockPickRequest packet.

func (BlockPickRequestHandler) Handle

Handle ...

type BookEditHandler

type BookEditHandler struct{}

BookEditHandler handles the BookEdit packet.

func (BookEditHandler) Handle

func (b BookEditHandler) Handle(p packet.Packet, s *Session, _ *world.Tx, _ Controllable) error

Handle ...

type ClientCacheBlobStatusHandler

type ClientCacheBlobStatusHandler struct {
}

ClientCacheBlobStatusHandler handles the ClientCacheBlobStatus packet.

func (*ClientCacheBlobStatusHandler) Handle

Handle ...

type CommandRequestHandler

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

CommandRequestHandler handles the CommandRequest packet.

func (*CommandRequestHandler) Handle

Handle ...

type Config

type Config struct {
	Log *slog.Logger

	MaxChunkRadius int

	EmoteChatMuted bool

	JoinMessage, QuitMessage chat.Translation

	HandleStop func(*world.Tx, Controllable)
}

func (Config) New

func (conf Config) New(conn Conn) *Session

type Conn

type Conn interface {
	io.Closer
	// IdentityData returns the login.IdentityData of a Conn. It contains the UUID, XUID and username of the connection.
	IdentityData() login.IdentityData
	// ClientData returns the login.ClientData of a Conn. This includes less sensitive data of the player like its skin,
	// language code and other non-essential information.
	ClientData() login.ClientData
	// ClientCacheEnabled specifies if the Conn has the client cache, used for caching chunks client-side, enabled or
	// not. Some platforms, like the Nintendo Switch, have this disabled at all times.
	ClientCacheEnabled() bool
	// ChunkRadius returns the chunk radius as requested by the client at the other end of the Conn.
	ChunkRadius() int
	// Latency returns the current latency measured over the Conn.
	Latency() time.Duration
	// Flush flushes the packets buffered by the Conn, sending all of them out immediately.
	Flush() error
	// RemoteAddr returns the remote network address.
	RemoteAddr() net.Addr
	// ReadPacket reads a packet.Packet from the Conn. An error is returned if a deadline was set that was
	// exceeded or if the Conn was closed while awaiting a packet.
	ReadPacket() (pk packet.Packet, err error)
	// WritePacket writes a packet.Packet to the Conn. An error is returned if the Conn was closed before sending the
	// packet.
	WritePacket(pk packet.Packet) error
	// StartGameContext starts the game for the Conn with a context to cancel it.
	StartGameContext(ctx context.Context, data minecraft.GameData) error
}

Conn represents a connection that packets are read from and written to by a Session. In addition, it holds some information on the identity of the Session.

type ContainerCloseHandler

type ContainerCloseHandler struct{}

ContainerCloseHandler handles the ContainerClose packet.

func (*ContainerCloseHandler) Handle

Handle ...

type Controllable

type Controllable interface {
	Name() string
	world.Entity
	item.User
	dialogue.Submitter
	form.Submitter
	cmd.Source
	chat.Subscriber
	hud.Renderer
	debug.Renderer

	Locale() language.Tag

	SetHeldItems(right, left item.Stack)
	SetHeldSlot(slot int) error

	Move(deltaPos mgl64.Vec3, deltaYaw, deltaPitch float64)

	Speed() float64
	FlightSpeed() float64
	VerticalFlightSpeed() float64

	Sleep(pos cube.Pos)
	Wake()

	Chat(msg ...any)
	ExecuteCommand(commandLine string)
	GameMode() world.GameMode
	SetGameMode(mode world.GameMode)
	Effects() []effect.Effect

	UseItem()
	ReleaseItem()
	UseItemOnBlock(pos cube.Pos, face cube.Face, clickPos mgl64.Vec3)
	UseItemOnEntity(e world.Entity) bool
	BreakBlock(pos cube.Pos)
	PickBlock(pos cube.Pos)
	AttackEntity(e world.Entity) bool
	Drop(s item.Stack) (n int)
	SwingArm()
	PunchAir()

	Health() float64
	MaxHealth() float64
	Absorption() float64
	Food() int

	ExperienceLevel() int
	ExperienceProgress() float64
	SetExperienceLevel(level int)

	EnchantmentSeed() int64
	ResetEnchantmentSeed()

	Respawn() *world.EntityHandle
	Dead() bool

	StartSneaking()
	Sneaking() bool
	StopSneaking()
	StartSprinting()
	Sprinting() bool
	StopSprinting()
	StartSwimming()
	Swimming() bool
	StopSwimming()
	StartCrawling()
	Crawling() bool
	StopCrawling()
	StartFlying()
	Flying() bool
	StopFlying()
	StartGliding()
	Gliding() bool
	StopGliding()
	Jump()

	StartBreaking(pos cube.Pos, face cube.Face)
	ContinueBreaking(face cube.Face)
	FinishBreaking()
	AbortBreaking()

	Exhaust(points float64)

	OpenSign(pos cube.Pos, frontSide bool)
	EditSign(pos cube.Pos, frontText, backText string) error
	TurnLecternPage(pos cube.Pos, page int) error

	EnderChestInventory() *inventory.Inventory
	MoveItemsToInventory()

	// UUID returns the UUID of the controllable. It must be unique for all controllable entities present in
	// the server.
	UUID() uuid.UUID
	// XUID returns the XBOX Live User ID of the controllable. Every controllable must have one of these if
	// they are authenticated via XBOX Live, as they must be connected to an XBOX Live account.
	XUID() string
	// Skin returns the skin of the controllable. Each controllable must have a skin, as it defines how the
	// entity looks in the world.
	Skin() skin.Skin
	SetSkin(skin.Skin)

	UpdateDiagnostics(Diagnostics)
}

Controllable represents an entity that may be controlled by a Session. Generally, Controllable is implemented in the form of a Player. Methods in Controllable will be added as Session needs them in order to handle packets.

type Diagnostics

type Diagnostics struct {
	// AverageFramesPerSecond is the average amount of frames per second that the client has been
	// running at.
	AverageFramesPerSecond float64
	// AverageServerSimTickTime is the average time that the server spends simulating a single tick
	// in milliseconds.
	AverageServerSimTickTime float64
	// AverageClientSimTickTime is the average time that the client spends simulating a single tick
	// in milliseconds.
	AverageClientSimTickTime float64
	// AverageBeginFrameTime is the average time that the client spends beginning a frame in
	// milliseconds.
	AverageBeginFrameTime float64
	// AverageInputTime is the average time that the client spends processing input in milliseconds.
	AverageInputTime float64
	// AverageRenderTime is the average time that the client spends rendering in milliseconds.
	AverageRenderTime float64
	// AverageEndFrameTime is the average time that the client spends ending a frame in milliseconds.
	AverageEndFrameTime float64
	// AverageRemainderTimePercent is the average percentage of time that the client spends on
	// tasks that are not accounted for.
	AverageRemainderTimePercent float64
	// AverageUnaccountedTimePercent is the average percentage of time that the client spends on
	// unaccounted tasks.
	AverageUnaccountedTimePercent float64
}

Diagnostics represents the latest diagnostics data of the client.

type EmoteHandler

type EmoteHandler struct {
	LastEmote time.Time
}

EmoteHandler handles the Emote packet.

func (*EmoteHandler) Handle

func (h *EmoteHandler) Handle(p packet.Packet, _ *Session, tx *world.Tx, c Controllable) error

Handle ...

type InteractHandler

type InteractHandler struct{}

InteractHandler handles the packet.Interact.

func (*InteractHandler) Handle

func (h *InteractHandler) Handle(p packet.Packet, s *Session, _ *world.Tx, c Controllable) error

Handle ...

type InventoryTransactionHandler

type InventoryTransactionHandler struct{}

InventoryTransactionHandler handles the InventoryTransaction packet.

func (*InventoryTransactionHandler) Handle

func (h *InventoryTransactionHandler) Handle(p packet.Packet, s *Session, tx *world.Tx, c Controllable) (err error)

Handle ...

type ItemStackRequestHandler

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

ItemStackRequestHandler handles the ItemStackRequest packet. It handles the actions done within the inventory.

func (*ItemStackRequestHandler) Handle

Handle ...

type LecternUpdateHandler

type LecternUpdateHandler struct{}

LecternUpdateHandler handles the LecternUpdate packet, sent when a player interacts with a lectern.

func (LecternUpdateHandler) Handle

Handle ...

type MobEquipmentHandler

type MobEquipmentHandler struct{}

MobEquipmentHandler handles the MobEquipment packet.

func (*MobEquipmentHandler) Handle

Handle ...

type ModalFormResponseHandler

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

ModalFormResponseHandler handles the ModalFormResponse packet.

func (*ModalFormResponseHandler) Handle

Handle ...

type NPCRequestHandler

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

NPCRequestHandler handles the NPCRequest packet.

func (*NPCRequestHandler) Handle

func (h *NPCRequestHandler) Handle(p packet.Packet, s *Session, tx *world.Tx, c Controllable) error

Handle ...

type NetworkEncodeableEntity

type NetworkEncodeableEntity interface {
	// NetworkEncodeEntity returns the network type ID of the entity. This is
	// NOT the save ID.
	NetworkEncodeEntity() string
}

NetworkEncodeableEntity is a world.EntityType where the save ID and network ID are not the same.

type OffsetEntity

type OffsetEntity interface {
	NetworkOffset() float64
}

OffsetEntity is a world.EntityType that has an additional offset when sent over network. This is mostly the case for older entities such as players and TNT.

type PlayerActionHandler

type PlayerActionHandler struct{}

PlayerActionHandler handles the PlayerAction packet.

func (*PlayerActionHandler) Handle

Handle ...

type PlayerAuthInputHandler

type PlayerAuthInputHandler struct{}

PlayerAuthInputHandler handles the PlayerAuthInput packet.

func (PlayerAuthInputHandler) Handle

Handle ...

type PlayerSkinHandler

type PlayerSkinHandler struct{}

PlayerSkinHandler handles the PlayerSkin packet.

func (PlayerSkinHandler) Handle

Handle ...

type RequestAbilityHandler

type RequestAbilityHandler struct{}

RequestAbilityHandler handles the RequestAbility packet.

func (RequestAbilityHandler) Handle

Handle ...

type RequestChunkRadiusHandler

type RequestChunkRadiusHandler struct{}

RequestChunkRadiusHandler handles the RequestChunkRadius packet.

func (*RequestChunkRadiusHandler) Handle

Handle ...

type RespawnHandler

type RespawnHandler struct{}

RespawnHandler handles the Respawn packet.

func (*RespawnHandler) Handle

func (*RespawnHandler) Handle(p packet.Packet, _ *Session, _ *world.Tx, c Controllable) error

Handle ...

type ServerBoundDiagnosticsHandler

type ServerBoundDiagnosticsHandler struct{}

ServerBoundDiagnosticsHandler handles diagnostic updates from the client.

func (*ServerBoundDiagnosticsHandler) Handle

Handle ...

type ServerBoundLoadingScreenHandler

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

ServerBoundLoadingScreenHandler handles loading screen updates from the clients. It is used to ensure that the server knows when the client is loading a screen, and when it is done loading it.

func (*ServerBoundLoadingScreenHandler) Handle

Handle ...

type Session

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

Session handles incoming packets from connections and sends outgoing packets by providing a thin layer of abstraction over direct packets. A Session basically 'controls' an entity.

func (*Session) AddDebugShape

func (s *Session) AddDebugShape(shape debug.Shape)

AddDebugShape adds a debug shape to be rendered to the player. If the shape already exists, it will be updated with the new information.

func (*Session) Addr

func (s *Session) Addr() net.Addr

Addr returns the net.Addr of the client.

func (*Session) ChangingDimension

func (s *Session) ChangingDimension() bool

ChangingDimension returns whether the session is currently changing dimension or not.

func (*Session) ChunkRadius

func (s *Session) ChunkRadius() int32

ChunkRadius returns the chunk radius of the session.

func (*Session) ClientData

func (s *Session) ClientData() login.ClientData

ClientData returns the login.ClientData of the underlying *minecraft.Conn.

func (*Session) Close

func (s *Session) Close(tx *world.Tx, c Controllable)

Close closes the session, which in turn closes the controllable and the connection that the session manages. Close ensures the method only runs code on the first call.

func (*Session) CloseConnection

func (s *Session) CloseConnection()

CloseConnection closes the underlying connection of the session so that the session ends up being closed eventually.

func (*Session) CloseDialogue

func (s *Session) CloseDialogue()

func (*Session) CloseForm

func (s *Session) CloseForm()

CloseForm closes any forms that the player currently has open. If the player has no forms open, nothing happens.

func (*Session) Disconnect

func (s *Session) Disconnect(message string)

Disconnect disconnects the client and ultimately closes the session. If the message passed is non-empty, it will be shown to the client.

func (*Session) EnableCoordinates

func (s *Session) EnableCoordinates(enable bool)

EnableCoordinates will either enable or disable coordinates for the player depending on the value given.

func (*Session) EnableInstantRespawn

func (s *Session) EnableInstantRespawn(enable bool)

EnableInstantRespawn will either enable or disable instant respawn for the player depending on the value given.

func (*Session) HandleInventories

func (s *Session) HandleInventories(tx *world.Tx, c Controllable, inv, offHand, enderChest, ui *inventory.Inventory, armour *inventory.Armour, heldSlot *uint32)

HandleInventories starts handling the inventories of the Controllable entity of the session. It sends packets when slots in the inventory are changed.

func (*Session) HideEntity

func (s *Session) HideEntity(e world.Entity)

HideEntity ...

func (*Session) HideHudElement

func (s *Session) HideHudElement(e hud.Element)

HideHudElement hides a HUD element from the player if it is not already hidden. If the element is waiting to be shown, it will be removed from the updates and remain hidden from the player.

func (*Session) HudElementHidden

func (s *Session) HudElementHidden(e hud.Element) bool

HudElementHidden checks if a HUD element is currently hidden from the player.

func (*Session) Latency

func (s *Session) Latency() time.Duration

Latency returns the latency of the connection.

func (*Session) OpenBlockContainer

func (s *Session) OpenBlockContainer(pos cube.Pos, tx *world.Tx)

OpenBlockContainer ...

func (*Session) OpenSign

func (s *Session) OpenSign(pos cube.Pos, frontSide bool)

OpenSign ...

func (*Session) PlaySound

func (s *Session) PlaySound(t world.Sound, pos mgl64.Vec3)

PlaySound plays a world.Sound to the client. The volume is not dependent on the distance to the source if it is a sound of the LevelSoundEvent packet.

func (*Session) RemoveAllDebugShapes

func (s *Session) RemoveAllDebugShapes()

RemoveAllDebugShapes removes all rendered debug shapes from the player, as well as any shapes that have not yet been rendered.

func (*Session) RemoveBossBar

func (s *Session) RemoveBossBar()

RemoveBossBar removes any boss bar currently active on the player's screen.

func (*Session) RemoveDebugShape

func (s *Session) RemoveDebugShape(shape debug.Shape)

RemoveDebugShape removes a debug shape from the player by its unique identifier.

func (*Session) RemoveScoreboard

func (s *Session) RemoveScoreboard()

RemoveScoreboard ...

func (*Session) SendAbilities

func (s *Session) SendAbilities(c Controllable)

SendAbilities sends the abilities of the Controllable entity of the session to the client.

func (*Session) SendActionBarMessage

func (s *Session) SendActionBarMessage(text string)

SendActionBarMessage ...

func (*Session) SendAnnouncement

func (s *Session) SendAnnouncement(message string)

SendAnnouncement ...

func (*Session) SendBossBar

func (s *Session) SendBossBar(text string, colour uint8, healthPercentage float64)

SendBossBar sends a boss bar to the player with the text passed and the health percentage of the bar. SendBossBar removes any boss bar that might be active before sending the new one.

func (*Session) SendChargeItemComplete

func (s *Session) SendChargeItemComplete()

SendChargeItemComplete sends a packet to indicate that the item charging process has been completed.

func (*Session) SendCommandOutput

func (s *Session) SendCommandOutput(output *cmd.Output, l language.Tag)

SendCommandOutput sends the output of a command to the player. It will be shown to the caller of the command, which might be the player or a websocket server.

func (*Session) SendDebugShapes

func (s *Session) SendDebugShapes(dim world.Dimension)

SendDebugShapes sends any pending additions/removals of debug shapes to the player. Shapes should be sent every tick to allow for batching and time-efficient updates.

func (*Session) SendDialogue

func (s *Session) SendDialogue(d dialogue.Dialogue, e world.Entity)

SendDialogue sends an NPC dialogue to the client of the connection. The Submit method of the dialogue is called when the client interacts with a button in the dialogue.

func (*Session) SendEffect

func (s *Session) SendEffect(e effect.Effect)

SendEffect sends an effects passed to the player.

func (*Session) SendEffectRemoval

func (s *Session) SendEffectRemoval(e effect.Type)

SendEffectRemoval sends the removal of an effect passed.

func (*Session) SendExperience

func (s *Session) SendExperience(level int, progress float64)

SendExperience sends the experience level and progress from the given experience manager to the player.

func (*Session) SendFood

func (s *Session) SendFood(food int, saturation, exhaustion float64)

SendFood ...

func (*Session) SendForm

func (s *Session) SendForm(f form.Form)

SendForm sends a form to the client of the connection. The Submit method of the form is called when the client submits the form.

func (*Session) SendGameMode

func (s *Session) SendGameMode(c Controllable)

SendGameMode sends the game mode of the Controllable entity of the session to the client. It makes sure the right flags are set to create the full game mode.

func (*Session) SendHealth

func (s *Session) SendHealth(health, max, absorption float64)

SendHealth sends the health and max health to the player.

func (*Session) SendHeldSlot

func (s *Session) SendHeldSlot(slot int, c Controllable, force bool)

SendHeldSlot sends the currently held hotbar slot.

func (*Session) SendHudUpdates

func (s *Session) SendHudUpdates()

SendHudUpdates sends any pending HUD updates to the player. The updates are batched to reduce the number of packets being sent. Up to 2 packets will be sent, one for showing elements and one for hiding elements.

func (*Session) SendJukeboxPopup

func (s *Session) SendJukeboxPopup(message string)

SendJukeboxPopup ...

func (*Session) SendMessage

func (s *Session) SendMessage(message string)

SendMessage ...

func (*Session) SendPlayerSpawn

func (s *Session) SendPlayerSpawn(pos mgl64.Vec3)

SendPlayerSpawn updates the player's spawn point on the client-side. There is currently little reason to do so other than to prevent the client-side "Respawn point set" message when sleeping in a bed.

func (*Session) SendPopup

func (s *Session) SendPopup(message string)

SendPopup ...

func (*Session) SendRespawn

func (s *Session) SendRespawn(pos mgl64.Vec3, c Controllable)

SendRespawn spawns the Controllable entity of the session client-side in the world, provided it has died.

func (*Session) SendScoreboard

func (s *Session) SendScoreboard(sb *scoreboard.Scoreboard)

SendScoreboard ...

func (*Session) SendSpeed

func (s *Session) SendSpeed(speed float64)

SendSpeed sends the speed of the player in an UpdateAttributes packet, so that it is updated client-side.

func (*Session) SendSubtitle

func (s *Session) SendSubtitle(text string)

SendSubtitle ...

func (*Session) SendTip

func (s *Session) SendTip(message string)

SendTip ...

func (*Session) SendTitle

func (s *Session) SendTitle(text string)

SendTitle ...

func (*Session) SendToast

func (s *Session) SendToast(title, message string)

SendToast ...

func (*Session) SendTranslation

func (s *Session) SendTranslation(t chat.Translation, l language.Tag, a []any)

SendTranslation sends a translation localised for a specific language.Tag.

func (*Session) SetHandle

func (s *Session) SetHandle(handle *world.EntityHandle, skin skin.Skin)

SetHandle sets the world.EntityHandle of the Session and attaches a skin to other players on join.

func (*Session) SetTitleDurations

func (s *Session) SetTitleDurations(fadeInDuration, remainDuration, fadeOutDuration time.Duration)

SetTitleDurations ...

func (*Session) ShowHudElement

func (s *Session) ShowHudElement(e hud.Element)

ShowHudElement shows a HUD element to the player if it is not already shown. If the element is waiting to be hidden, it will be removed from the updates and remain visible to the player.

func (*Session) Spawn

func (s *Session) Spawn(c Controllable, tx *world.Tx)

Spawn makes the Controllable passed spawn in the world.World. The function passed will be called when the session stops running.

func (*Session) StartShowingEntity

func (s *Session) StartShowingEntity(e world.Entity)

StartShowingEntity starts showing a world.Entity to the Session that was previously hidden using StopShowingEntity.

func (*Session) StopShowingEntity

func (s *Session) StopShowingEntity(e world.Entity)

StopShowingEntity stops showing a world.Entity to the Session. It will be completely invisible until a call to StartShowingEntity is made.

func (*Session) Transfer

func (s *Session) Transfer(ip net.IP, port int)

Transfer transfers the player to a server with the IP and port passed.

func (*Session) VerifyAndSetHeldSlot

func (s *Session) VerifyAndSetHeldSlot(slot int, expected item.Stack, c Controllable) error

VerifyAndSetHeldSlot verifies if the slot passed is a valid hotbar slot and if the expected item.Stack is in it. Afterwards, it changes the held slot of the player.

func (*Session) VerifySlot

func (s *Session) VerifySlot(slot int, expected item.Stack) error

VerifySlot verifies if the slot passed is a valid hotbar slot and if the expected item.Stack is in it.

func (*Session) ViewBlockAction

func (s *Session) ViewBlockAction(pos cube.Pos, a world.BlockAction)

ViewBlockAction ...

func (*Session) ViewBlockUpdate

func (s *Session) ViewBlockUpdate(pos cube.Pos, b world.Block, layer int)

ViewBlockUpdate ...

func (*Session) ViewBrewingUpdate

func (s *Session) ViewBrewingUpdate(prevBrewTime, brewTime time.Duration, prevFuelAmount, fuelAmount, prevFuelTotal, fuelTotal int32)

ViewBrewingUpdate updates a brewing stand for the associated session based on previous times.

func (*Session) ViewChunk

func (s *Session) ViewChunk(pos world.ChunkPos, dim world.Dimension, blockEntities map[cube.Pos]world.Block, c *chunk.Chunk)

ViewChunk ...

func (*Session) ViewEmote

func (s *Session) ViewEmote(player world.Entity, emote uuid.UUID)

ViewEmote ...

func (*Session) ViewEntity

func (s *Session) ViewEntity(e world.Entity)

ViewEntity ...

func (*Session) ViewEntityAction

func (s *Session) ViewEntityAction(e world.Entity, a world.EntityAction)

ViewEntityAction ...

func (*Session) ViewEntityAnimation

func (s *Session) ViewEntityAnimation(e world.Entity, a world.EntityAnimation)

ViewEntityAnimation ...

func (*Session) ViewEntityArmour

func (s *Session) ViewEntityArmour(e world.Entity)

ViewEntityArmour ...

func (*Session) ViewEntityGameMode

func (s *Session) ViewEntityGameMode(e world.Entity)

ViewEntityGameMode ...

func (*Session) ViewEntityItems

func (s *Session) ViewEntityItems(e world.Entity)

ViewEntityItems ...

func (*Session) ViewEntityMovement

func (s *Session) ViewEntityMovement(e world.Entity, pos mgl64.Vec3, rot cube.Rotation, onGround bool)

ViewEntityMovement ...

func (*Session) ViewEntityState

func (s *Session) ViewEntityState(e world.Entity)

ViewEntityState ...

func (*Session) ViewEntityTeleport

func (s *Session) ViewEntityTeleport(e world.Entity, position mgl64.Vec3)

ViewEntityTeleport ...

func (*Session) ViewEntityVelocity

func (s *Session) ViewEntityVelocity(e world.Entity, velocity mgl64.Vec3)

ViewEntityVelocity ...

func (*Session) ViewEntityWake

func (s *Session) ViewEntityWake(e world.Entity)

ViewEntityWake ...

func (*Session) ViewFurnaceUpdate

func (s *Session) ViewFurnaceUpdate(prevCookTime, cookTime, prevRemainingFuelTime, remainingFuelTime, prevMaxFuelTime, maxFuelTime time.Duration)

ViewFurnaceUpdate updates a furnace for the associated session based on previous times.

func (*Session) ViewItemCooldown

func (s *Session) ViewItemCooldown(item world.Item, duration time.Duration)

ViewItemCooldown ...

func (*Session) ViewParticle

func (s *Session) ViewParticle(pos mgl64.Vec3, p world.Particle)

ViewParticle ...

func (*Session) ViewSkin

func (s *Session) ViewSkin(e world.Entity)

ViewSkin ...

func (*Session) ViewSleepingPlayers

func (s *Session) ViewSleepingPlayers(sleeping, max int)

ViewSleepingPlayers ...

func (*Session) ViewSlotChange

func (s *Session) ViewSlotChange(slot int, newItem item.Stack)

ViewSlotChange ...

func (*Session) ViewSound

func (s *Session) ViewSound(pos mgl64.Vec3, soundType world.Sound)

ViewSound ...

func (*Session) ViewSubChunks

func (s *Session) ViewSubChunks(centre world.SubChunkPos, offsets []protocol.SubChunkOffset, tx *world.Tx)

ViewSubChunks ...

func (*Session) ViewTime

func (s *Session) ViewTime(time int)

ViewTime ...

func (*Session) ViewTimeCycle

func (s *Session) ViewTimeCycle(doDayLightCycle bool)

ViewTimeCycle ...

func (*Session) ViewWeather

func (s *Session) ViewWeather(raining, thunder bool)

ViewWeather ...

func (*Session) ViewWorldSpawn

func (s *Session) ViewWorldSpawn(pos cube.Pos)

ViewWorldSpawn ...

func (*Session) VisibleDebugShapes

func (s *Session) VisibleDebugShapes() []debug.Shape

VisibleDebugShapes returns a slice of all debug shapes that are currently being shown to the player.

type SubChunkRequestHandler

type SubChunkRequestHandler struct{}

SubChunkRequestHandler handles sub-chunk requests from the client. The server will respond with a packet containing the requested sub-chunks.

func (*SubChunkRequestHandler) Handle

Handle ...

type TextHandler

type TextHandler struct{}

TextHandler handles the Text packet.

func (TextHandler) Handle

func (TextHandler) Handle(p packet.Packet, s *Session, _ *world.Tx, c Controllable) error

Handle ...

Jump to

Keyboard shortcuts

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