Example #1
0
func init() {
	console.NewStringVar("cl_version", stevenBuildVersion).Doc(`
cl_version returns the build information compiled into steven.
Returns dev if not set.
`)
	console.NewStringVar("cl_mc_version", resource.ResourcesVersion).Doc(`
cl_mc_version returns the minecraft version steven currently supports.
`)
	console.Register("connect %", connect)
}
Example #2
0
		invScreen.setCursor(ItemStackFromProtocol(p.ItemStack))
	}
	if p.Slot >= int16(len(inv.Items)) {
		return
	}
	inv.Items[p.Slot] = ItemStackFromProtocol(p.ItemStack)
	inv.Update()
}

func (handler) PlaySound(p *protocol.SoundEffect) {
	PlaySoundAt(p.Name, float64(p.Volume), float64(p.Pitch)/63, mgl32.Vec3{
		float32(p.X) / 8,
		float32(p.Y) / 8,
		float32(p.Z) / 8,
	})
}

func (h handler) PluginMessage(p *protocol.PluginMessageClientbound) {
	h.handlePluginMessage(p.Channel, bytes.NewReader(p.Data), false)
}

var serverBrand = console.NewStringVar("sv_brand", "unknown").Doc(`
sv_brand shows the last sent MC|Brand packet from the server.
This identifies the make of the server like vanilla, spigot, forge
etc. 
`)

func (h handler) ServerBrand(b *pmMinecraftBrand) {
	serverBrand.SetValue(b.Brand)
}
Example #3
0
package steven

import (
	"bytes"
	"fmt"
	"strings"

	"github.com/thinkofdeath/steven/console"
	"github.com/thinkofdeath/steven/render"
	"github.com/thinkofdeath/steven/resource"
	"github.com/thinkofdeath/steven/resource/locale"
	"github.com/thinkofdeath/steven/ui"
)

var resourcePacks = console.NewStringVar("cl_resource_packs", "", console.Serializable).Doc(`
cl_resource_packs is a comma seperated list of resource packs 
that are currently enabled.
`)

func initResources() {
	var pBar *progressBar
	resource.Init(func(progress float64, done bool) {
		if !done {
			if pBar == nil {
				pBar = newProgressBar()
			}
			pBar.update(progress, fmt.Sprintf("Downloading textures: %v/100", int(100*progress)))
		} else {
			if pBar != nil {
				pBar.remove()
Example #4
0
	"github.com/go-gl/glfw/v3.1/glfw"
	"github.com/thinkofdeath/steven/console"
	"github.com/thinkofdeath/steven/format"
	"github.com/thinkofdeath/steven/protocol/mojang"
	"github.com/thinkofdeath/steven/render"
	"github.com/thinkofdeath/steven/resource"
	"github.com/thinkofdeath/steven/ui"
)

var (
	connected bool
	skipLogin bool

	stevenBuildVersion string = "dev"

	clientUsername = console.NewStringVar("cl_username", "", console.Serializable).Doc(`
cl_username is the username that the client will use to connect
to servers.
`)
	clientUUID = console.NewStringVar("cl_uuid", "", console.Serializable).Doc(`
cl_uuid is the uuid of the client. This is unique to a player 
unlike their username.
`)
	clientAccessToken = console.NewStringVar("auth_token", "", console.Serializable).Doc(`
auth_token is the token used for this session to auth to servers
or relogin to this account.
`)
	clientToken = console.NewStringVar("auth_client_token", "", console.Serializable).Doc(`
auth_client_token is a token that stays static between sessions.
Used to identify this client vs others.
`)
Example #5
0
File: ui.go Project: num5/steven
import (
	"math"

	"github.com/thinkofdeath/steven/console"
	"github.com/thinkofdeath/steven/ui"
	"github.com/thinkofdeath/steven/ui/scene"
)

const (
	uiAuto   = "auto"
	uiSmall  = "small"
	uiMedium = "medium"
	uiLarge  = "large"
)

var uiScale = console.NewStringVar("cl_ui_scale", "auto", console.Mutable, console.Serializable).
	Doc(`
cl_ui_scale sets the scaling used for the user interface. 
Valid values are:
- auto
- small
- medium
- large
`)

func init() {
	uiScale.Callback(func() {
		setUIScale()
	})
	ui.ClickSound = func() {
		PlaySound("random.click")