283 lines
9.5 KiB
Go
283 lines
9.5 KiB
Go
// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
|
|
//
|
|
// This code was generated from the following packages:
|
|
// pumpkin:plugin@0.1.0
|
|
|
|
package pumpkin_plugin_scoreboard
|
|
|
|
import (
|
|
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_common"
|
|
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_text"
|
|
witRuntime "go.bytecodealliance.org/pkg/wit/runtime"
|
|
"runtime"
|
|
"unsafe"
|
|
)
|
|
|
|
type TextComponent = pumpkin_plugin_text.TextComponent
|
|
type NamedColor = pumpkin_plugin_common.NamedColor
|
|
|
|
const (
|
|
RenderTypeInteger uint8 = 0
|
|
RenderTypeHearts uint8 = 1
|
|
)
|
|
|
|
type RenderType = uint8
|
|
|
|
const (
|
|
DisplaySlotPlayerList uint8 = 0
|
|
DisplaySlotSidebar uint8 = 1
|
|
DisplaySlotBelowName uint8 = 2
|
|
DisplaySlotSidebarTeamBlack uint8 = 3
|
|
DisplaySlotSidebarTeamDarkBlue uint8 = 4
|
|
DisplaySlotSidebarTeamDarkGreen uint8 = 5
|
|
DisplaySlotSidebarTeamDarkAqua uint8 = 6
|
|
DisplaySlotSidebarTeamDarkRed uint8 = 7
|
|
DisplaySlotSidebarTeamDarkPurple uint8 = 8
|
|
DisplaySlotSidebarTeamGold uint8 = 9
|
|
DisplaySlotSidebarTeamGray uint8 = 10
|
|
DisplaySlotSidebarTeamDarkGray uint8 = 11
|
|
DisplaySlotSidebarTeamBlue uint8 = 12
|
|
DisplaySlotSidebarTeamGreen uint8 = 13
|
|
DisplaySlotSidebarTeamAqua uint8 = 14
|
|
DisplaySlotSidebarTeamRed uint8 = 15
|
|
DisplaySlotSidebarTeamLightPurple uint8 = 16
|
|
DisplaySlotSidebarTeamYellow uint8 = 17
|
|
DisplaySlotSidebarTeamWhite uint8 = 18
|
|
)
|
|
|
|
type DisplaySlot = uint8
|
|
|
|
const (
|
|
NametagVisibilityAlways uint8 = 0
|
|
NametagVisibilityNever uint8 = 1
|
|
NametagVisibilityHideForOtherTeams uint8 = 2
|
|
NametagVisibilityHideForOwnTeam uint8 = 3
|
|
)
|
|
|
|
type NametagVisibility = uint8
|
|
|
|
const (
|
|
CollisionRuleAlways uint8 = 0
|
|
CollisionRuleNever uint8 = 1
|
|
CollisionRulePushOtherTeams uint8 = 2
|
|
CollisionRulePushOwnTeam uint8 = 3
|
|
)
|
|
|
|
type CollisionRule = uint8
|
|
|
|
type TeamSettings struct {
|
|
DisplayName *pumpkin_plugin_text.TextComponent
|
|
FriendlyFire bool
|
|
SeeFriendlyInvisibles bool
|
|
NametagVisibility NametagVisibility
|
|
CollisionRule CollisionRule
|
|
Color pumpkin_plugin_common.NamedColor
|
|
Prefix *pumpkin_plugin_text.TextComponent
|
|
Suffix *pumpkin_plugin_text.TextComponent
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [resource-drop]scoreboard
|
|
func resourceDropScoreboard(handle int32)
|
|
|
|
type Scoreboard struct {
|
|
handle *witRuntime.Handle
|
|
}
|
|
|
|
func (self *Scoreboard) TakeHandle() int32 {
|
|
return self.handle.Take()
|
|
}
|
|
|
|
func (self *Scoreboard) SetHandle(handle int32) {
|
|
self.handle.Set(handle)
|
|
}
|
|
|
|
func (self *Scoreboard) Handle() int32 {
|
|
return self.handle.Use()
|
|
}
|
|
|
|
func (self *Scoreboard) Drop() {
|
|
handle := self.handle.TakeOrNil()
|
|
if handle != 0 {
|
|
resourceDropScoreboard(handle)
|
|
}
|
|
}
|
|
|
|
func ScoreboardFromOwnHandle(handleValue int32) *Scoreboard {
|
|
handle := witRuntime.MakeHandle(handleValue)
|
|
value := &Scoreboard{handle}
|
|
runtime.AddCleanup(value, func(_ int) {
|
|
handleValue := handle.TakeOrNil()
|
|
if handleValue != 0 {
|
|
resourceDropScoreboard(handleValue)
|
|
}
|
|
}, 0)
|
|
return value
|
|
}
|
|
|
|
func ScoreboardFromBorrowHandle(handleValue int32) *Scoreboard {
|
|
handle := witRuntime.MakeHandle(handleValue)
|
|
return &Scoreboard{handle}
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.add-objective
|
|
func wasm_import_method_scoreboard_add_objective(arg0 int32, arg1 uintptr, arg2 uint32, arg3 int32, arg4 int32)
|
|
|
|
func (self *Scoreboard) AddObjective(name string, displayName *pumpkin_plugin_text.TextComponent, renderType RenderType) {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
utf8 := unsafe.Pointer(unsafe.StringData(name))
|
|
pinner.Pin(utf8)
|
|
wasm_import_method_scoreboard_add_objective((self).Handle(), uintptr(utf8), uint32(len(name)), (displayName).TakeHandle(), int32(renderType))
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.remove-objective
|
|
func wasm_import_method_scoreboard_remove_objective(arg0 int32, arg1 uintptr, arg2 uint32)
|
|
|
|
func (self *Scoreboard) RemoveObjective(name string) {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
utf8 := unsafe.Pointer(unsafe.StringData(name))
|
|
pinner.Pin(utf8)
|
|
wasm_import_method_scoreboard_remove_objective((self).Handle(), uintptr(utf8), uint32(len(name)))
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.set-display-slot
|
|
func wasm_import_method_scoreboard_set_display_slot(arg0 int32, arg1 int32, arg2 uintptr, arg3 uint32)
|
|
|
|
func (self *Scoreboard) SetDisplaySlot(slot DisplaySlot, objectiveName string) {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
utf8 := unsafe.Pointer(unsafe.StringData(objectiveName))
|
|
pinner.Pin(utf8)
|
|
wasm_import_method_scoreboard_set_display_slot((self).Handle(), int32(slot), uintptr(utf8), uint32(len(objectiveName)))
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.update-score
|
|
func wasm_import_method_scoreboard_update_score(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr, arg4 uint32, arg5 int32)
|
|
|
|
func (self *Scoreboard) UpdateScore(entityName string, objectiveName string, value int32) {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
utf8 := unsafe.Pointer(unsafe.StringData(entityName))
|
|
pinner.Pin(utf8)
|
|
utf80 := unsafe.Pointer(unsafe.StringData(objectiveName))
|
|
pinner.Pin(utf80)
|
|
wasm_import_method_scoreboard_update_score((self).Handle(), uintptr(utf8), uint32(len(entityName)), uintptr(utf80), uint32(len(objectiveName)), value)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.remove-score
|
|
func wasm_import_method_scoreboard_remove_score(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr, arg4 uint32)
|
|
|
|
func (self *Scoreboard) RemoveScore(entityName string, objectiveName string) {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
utf8 := unsafe.Pointer(unsafe.StringData(entityName))
|
|
pinner.Pin(utf8)
|
|
utf80 := unsafe.Pointer(unsafe.StringData(objectiveName))
|
|
pinner.Pin(utf80)
|
|
wasm_import_method_scoreboard_remove_score((self).Handle(), uintptr(utf8), uint32(len(entityName)), uintptr(utf80), uint32(len(objectiveName)))
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.create-team
|
|
func wasm_import_method_scoreboard_create_team(arg0 int32, arg1 uintptr, arg2 uint32, arg3 int32, arg4 int32, arg5 int32, arg6 int32, arg7 int32, arg8 int32, arg9 int32, arg10 int32)
|
|
|
|
func (self *Scoreboard) CreateTeam(name string, settings TeamSettings) {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
utf8 := unsafe.Pointer(unsafe.StringData(name))
|
|
pinner.Pin(utf8)
|
|
var result int32
|
|
if (settings).FriendlyFire {
|
|
result = 1
|
|
} else {
|
|
result = 0
|
|
}
|
|
var result0 int32
|
|
if (settings).SeeFriendlyInvisibles {
|
|
result0 = 1
|
|
} else {
|
|
result0 = 0
|
|
}
|
|
wasm_import_method_scoreboard_create_team((self).Handle(), uintptr(utf8), uint32(len(name)), ((settings).DisplayName).TakeHandle(), result, result0, int32((settings).NametagVisibility), int32((settings).CollisionRule), int32((settings).Color), ((settings).Prefix).TakeHandle(), ((settings).Suffix).TakeHandle())
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.remove-team
|
|
func wasm_import_method_scoreboard_remove_team(arg0 int32, arg1 uintptr, arg2 uint32)
|
|
|
|
func (self *Scoreboard) RemoveTeam(name string) {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
utf8 := unsafe.Pointer(unsafe.StringData(name))
|
|
pinner.Pin(utf8)
|
|
wasm_import_method_scoreboard_remove_team((self).Handle(), uintptr(utf8), uint32(len(name)))
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.update-team
|
|
func wasm_import_method_scoreboard_update_team(arg0 int32, arg1 uintptr, arg2 uint32, arg3 int32, arg4 int32, arg5 int32, arg6 int32, arg7 int32, arg8 int32, arg9 int32, arg10 int32)
|
|
|
|
func (self *Scoreboard) UpdateTeam(name string, settings TeamSettings) {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
utf8 := unsafe.Pointer(unsafe.StringData(name))
|
|
pinner.Pin(utf8)
|
|
var result int32
|
|
if (settings).FriendlyFire {
|
|
result = 1
|
|
} else {
|
|
result = 0
|
|
}
|
|
var result0 int32
|
|
if (settings).SeeFriendlyInvisibles {
|
|
result0 = 1
|
|
} else {
|
|
result0 = 0
|
|
}
|
|
wasm_import_method_scoreboard_update_team((self).Handle(), uintptr(utf8), uint32(len(name)), ((settings).DisplayName).TakeHandle(), result, result0, int32((settings).NametagVisibility), int32((settings).CollisionRule), int32((settings).Color), ((settings).Prefix).TakeHandle(), ((settings).Suffix).TakeHandle())
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.add-player-to-team
|
|
func wasm_import_method_scoreboard_add_player_to_team(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr, arg4 uint32)
|
|
|
|
func (self *Scoreboard) AddPlayerToTeam(teamName string, playerName string) {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
utf8 := unsafe.Pointer(unsafe.StringData(teamName))
|
|
pinner.Pin(utf8)
|
|
utf80 := unsafe.Pointer(unsafe.StringData(playerName))
|
|
pinner.Pin(utf80)
|
|
wasm_import_method_scoreboard_add_player_to_team((self).Handle(), uintptr(utf8), uint32(len(teamName)), uintptr(utf80), uint32(len(playerName)))
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/scoreboard@0.1.0 [method]scoreboard.remove-player-from-team
|
|
func wasm_import_method_scoreboard_remove_player_from_team(arg0 int32, arg1 uintptr, arg2 uint32, arg3 uintptr, arg4 uint32)
|
|
|
|
func (self *Scoreboard) RemovePlayerFromTeam(teamName string, playerName string) {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
utf8 := unsafe.Pointer(unsafe.StringData(teamName))
|
|
pinner.Pin(utf8)
|
|
utf80 := unsafe.Pointer(unsafe.StringData(playerName))
|
|
pinner.Pin(utf80)
|
|
wasm_import_method_scoreboard_remove_player_from_team((self).Handle(), uintptr(utf8), uint32(len(teamName)), uintptr(utf80), uint32(len(playerName)))
|
|
|
|
}
|