Documentation ¶
Index ¶
- func ClientReadHandshake(reader io.Reader) (serverId string, err os.Error)
- func ClientReadPacket(reader io.Reader, handler IClientPacketHandler) os.Error
- func ClientWriteLogin(writer io.Writer, username, password string) (err os.Error)
- func ClientWritePlayerPositionLook(writer io.Writer, position *AbsXyz, stance AbsCoord, look *LookDegrees, ...) (err os.Error)
- func ServerReadHandshake(reader io.Reader) (username string, err os.Error)
- func ServerReadLogin(reader io.Reader) (username string, err os.Error)
- func ServerReadPacket(reader io.Reader, handler IServerPacketHandler) os.Error
- func ServerWriteHandshake(writer io.Writer, reply string) (err os.Error)
- func ServerWriteLogin(writer io.Writer, entityId EntityId, mapSeed RandomSeed, dimension DimensionId) (err os.Error)
- func ServerWritePlayerPositionLook(writer io.Writer, position *AbsXyz, stance AbsCoord, look *LookDegrees, ...) (err os.Error)
- func ServerWriteTimeUpdate(writer io.Writer, time Ticks) os.Error
- func WriteBedInvalid(writer io.Writer, field1 byte) (err os.Error)
- func WriteBedUse(writer io.Writer, flag bool, bedLoc *BlockXyz) (err os.Error)
- func WriteBlockChange(writer io.Writer, blockLoc *BlockXyz, blockType BlockId, blockMetaData byte) (err os.Error)
- func WriteBlockChangeMulti(writer io.Writer, chunkLoc *ChunkXz, blockCoords []SubChunkXyz, ...) (err os.Error)
- func WriteChatMessage(writer io.Writer, message string) (err os.Error)
- func WriteDisconnect(writer io.Writer, reason string) (err os.Error)
- func WriteEntity(writer io.Writer, entityId EntityId) (err os.Error)
- func WriteEntityAction(writer io.Writer, entityId EntityId, action EntityAction) (err os.Error)
- func WriteEntityAnimation(writer io.Writer, entityId EntityId, animation EntityAnimation) (err os.Error)
- func WriteEntityDestroy(writer io.Writer, entityId EntityId) os.Error
- func WriteEntityEquipment(writer io.Writer, entityId EntityId, slot SlotId, itemTypeId ItemTypeId, ...) (err os.Error)
- func WriteEntityLook(writer io.Writer, entityId EntityId, look *LookBytes) os.Error
- func WriteEntityLookAndRelMove(writer io.Writer, entityId EntityId, movement *RelMove, look *LookBytes) (err os.Error)
- func WriteEntityMetadata(writer io.Writer, entityId EntityId, data []EntityMetadata) (err os.Error)
- func WriteEntityRelMove(writer io.Writer, entityId EntityId, movement *RelMove) (err os.Error)
- func WriteEntitySpawn(writer io.Writer, entityId EntityId, mobType EntityMobType, ...) (err os.Error)
- func WriteEntityStatus(writer io.Writer, entityId EntityId, status EntityStatus) (err os.Error)
- func WriteEntityTeleport(writer io.Writer, entityId EntityId, position *AbsIntXyz, look *LookBytes) os.Error
- func WriteEntityVelocity(writer io.Writer, entityId EntityId, velocity *Velocity) (err os.Error)
- func WriteExplosion(writer io.Writer, position *AbsXyz, power float32, ...) (err os.Error)
- func WriteHoldingChange(writer io.Writer, slotId SlotId) (err os.Error)
- func WriteIncrementStatistic(writer io.Writer, statisticId StatisticId, delta int8) (err os.Error)
- func WriteItemCollect(writer io.Writer, collectedItem EntityId, collector EntityId) (err os.Error)
- func WriteItemSpawn(writer io.Writer, entityId EntityId, itemTypeId ItemTypeId, amount ItemCount, ...) os.Error
- func WriteKeepAlive(writer io.Writer) os.Error
- func WriteMapChunk(writer io.Writer, chunkLoc *ChunkXz, ...) (err os.Error)
- func WriteNamedEntitySpawn(writer io.Writer, entityId EntityId, name string, position *AbsIntXyz, ...) (err os.Error)
- func WriteNoteBlockPlay(writer io.Writer, position *BlockXyz, instrument InstrumentId, pitch NotePitch) (err os.Error)
- func WriteObjectSpawn(writer io.Writer, entityId EntityId, objType ObjTypeId, position *AbsIntXyz, ...) (err os.Error)
- func WritePaintingSpawn(writer io.Writer, entityId EntityId, title string, position *BlockXyz, ...) (err os.Error)
- func WritePlayer(writer io.Writer, onGround bool) (err os.Error)
- func WritePlayerBlockHit(writer io.Writer, status DigStatus, blockLoc *BlockXyz, face Face) (err os.Error)
- func WritePlayerBlockInteract(writer io.Writer, itemTypeId ItemTypeId, blockLoc *BlockXyz, face Face, ...) (err os.Error)
- func WritePlayerLook(writer io.Writer, look *LookDegrees, onGround bool) (err os.Error)
- func WritePlayerPosition(writer io.Writer, position *AbsXyz, stance AbsCoord, onGround bool) os.Error
- func WritePreChunk(writer io.Writer, chunkLoc *ChunkXz, mode ChunkLoadMode) os.Error
- func WriteRespawn(writer io.Writer, dimension DimensionId) os.Error
- func WriteSignUpdate(writer io.Writer, position *BlockXyz, lines [4]string) (err os.Error)
- func WriteSpawnPosition(writer io.Writer, position *BlockXyz) os.Error
- func WriteUnknown0x3d(writer io.Writer, field1, field2 int32, field3 int8, field4, field5 int32) (err os.Error)
- func WriteUnknown0x83(writer io.Writer, field1, field2 int16, field3 string) (err os.Error)
- func WriteUpdateHealth(writer io.Writer, health Health) (err os.Error)
- func WriteUseEntity(writer io.Writer, user EntityId, target EntityId, leftClick bool) (err os.Error)
- func WriteWeather(writer io.Writer, entityId EntityId, raining bool, position *AbsIntXyz) (err os.Error)
- func WriteWindowClick(writer io.Writer, windowId WindowId, slot SlotId, rightClick bool, txId TxId, ...) (err os.Error)
- func WriteWindowClose(writer io.Writer, windowId WindowId) (err os.Error)
- func WriteWindowItems(writer io.Writer, windowId WindowId, items []WindowSlot) (err os.Error)
- func WriteWindowOpen(writer io.Writer, windowId WindowId, invTypeId InvTypeId, windowTitle string, ...) (err os.Error)
- func WriteWindowProgressBar(writer io.Writer, windowId WindowId, prgBarId PrgBarId, value PrgBarValue) os.Error
- func WriteWindowSetSlot(writer io.Writer, windowId WindowId, slot SlotId, itemTypeId ItemTypeId, ...) (err os.Error)
- func WriteWindowTransaction(writer io.Writer, windowId WindowId, txId TxId, accepted bool) (err os.Error)
- type EntityMetadata
- type ExplosionOffsetXyz
- type IClientPacketHandler
- type IPacketHandler
- type IServerPacketHandler
- type ObjectData
- type WindowSlot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientReadHandshake ¶
func ClientReadPacket ¶
func ClientReadPacket(reader io.Reader, handler IClientPacketHandler) os.Error
A client should call this to receive a single packet from a client. It will block until a packet was successfully handled, or there was an error.
func ClientWriteLogin ¶
func ServerReadHandshake ¶
func ServerReadPacket ¶
func ServerReadPacket(reader io.Reader, handler IServerPacketHandler) os.Error
A server should call this to receive a single packet from a client. It will block until a packet was successfully handled, or there was an error.
func ServerWriteHandshake ¶
func ServerWriteLogin ¶
func WriteBedInvalid ¶
TODO Revise this when packet better understood.
func WriteBlockChange ¶
func WriteBlockChangeMulti ¶
func WriteEntityAction ¶
func WriteEntityAnimation ¶
func WriteEntityEquipment ¶
func WriteEntityLook ¶
func WriteEntityMetadata ¶
func WriteEntityMetadata(writer io.Writer, entityId EntityId, data []EntityMetadata) (err os.Error)
func WriteEntityRelMove ¶
func WriteEntitySpawn ¶
func WriteEntitySpawn(writer io.Writer, entityId EntityId, mobType EntityMobType, position *AbsIntXyz, look *LookBytes, data []EntityMetadata) (err os.Error)
func WriteEntityStatus ¶
func WriteEntityTeleport ¶
func WriteEntityVelocity ¶
func WriteExplosion ¶
func WriteIncrementStatistic ¶
func WriteItemCollect ¶
func WriteItemSpawn ¶
func WriteMapChunk ¶
func WriteNamedEntitySpawn ¶
func WriteNoteBlockPlay ¶
func WriteObjectSpawn ¶
func WriteObjectSpawn(writer io.Writer, entityId EntityId, objType ObjTypeId, position *AbsIntXyz, objectData *ObjectData) (err os.Error)
func WritePaintingSpawn ¶
func WritePlayerBlockHit ¶
func WritePlayerLook ¶
func WritePlayerPosition ¶
func WritePreChunk ¶
func WriteSignUpdate ¶
func WriteUnknown0x3d ¶
func WriteUnknown0x83 ¶
func WriteUseEntity ¶
func WriteWeather ¶
func WriteWindowClick ¶
func WriteWindowItems ¶
func WriteWindowItems(writer io.Writer, windowId WindowId, items []WindowSlot) (err os.Error)
func WriteWindowOpen ¶
func WriteWindowProgressBar ¶
func WriteWindowSetSlot ¶
Types ¶
type EntityMetadata ¶
type ExplosionOffsetXyz ¶
type ExplosionOffsetXyz struct {
X, Y, Z int8
}
type IClientPacketHandler ¶
type IClientPacketHandler interface { IPacketHandler ClientPacketLogin(entityId EntityId, mapSeed RandomSeed, dimension DimensionId) PacketTimeUpdate(time Ticks) PacketBedUse(flag bool, bedLoc *BlockXyz) PacketNamedEntitySpawn(entityId EntityId, name string, position *AbsIntXyz, look *LookBytes, currentItem ItemTypeId) PacketEntityEquipment(entityId EntityId, slot SlotId, itemTypeId ItemTypeId, data ItemData) PacketSpawnPosition(position *BlockXyz) PacketUpdateHealth(health Health) PacketItemSpawn(entityId EntityId, itemTypeId ItemTypeId, count ItemCount, data ItemData, location *AbsIntXyz, orientation *OrientationBytes) PacketItemCollect(collectedItem EntityId, collector EntityId) PacketObjectSpawn(entityId EntityId, objType ObjTypeId, position *AbsIntXyz, objectData *ObjectData) PacketEntitySpawn(entityId EntityId, mobType EntityMobType, position *AbsIntXyz, look *LookBytes, data []EntityMetadata) PacketPaintingSpawn(entityId EntityId, title string, position *BlockXyz, paintingType PaintingTypeId) PacketEntityVelocity(entityId EntityId, velocity *Velocity) PacketEntityDestroy(entityId EntityId) PacketEntity(entityId EntityId) PacketEntityRelMove(entityId EntityId, movement *RelMove) PacketEntityLook(entityId EntityId, look *LookBytes) PacketEntityTeleport(entityId EntityId, position *AbsIntXyz, look *LookBytes) PacketEntityStatus(entityId EntityId, status EntityStatus) PacketEntityMetadata(entityId EntityId, metadata []EntityMetadata) PacketPreChunk(position *ChunkXz, mode ChunkLoadMode) PacketMapChunk(position *BlockXyz, size *SubChunkSize, data []byte) PacketBlockChangeMulti(chunkLoc *ChunkXz, blockCoords []SubChunkXyz, blockTypes []BlockId, blockMetaData []byte) PacketBlockChange(blockLoc *BlockXyz, blockType BlockId, blockMetaData byte) PacketNoteBlockPlay(position *BlockXyz, instrument InstrumentId, pitch NotePitch) // NOTE method signature likely to change PacketExplosion(position *AbsXyz, power float32, blockOffsets []ExplosionOffsetXyz) PacketBedInvalid(field1 byte) PacketWeather(entityId EntityId, raining bool, position *AbsIntXyz) PacketWindowOpen(windowId WindowId, invTypeId InvTypeId, windowTitle string, numSlots byte) PacketWindowSetSlot(windowId WindowId, slot SlotId, itemTypeId ItemTypeId, amount ItemCount, data ItemData) PacketWindowItems(windowId WindowId, items []WindowSlot) PacketWindowProgressBar(windowId WindowId, prgBarId PrgBarId, value PrgBarValue) PacketUnknown0x83(field1, field2 int16, field3 string) PacketIncrementStatistic(statisticId StatisticId, delta int8) }
Clients to the protocol must implement this interface to receive packets
type IPacketHandler ¶
type IPacketHandler interface { PacketKeepAlive() PacketChatMessage(message string) PacketEntityAction(entityId EntityId, action EntityAction) PacketUseEntity(user EntityId, target EntityId, leftClick bool) PacketRespawn(dimension DimensionId) PacketPlayerPosition(position *AbsXyz, stance AbsCoord, onGround bool) PacketPlayerLook(look *LookDegrees, onGround bool) PacketPlayerBlockHit(status DigStatus, blockLoc *BlockXyz, face Face) PacketPlayerBlockInteract(itemTypeId ItemTypeId, blockLoc *BlockXyz, face Face, amount ItemCount, data ItemData) PacketEntityAnimation(entityId EntityId, animation EntityAnimation) PacketUnknown0x1b(field1, field2 float32, field3, field4 bool, field5, field6 float32) PacketUnknown0x3d(field1, field2 int32, field3 int8, field4, field5 int32) PacketWindowTransaction(windowId WindowId, txId TxId, accepted bool) PacketSignUpdate(position *BlockXyz, lines [4]string) PacketDisconnect(reason string) }
Packets commonly received by both client and server
type IServerPacketHandler ¶
type IServerPacketHandler interface { IPacketHandler PacketPlayer(onGround bool) PacketHoldingChange(slotId SlotId) PacketWindowClose(windowId WindowId) PacketWindowClick(windowId WindowId, slot SlotId, rightClick bool, txId TxId, shiftClick bool, expectedSlot *WindowSlot) }
Servers to the protocol must implement this interface to receive packets
type ObjectData ¶
type WindowSlot ¶
type WindowSlot struct { ItemTypeId ItemTypeId Count ItemCount Data ItemData }
Click to show internal directories.
Click to hide internal directories.