steven

package module
v0.0.0-...-03afc55 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2015 License: Apache-2.0 Imports: 56 Imported by: 0

README

Steven

Not actively maintained anymore

A work in progress Minecraft client in Go. Don't expect it to go anywhere, just doing this for fun.

Images

Steven

Steven with Nether style background and a resource pack

Steven's server list after disconnecting from a server

Building

To build:

export GOPATH=your/install/directory
go get github.com/thinkofdeath/steven/cmd/steven

To update, run go get with the -u option.

Requires csfml libraries and headers to build.

What works

  • Connecting to servers
  • Online mode
  • Rendering most blocks
  • Block model support

What doesn't work

  • 99% of Minecraft's features

Chat

I generally am on the irc.spi.gt irc network in the #think channel. Feel free to pop in to say hi, Webchat can be found here

Builds

Latest:

# Linux OS X Windows
x64 linux_amd64.zip Issue windows_amd64.zip
x32 Issue Issue windows_386.zip

Older builds can be found here

Running

Via the Offical Minecraft launcher

Profile example

You need to create a new profile (or edit an existing one) on the Minecraft launcher and modify the profile to look like the above but replace the path to steven with the location you built it at or downloaded it too and change the server parameter to the target server. Currently only works in online mode (with no plans for offline mode currently). If the server parameter isn't passed then a server list will be displayed.

Standalone

Just running steven via a double click (Windows) or ./steven (everything else) will bring up a login screen followed by a server list which you can select a server from.

Providing a username, uuid and access token via the command line as followed: --username <username> --uuid <uuid> --accessToken <access token> will skip the login screen and jump straight to the server list. Providing a server address via --server <server>:<port> will skip the server list and connect straight to the server. As it currently stands providing all the arguments allows for the client to parallelise connecting to the server and loading the textures/models/other assets as a 'quick connect'.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Blocks = struct {
	Air                        *BlockSet `cullAgainst:"false" collidable:"false" renderable:"false"`
	Stone                      *BlockSet `type:"stone"`
	Grass                      *BlockSet `type:"grass"`
	Dirt                       *BlockSet
	Cobblestone                *BlockSet
	Planks                     *BlockSet `type:"planks"`
	Sapling                    *BlockSet `type:"sapling"`
	Bedrock                    *BlockSet `hardness:"Inf"`
	FlowingWater               *BlockSet `type:"liquid"`
	Water                      *BlockSet `type:"liquid"`
	FlowingLava                *BlockSet `type:"liquid" lava:"true"`
	Lava                       *BlockSet `type:"liquid" lava:"true"`
	Sand                       *BlockSet `hardness:"0.5"`
	Gravel                     *BlockSet
	GoldOre                    *BlockSet
	IronOre                    *BlockSet
	CoalOre                    *BlockSet
	Log                        *BlockSet `type:"log"`
	Leaves                     *BlockSet `type:"leaves"`
	Sponge                     *BlockSet `type:"sponge"`
	Glass                      *BlockSet `cullAgainst:"false"`
	LapisOre                   *BlockSet
	LapisBlock                 *BlockSet
	Dispenser                  *BlockSet `type:"dispenser"`
	Sandstone                  *BlockSet
	NoteBlock                  *BlockSet `mc:"noteblock"`
	Bed                        *BlockSet `type:"bed"`
	GoldenRail                 *BlockSet `type:"poweredRail"`
	DetectorRail               *BlockSet `type:"poweredRail"`
	StickyPiston               *BlockSet `type:"piston"`
	Web                        *BlockSet `cullAgainst:"false" collidable:"false"`
	TallGrass                  *BlockSet `type:"tallGrass" mc:"tallgrass"`
	DeadBush                   *BlockSet `type:"deadBush" mc:"deadbush"`
	Piston                     *BlockSet `type:"piston"`
	PistonHead                 *BlockSet `type:"pistonHead"`
	Wool                       *BlockSet `type:"wool"`
	PistonExtension            *BlockSet `renderable:"false"`
	YellowFlower               *BlockSet `type:"yellowFlower"`
	RedFlower                  *BlockSet `type:"redFlower"`
	BrownMushroom              *BlockSet `cullAgainst:"false" collidable:"false"`
	RedMushroom                *BlockSet `cullAgainst:"false" collidable:"false"`
	GoldBlock                  *BlockSet
	IronBlock                  *BlockSet
	DoubleStoneSlab            *BlockSet `type:"slabDoubleSeamless" variant:"stone"`
	StoneSlab                  *BlockSet `type:"slab" variant:"stone"`
	BrickBlock                 *BlockSet
	TNT                        *BlockSet `mc:"tnt"`
	BookShelf                  *BlockSet `mc:"bookshelf"`
	MossyCobblestone           *BlockSet
	Obsidian                   *BlockSet
	Torch                      *BlockSet `type:"torch" model:"torch"`
	Fire                       *BlockSet `type:"fire"`
	MobSpawner                 *BlockSet
	OakStairs                  *BlockSet `type:"stairs"`
	Chest                      *BlockSet
	RedstoneWire               *BlockSet `type:"redstone"`
	DiamondOre                 *BlockSet
	DiamondBlock               *BlockSet
	CraftingTable              *BlockSet
	Wheat                      *BlockSet `type:"crop"`
	Farmland                   *BlockSet `type:"farmland"`
	Furnace                    *BlockSet
	FurnaceLit                 *BlockSet
	StandingSign               *BlockSet `type:"floorSign"`
	WoodenDoor                 *BlockSet `type:"door"`
	Ladder                     *BlockSet
	Rail                       *BlockSet `type:"rail"`
	StoneStairs                *BlockSet `type:"stairs"`
	WallSign                   *BlockSet `type:"wallSign"`
	Lever                      *BlockSet
	StonePressurePlate         *BlockSet
	IronDoor                   *BlockSet `type:"door"`
	WoodenPressurePlate        *BlockSet
	RedstoneOre                *BlockSet
	RedstoneOreLit             *BlockSet
	RedstoneTorchUnlit         *BlockSet `type:"torch" model:"unlit_redstone_torch"`
	RedstoneTorch              *BlockSet `type:"torch" model:"redstone_torch"`
	StoneButton                *BlockSet
	SnowLayer                  *BlockSet `type:"snowLayer"`
	Ice                        *BlockSet `translucent:"true" cullAgainst:"false"`
	Snow                       *BlockSet
	Cactus                     *BlockSet `type:"cactus"`
	Clay                       *BlockSet
	Reeds                      *BlockSet `cullAgainst:"false" collidable:"false"`
	Jukebox                    *BlockSet
	Fence                      *BlockSet `type:"fence"`
	Pumpkin                    *BlockSet
	Netherrack                 *BlockSet
	SoulSand                   *BlockSet
	Glowstone                  *BlockSet
	Portal                     *BlockSet `type:"portal"`
	PumpkinLit                 *BlockSet
	Cake                       *BlockSet
	RepeaterUnpowered          *BlockSet
	RepeaterPowered            *BlockSet
	StainedGlass               *BlockSet `type:"stainedGlass"`
	TrapDoor                   *BlockSet
	MonsterEgg                 *BlockSet
	StoneBrick                 *BlockSet `mc:"stonebrick" type:"stonebrick"`
	BrownMushroomBlock         *BlockSet
	RedMushroomBlock           *BlockSet
	IronBars                   *BlockSet `type:"connectable"`
	GlassPane                  *BlockSet `type:"connectable"`
	MelonBlock                 *BlockSet
	PumpkinStem                *BlockSet
	MelonStem                  *BlockSet
	Vine                       *BlockSet `type:"vines"`
	FenceGate                  *BlockSet `type:"fenceGate"`
	BrickStairs                *BlockSet `type:"stairs"`
	StoneBrickStairs           *BlockSet `type:"stairs"`
	Mycelium                   *BlockSet
	Waterlily                  *BlockSet `type:"lilypad"`
	NetherBrick                *BlockSet
	NetherBrickFence           *BlockSet `type:"fence" wood:"false"`
	NetherBrickStairs          *BlockSet `type:"stairs"`
	NetherWart                 *BlockSet
	EnchantingTable            *BlockSet
	BrewingStand               *BlockSet
	Cauldron                   *BlockSet
	EndPortal                  *BlockSet `collidable:"false"`
	EndPortalFrame             *BlockSet
	EndStone                   *BlockSet
	DragonEgg                  *BlockSet
	RedstoneLamp               *BlockSet
	RedstoneLampLit            *BlockSet
	DoubleWoodenSlab           *BlockSet `type:"slabDouble" variant:"wood"`
	WoodenSlab                 *BlockSet `type:"slab" variant:"wood"`
	Cocoa                      *BlockSet
	SandstoneStairs            *BlockSet `type:"stairs"`
	EmeraldOre                 *BlockSet
	EnderChest                 *BlockSet
	TripwireHook               *BlockSet
	Tripwire                   *BlockSet
	EmeraldBlock               *BlockSet
	SpruceStairs               *BlockSet `type:"stairs"`
	BirchStairs                *BlockSet `type:"stairs"`
	JungleStairs               *BlockSet `type:"stairs"`
	CommandBlock               *BlockSet
	Beacon                     *BlockSet `cullAgainst:"false"`
	CobblestoneWall            *BlockSet `type:"wall"`
	FlowerPot                  *BlockSet
	Carrots                    *BlockSet `type:"crop"`
	Potatoes                   *BlockSet `type:"crop"`
	WoodenButton               *BlockSet
	Skull                      *BlockSet `type:"skull"`
	Anvil                      *BlockSet
	TrappedChest               *BlockSet
	LightWeightedPressurePlate *BlockSet
	HeavyWeightedPressurePlate *BlockSet
	ComparatorUnpowered        *BlockSet
	ComparatorPowered          *BlockSet
	DaylightDetector           *BlockSet
	RedstoneBlock              *BlockSet
	QuartzOre                  *BlockSet
	Hopper                     *BlockSet
	QuartzBlock                *BlockSet `type:"quartzBlock"`
	QuartzStairs               *BlockSet `type:"stairs"`
	ActivatorRail              *BlockSet `type:"poweredRail"`
	Dropper                    *BlockSet `type:"dispenser"`
	StainedHardenedClay        *BlockSet `type:"stainedClay"`
	StainedGlassPane           *BlockSet `type:"stainedGlassPane"`
	Leaves2                    *BlockSet `type:"leaves" second:"true"`
	Log2                       *BlockSet `type:"log" second:"true"`
	AcaciaStairs               *BlockSet `type:"stairs"`
	DarkOakStairs              *BlockSet `type:"stairs"`
	Slime                      *BlockSet
	Barrier                    *BlockSet `cullAgainst:"false" renderable:"false"`
	IronTrapDoor               *BlockSet
	Prismarine                 *BlockSet
	SeaLantern                 *BlockSet
	HayBlock                   *BlockSet
	Carpet                     *BlockSet `type:"carpet"`
	HardenedClay               *BlockSet
	CoalBlock                  *BlockSet
	PackedIce                  *BlockSet
	DoublePlant                *BlockSet `type:"doublePlant"`
	StandingBanner             *BlockSet
	WallBanner                 *BlockSet
	DaylightDetectorInverted   *BlockSet
	RedSandstone               *BlockSet
	RedSandstoneStairs         *BlockSet `type:"stairs"`
	DoubleStoneSlab2           *BlockSet `type:"slabDoubleSeamless" variant:"stone2"`
	StoneSlab2                 *BlockSet `type:"slab" variant:"stone2"`
	SpruceFenceGate            *BlockSet `type:"fenceGate"`
	BirchFenceGate             *BlockSet `type:"fenceGate"`
	JungleFenceGate            *BlockSet `type:"fenceGate"`
	DarkOakFenceGate           *BlockSet `type:"fenceGate"`
	AcaciaFenceGate            *BlockSet `type:"fenceGate"`
	SpruceFence                *BlockSet `type:"fence"`
	BirchFence                 *BlockSet `type:"fence"`
	JungleFence                *BlockSet `type:"fence"`
	DarkOakFence               *BlockSet `type:"fence"`
	AcaciaFence                *BlockSet `type:"fence"`
	SpruceDoor                 *BlockSet `type:"door"`
	BirchDoor                  *BlockSet `type:"door"`
	JungleDoor                 *BlockSet `type:"door"`
	AcaciaDoor                 *BlockSet `type:"door"`
	DarkOakDoor                *BlockSet `type:"door"`
	EndRod                     *BlockSet
	ChorusPlant                *BlockSet
	ChorusFlower               *BlockSet
	PurpurBlock                *BlockSet
	PurpurPillar               *BlockSet
	PurpurStairs               *BlockSet `type:"stairs"`
	PurpurDoubleSlab           *BlockSet `type:"slabDoubleSeamless" variant:"purpur"`
	PurpurSlab                 *BlockSet `type:"slab" variant:"purpur"`
	EndBricks                  *BlockSet
	Beetroots                  *BlockSet
	GrassPath                  *BlockSet `cullAgainst:"false"`
	EndGateway                 *BlockSet
	StructureBlock             *BlockSet

	MissingBlock *BlockSet `mc:"steven:missing_block"`
}{}

Valid blocks.

View Source
var (
	InvPlayer = playerInventory{}
)

Functions

func AddPack

func AddPack(path string)

func ItemStackToProtocol

func ItemStackToProtocol(i *ItemStack) protocol.ItemStack

func Main

func Main(username, uuid, accessToken string)

func PlaySound

func PlaySound(name string)

func PlaySoundAt

func PlaySoundAt(name string, vol, pitch float64, v mgl32.Vec3)

func PlaySoundCallback

func PlaySoundCallback(name string, cb func())

note: callback only valid for streams

func RemovePack

func RemovePack(path string)

func StopAllMusic

func StopAllMusic()

Types

type Block

type Block interface {
	// Is returns whether this block is a member of the passed Set
	Is(s *BlockSet) bool
	BlockSet() *BlockSet

	Plugin() string
	Name() string
	SID() uint16
	Set(key string, val interface{}) Block
	UpdateState(x, y, z int) Block

	Collidable() bool
	CollisionBounds() []vmath.AABB

	Hardness() float64

	Renderable() bool
	ModelName() string
	ModelVariant() string
	Models() *blockVariants
	ForceShade() bool
	ShouldCullAgainst() bool
	TintImage() *image.NRGBA
	TintColor() (r, g, b byte)
	IsTranslucent() bool

	LightReduction() int
	LightEmitted() int
	String() string
	NameLocaleKey() string

	StepSound() (name string, vol, pitch float64)
	DigSound() (name string, vol, pitch float64)
	BreakSound() (name string, vol, pitch float64)

	CreateBlockEntity() BlockEntity
	// contains filtered or unexported methods
}

Block is a type of tile in the world. All blocks, excluding the special 'missing block', belong to a set.

func GetBlockByCombinedID

func GetBlockByCombinedID(id uint16) Block

GetBlockByCombinedID returns the block with the matching combined id. The combined id is:

block id << 4 | data

type BlockBreakComponent

type BlockBreakComponent interface {
	SetStage(stage int)
	Stage() int
	Update()
}

BlockBreakComponent is implemented by the block break animation entity

type BlockComponent

type BlockComponent interface {
	Position() Position
	SetPosition(p Position)
}

BlockComponent is a component that defines the location of an entity when attached to a block.

type BlockEntity

type BlockEntity interface {
	BlockComponent
}

BlockEntity is the interface for which all block entities must implement

type BlockNBTComponent

type BlockNBTComponent interface {
	Deserilize(tag *nbt.Compound)
	CanHandleAction(action int) bool
}

BlockNBTComponent is implemented by block entities that load information from nbt.

type BlockSet

type BlockSet struct {
	ID int

	Base   Block
	Blocks []Block
	// contains filtered or unexported fields
}

BlockSet is a collection of Blocks.

type ChatUI

type ChatUI struct {
	Lines [chatHistoryLines]format.AnyComponent
	// contains filtered or unexported fields
}

func (*ChatUI) Add

func (c *ChatUI) Add(msg format.AnyComponent)

func (*ChatUI) Draw

func (c *ChatUI) Draw(delta float64)

type ClientState

type ClientState struct {
	LX, LY, LZ float64
	X, Y, Z    float64
	Yaw, Pitch float64

	Health float64
	Hunger float64

	VSpeed   float64
	KeyState [keyCount]bool
	OnGround bool

	GameMode gameMode

	HardCore bool

	WorldType                  worldType
	WorldAge                   int64
	WorldTime, TargetWorldTime float64
	TickTime                   bool

	Bounds vmath.AABB
	// contains filtered or unexported fields
}
var Client *ClientState

func (*ClientState) MouseAction

func (c *ClientState) MouseAction(button glfw.MouseButton, down bool)

func (*ClientState) UpdateHealth

func (c *ClientState) UpdateHealth(health float64)

func (*ClientState) UpdateHunger

func (c *ClientState) UpdateHunger(hunger float64)

type ConfigData

type ConfigData struct {
	Servers []ConfigServer
}
var Config ConfigData

type ConfigServer

type ConfigServer struct {
	Name    string
	Address string
}

type DebugComponent

type DebugComponent interface {
	DebugColor() (r, g, b byte)
}

type DisplayTag

type DisplayTag interface {
	DisplayName() string
	Lore() []string
}

type Entity

type Entity interface{}

type Inventory

type Inventory struct {
	Type InventoryType
	ID   int

	Items []*ItemStack
	// contains filtered or unexported fields
}

func NewInventory

func NewInventory(ty InventoryType, id, size int) *Inventory

func (*Inventory) Close

func (inv *Inventory) Close()

func (*Inventory) Hide

func (inv *Inventory) Hide()

func (*Inventory) Show

func (inv *Inventory) Show()

func (*Inventory) Update

func (inv *Inventory) Update()

type InventoryType

type InventoryType interface {
	Draw(scene *scene.Type, inv *Inventory)
}

type ItemDamagable

type ItemDamagable interface {
	Damage() int16
	MaxDamage() int16
}

type ItemStack

type ItemStack struct {
	Type  ItemType
	Count int
	// contains filtered or unexported fields
}

func ItemStackFromProtocol

func ItemStackFromProtocol(p protocol.ItemStack) *ItemStack

type ItemType

type ItemType interface {
	Name() string
	NameLocaleKey() string

	ParseDamage(d int16)
	ParseTag(tag *nbt.Compound)
}

func ItemById

func ItemById(id int) (ty ItemType)

func ItemOfBlock

func ItemOfBlock(b Block) ItemType

type Key

type Key int
const (
	KeyForward Key = iota
	KeyBackwards
	KeyLeft
	KeyRight
	KeySprint
	KeyJump
	KeySneak
)

type NetworkComponent

type NetworkComponent interface {
	SetEntityID(id int)
	EntityID() int
}

type PlayerComponent

type PlayerComponent interface {
	SetUUID(protocol.UUID)
	UUID() protocol.UUID
}

type PlayerModelComponent

type PlayerModelComponent interface {
	SwingArm()
	SetCurrentItem(item *ItemStack)
}

type Position

type Position struct {
	X, Y, Z int
}

func (Position) Get

func (p Position) Get() (int, int, int)

func (Position) Shift

func (p Position) Shift(x, y, z int) Position

func (Position) ShiftDir

func (p Position) ShiftDir(d direction.Type) Position

func (Position) Vec

func (p Position) Vec() mgl32.Vec3

type PositionComponent

type PositionComponent interface {
	Position() (x, y, z float64)
	SetPosition(x, y, z float64)
}

type RotationComponent

type RotationComponent interface {
	Yaw() float64
	SetYaw(y float64)
	Pitch() float64
	SetPitch(p float64)
}

type SignComponent

type SignComponent interface {
	Update(lines [4]format.AnyComponent)
}

type SizeComponent

type SizeComponent interface {
	Bounds() vmath.AABB
}

type TargetPositionComponent

type TargetPositionComponent interface {
	TargetPosition() (x, y, z float64)
	SetTargetPosition(x, y, z float64)
}

type TargetRotationComponent

type TargetRotationComponent interface {
	TargetYaw() float64
	SetTargetYaw(y float64)
	TargetPitch() float64
	SetTargetPitch(p float64)
}

Directories

Path Synopsis
cmd
Package console implements a system for parsing and executing commands + logging.
Package console implements a system for parsing and executing commands + logging.
encoding
json
Package json proxies requests to encoding/json but allows for 'broken' json
Package json proxies requests to encoding/json but allows for 'broken' json
nbt
Package entitysys provides a simple entity component system for handling entities.
Package entitysys provides a simple entity component system for handling entities.
Package protocol provides definitions for Minecraft packets as well as methods for reading and writing them
Package protocol provides definitions for Minecraft packets as well as methods for reading and writing them
atlas
Package atlas provides a basic texture atlas
Package atlas provides a basic texture atlas
builder
Package builder provides a simple way to create buffers to upload to the gpu
Package builder provides a simple way to create buffers to upload to the gpu
gl
Package gl provides a more Go friendly OpenGL API
Package gl provides a more Go friendly OpenGL API
glsl
Package glsl handles glsl shaders and applies some preprocessing to them
Package glsl handles glsl shaders and applies some preprocessing to them
type
bit
ui
Package ui provides methods to draw a user interface onto the the screen and manage resizing.
Package ui provides methods to draw a user interface onto the the screen and manage resizing.
scene
Package scene provides methods to manage and load multiple ui scenes.
Package scene provides methods to manage and load multiple ui scenes.
world

Jump to

Keyboard shortcuts

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