978 lines
29 KiB
Go
978 lines
29 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_world
|
|
|
|
import (
|
|
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_common"
|
|
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_scoreboard"
|
|
"github.com/Pumpkin-MC/pumpkin-api-go/pkg/pumpkin_plugin_text"
|
|
witRuntime "go.bytecodealliance.org/pkg/wit/runtime"
|
|
witTypes "go.bytecodealliance.org/pkg/wit/types"
|
|
"runtime"
|
|
"unsafe"
|
|
)
|
|
|
|
type Position = witTypes.Tuple3[float64, float64, float64]
|
|
type EntityPose = pumpkin_plugin_common.EntityPose
|
|
type TextComponent = pumpkin_plugin_text.TextComponent
|
|
type Scoreboard = pumpkin_plugin_scoreboard.Scoreboard
|
|
|
|
const (
|
|
// Normal behavior; the block can be pushed and pulled.
|
|
PistonBehaviorNormal uint8 = 0
|
|
// The block is destroyed when pushed.
|
|
PistonBehaviorDestroy uint8 = 1
|
|
// The block cannot be pushed or pulled.
|
|
PistonBehaviorBlock uint8 = 2
|
|
// The block is ignored by pistons.
|
|
PistonBehaviorIgnore uint8 = 3
|
|
// The block can only be pushed, not pulled.
|
|
PistonBehaviorPushOnly uint8 = 4
|
|
)
|
|
|
|
// Defines how a block reacts when pushed by a piston.
|
|
type PistonBehavior = uint8
|
|
|
|
const (
|
|
SoundCategoryMaster uint8 = 0
|
|
SoundCategoryMusic uint8 = 1
|
|
SoundCategoryRecords uint8 = 2
|
|
SoundCategoryWeather uint8 = 3
|
|
SoundCategoryBlocks uint8 = 4
|
|
SoundCategoryHostile uint8 = 5
|
|
SoundCategoryNeutral uint8 = 6
|
|
SoundCategoryPlayers uint8 = 7
|
|
SoundCategoryAmbient uint8 = 8
|
|
SoundCategoryVoice uint8 = 9
|
|
)
|
|
|
|
// Categories for sounds to control their volume independently.
|
|
type SoundCategory = uint8
|
|
|
|
const (
|
|
// No interaction with blocks.
|
|
ExplosionInteractionNone uint8 = 0
|
|
// Blocks are destroyed and may drop loot.
|
|
ExplosionInteractionBlock uint8 = 1
|
|
// Interaction typical for mob-caused explosions.
|
|
ExplosionInteractionMob uint8 = 2
|
|
// Interaction typical for TNT explosions.
|
|
ExplosionInteractionTnt uint8 = 3
|
|
// Triggers specific block behaviors.
|
|
ExplosionInteractionTrigger uint8 = 4
|
|
)
|
|
|
|
// Defines how an explosion interacts with blocks in the world.
|
|
type ExplosionInteraction = uint8
|
|
|
|
const (
|
|
// Notifies neighbor blocks of the change.
|
|
BlockFlagsNotifyNeighbors uint8 = 1 << 0
|
|
// Notifies client listeners of the change.
|
|
BlockFlagsNotifyListeners uint8 = 1 << 1
|
|
// Forces the block state even if it's the same.
|
|
BlockFlagsForceState uint8 = 1 << 2
|
|
// Skips dropping items when the block is removed.
|
|
BlockFlagsSkipDrops uint8 = 1 << 3
|
|
// Indicates the block was moved (e.g., by a piston).
|
|
BlockFlagsMoved uint8 = 1 << 4
|
|
// Skips state replacement for redstone wires.
|
|
BlockFlagsSkipRedstoneWireStateReplacement uint8 = 1 << 5
|
|
// Skips the callback when a block entity is replaced.
|
|
BlockFlagsSkipBlockEntityReplacedCallback uint8 = 1 << 6
|
|
// Skips the callback when a block is added.
|
|
BlockFlagsSkipBlockAddedCallback uint8 = 1 << 7
|
|
)
|
|
|
|
// Flags used to control block updates and notifications.
|
|
type BlockFlags = uint8
|
|
|
|
// Detailed information about a block's state.
|
|
type BlockState struct {
|
|
// The internal numerical ID of the block state.
|
|
Id uint16
|
|
// The light level emitted by this block (0-15).
|
|
Luminance uint8
|
|
// How much light this block blocks.
|
|
Opacity uint8
|
|
// The hardness of the block, determining mining speed.
|
|
Hardness float32
|
|
// Whether this block is considered air.
|
|
IsAir bool
|
|
// Whether this block is a liquid.
|
|
IsLiquid bool
|
|
// Whether this block is a solid.
|
|
IsSolid bool
|
|
// Whether this block occupies a full cube.
|
|
IsFullCube bool
|
|
// How this block behaves when pushed by a piston.
|
|
PistonBehavior PistonBehavior
|
|
// Whether this block receives random ticks.
|
|
HasRandomTicks bool
|
|
}
|
|
|
|
// A simple wrapper for a block state ID.
|
|
type BlockStateId struct {
|
|
Id uint16
|
|
}
|
|
|
|
// A position in the world grid.
|
|
type BlockPos struct {
|
|
X int32
|
|
Y int32
|
|
Z int32
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [resource-drop]entity
|
|
func resourceDropEntity(handle int32)
|
|
|
|
type Entity struct {
|
|
handle *witRuntime.Handle
|
|
}
|
|
|
|
func (self *Entity) TakeHandle() int32 {
|
|
return self.handle.Take()
|
|
}
|
|
|
|
func (self *Entity) SetHandle(handle int32) {
|
|
self.handle.Set(handle)
|
|
}
|
|
|
|
func (self *Entity) Handle() int32 {
|
|
return self.handle.Use()
|
|
}
|
|
|
|
func (self *Entity) Drop() {
|
|
handle := self.handle.TakeOrNil()
|
|
if handle != 0 {
|
|
resourceDropEntity(handle)
|
|
}
|
|
}
|
|
|
|
func EntityFromOwnHandle(handleValue int32) *Entity {
|
|
handle := witRuntime.MakeHandle(handleValue)
|
|
value := &Entity{handle}
|
|
runtime.AddCleanup(value, func(_ int) {
|
|
handleValue := handle.TakeOrNil()
|
|
if handleValue != 0 {
|
|
resourceDropEntity(handleValue)
|
|
}
|
|
}, 0)
|
|
return value
|
|
}
|
|
|
|
func EntityFromBorrowHandle(handleValue int32) *Entity {
|
|
handle := witRuntime.MakeHandle(handleValue)
|
|
return &Entity{handle}
|
|
}
|
|
|
|
const (
|
|
BlockDirectionDown uint8 = 0
|
|
BlockDirectionUp uint8 = 1
|
|
BlockDirectionNorth uint8 = 2
|
|
BlockDirectionSouth uint8 = 3
|
|
BlockDirectionWest uint8 = 4
|
|
BlockDirectionEast uint8 = 5
|
|
)
|
|
|
|
// Represents a cardinal direction or block face.
|
|
type BlockDirection = uint8
|
|
|
|
// Result of a raycast operation.
|
|
type RaycastResult struct {
|
|
// The block position that was hit.
|
|
Pos BlockPos
|
|
// The face of the block that was hit.
|
|
Face BlockDirection
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [resource-drop]world
|
|
func resourceDropWorld(handle int32)
|
|
|
|
// Represents a Minecraft world (dimension).
|
|
type World struct {
|
|
handle *witRuntime.Handle
|
|
}
|
|
|
|
func (self *World) TakeHandle() int32 {
|
|
return self.handle.Take()
|
|
}
|
|
|
|
func (self *World) SetHandle(handle int32) {
|
|
self.handle.Set(handle)
|
|
}
|
|
|
|
func (self *World) Handle() int32 {
|
|
return self.handle.Use()
|
|
}
|
|
|
|
func (self *World) Drop() {
|
|
handle := self.handle.TakeOrNil()
|
|
if handle != 0 {
|
|
resourceDropWorld(handle)
|
|
}
|
|
}
|
|
|
|
func WorldFromOwnHandle(handleValue int32) *World {
|
|
handle := witRuntime.MakeHandle(handleValue)
|
|
value := &World{handle}
|
|
runtime.AddCleanup(value, func(_ int) {
|
|
handleValue := handle.TakeOrNil()
|
|
if handleValue != 0 {
|
|
resourceDropWorld(handleValue)
|
|
}
|
|
}, 0)
|
|
return value
|
|
}
|
|
|
|
func WorldFromBorrowHandle(handleValue int32) *World {
|
|
handle := witRuntime.MakeHandle(handleValue)
|
|
return &World{handle}
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-id
|
|
func wasm_import_method_entity_get_id(arg0 int32) int32
|
|
|
|
func (self *Entity) GetId() uint32 {
|
|
|
|
result := wasm_import_method_entity_get_id((self).Handle())
|
|
return uint32(result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-uuid
|
|
func wasm_import_method_entity_get_uuid(arg0 int32, arg1 uintptr)
|
|
|
|
func (self *Entity) GetUuid() string {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
|
|
wasm_import_method_entity_get_uuid((self).Handle(), returnArea)
|
|
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
|
|
result := value
|
|
return result
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-type
|
|
func wasm_import_method_entity_get_type(arg0 int32, arg1 uintptr)
|
|
|
|
func (self *Entity) GetType() string {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
|
|
wasm_import_method_entity_get_type((self).Handle(), returnArea)
|
|
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
|
|
result := value
|
|
return result
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-position
|
|
func wasm_import_method_entity_get_position(arg0 int32, arg1 uintptr)
|
|
|
|
func (self *Entity) GetPosition() witTypes.Tuple3[float64, float64, float64] {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
returnArea := uintptr(witRuntime.Allocate(pinner, 24, 8))
|
|
wasm_import_method_entity_get_position((self).Handle(), returnArea)
|
|
result := witTypes.Tuple3[float64, float64, float64]{*(*float64)(unsafe.Add(unsafe.Pointer(returnArea), 0)), *(*float64)(unsafe.Add(unsafe.Pointer(returnArea), 8)), *(*float64)(unsafe.Add(unsafe.Pointer(returnArea), 16))}
|
|
return result
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-world
|
|
func wasm_import_method_entity_get_world(arg0 int32) int32
|
|
|
|
func (self *Entity) GetWorld() *World {
|
|
|
|
result := wasm_import_method_entity_get_world((self).Handle())
|
|
return WorldFromOwnHandle(int32(uintptr(result)))
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-yaw
|
|
func wasm_import_method_entity_get_yaw(arg0 int32) float32
|
|
|
|
func (self *Entity) GetYaw() float32 {
|
|
|
|
result := wasm_import_method_entity_get_yaw((self).Handle())
|
|
return result
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-pitch
|
|
func wasm_import_method_entity_get_pitch(arg0 int32) float32
|
|
|
|
func (self *Entity) GetPitch() float32 {
|
|
|
|
result := wasm_import_method_entity_get_pitch((self).Handle())
|
|
return result
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-head-yaw
|
|
func wasm_import_method_entity_get_head_yaw(arg0 int32) float32
|
|
|
|
func (self *Entity) GetHeadYaw() float32 {
|
|
|
|
result := wasm_import_method_entity_get_head_yaw((self).Handle())
|
|
return result
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-on-ground
|
|
func wasm_import_method_entity_is_on_ground(arg0 int32) int32
|
|
|
|
func (self *Entity) IsOnGround() bool {
|
|
|
|
result := wasm_import_method_entity_is_on_ground((self).Handle())
|
|
return (result != 0)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-sneaking
|
|
func wasm_import_method_entity_is_sneaking(arg0 int32) int32
|
|
|
|
func (self *Entity) IsSneaking() bool {
|
|
|
|
result := wasm_import_method_entity_is_sneaking((self).Handle())
|
|
return (result != 0)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-sneaking
|
|
func wasm_import_method_entity_set_sneaking(arg0 int32, arg1 int32)
|
|
|
|
func (self *Entity) SetSneaking(sneaking bool) {
|
|
|
|
var result int32
|
|
if sneaking {
|
|
result = 1
|
|
} else {
|
|
result = 0
|
|
}
|
|
wasm_import_method_entity_set_sneaking((self).Handle(), result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-sprinting
|
|
func wasm_import_method_entity_is_sprinting(arg0 int32) int32
|
|
|
|
func (self *Entity) IsSprinting() bool {
|
|
|
|
result := wasm_import_method_entity_is_sprinting((self).Handle())
|
|
return (result != 0)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-sprinting
|
|
func wasm_import_method_entity_set_sprinting(arg0 int32, arg1 int32)
|
|
|
|
func (self *Entity) SetSprinting(sprinting bool) {
|
|
|
|
var result int32
|
|
if sprinting {
|
|
result = 1
|
|
} else {
|
|
result = 0
|
|
}
|
|
wasm_import_method_entity_set_sprinting((self).Handle(), result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-swimming
|
|
func wasm_import_method_entity_is_swimming(arg0 int32) int32
|
|
|
|
func (self *Entity) IsSwimming() bool {
|
|
|
|
result := wasm_import_method_entity_is_swimming((self).Handle())
|
|
return (result != 0)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-swimming
|
|
func wasm_import_method_entity_set_swimming(arg0 int32, arg1 int32)
|
|
|
|
func (self *Entity) SetSwimming(swimming bool) {
|
|
|
|
var result int32
|
|
if swimming {
|
|
result = 1
|
|
} else {
|
|
result = 0
|
|
}
|
|
wasm_import_method_entity_set_swimming((self).Handle(), result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-invisible
|
|
func wasm_import_method_entity_is_invisible(arg0 int32) int32
|
|
|
|
func (self *Entity) IsInvisible() bool {
|
|
|
|
result := wasm_import_method_entity_is_invisible((self).Handle())
|
|
return (result != 0)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-invisible
|
|
func wasm_import_method_entity_set_invisible(arg0 int32, arg1 int32)
|
|
|
|
func (self *Entity) SetInvisible(invisible bool) {
|
|
|
|
var result int32
|
|
if invisible {
|
|
result = 1
|
|
} else {
|
|
result = 0
|
|
}
|
|
wasm_import_method_entity_set_invisible((self).Handle(), result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-glowing
|
|
func wasm_import_method_entity_is_glowing(arg0 int32) int32
|
|
|
|
func (self *Entity) IsGlowing() bool {
|
|
|
|
result := wasm_import_method_entity_is_glowing((self).Handle())
|
|
return (result != 0)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-glowing
|
|
func wasm_import_method_entity_set_glowing(arg0 int32, arg1 int32)
|
|
|
|
func (self *Entity) SetGlowing(glowing bool) {
|
|
|
|
var result int32
|
|
if glowing {
|
|
result = 1
|
|
} else {
|
|
result = 0
|
|
}
|
|
wasm_import_method_entity_set_glowing((self).Handle(), result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-fall-flying
|
|
func wasm_import_method_entity_is_fall_flying(arg0 int32) int32
|
|
|
|
func (self *Entity) IsFallFlying() bool {
|
|
|
|
result := wasm_import_method_entity_is_fall_flying((self).Handle())
|
|
return (result != 0)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-fall-flying
|
|
func wasm_import_method_entity_set_fall_flying(arg0 int32, arg1 int32)
|
|
|
|
func (self *Entity) SetFallFlying(fallFlying bool) {
|
|
|
|
var result int32
|
|
if fallFlying {
|
|
result = 1
|
|
} else {
|
|
result = 0
|
|
}
|
|
wasm_import_method_entity_set_fall_flying((self).Handle(), result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-on-fire
|
|
func wasm_import_method_entity_is_on_fire(arg0 int32) int32
|
|
|
|
func (self *Entity) IsOnFire() bool {
|
|
|
|
result := wasm_import_method_entity_is_on_fire((self).Handle())
|
|
return (result != 0)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-on-fire
|
|
func wasm_import_method_entity_set_on_fire(arg0 int32, arg1 int32)
|
|
|
|
func (self *Entity) SetOnFire(onFire bool) {
|
|
|
|
var result int32
|
|
if onFire {
|
|
result = 1
|
|
} else {
|
|
result = 0
|
|
}
|
|
wasm_import_method_entity_set_on_fire((self).Handle(), result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.teleport
|
|
func wasm_import_method_entity_teleport(arg0 int32, arg1 float64, arg2 float64, arg3 float64, arg4 int32)
|
|
|
|
func (self *Entity) Teleport(pos witTypes.Tuple3[float64, float64, float64], worldRef *World) {
|
|
|
|
wasm_import_method_entity_teleport((self).Handle(), (pos).F0, (pos).F1, (pos).F2, (worldRef).TakeHandle())
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-velocity
|
|
func wasm_import_method_entity_set_velocity(arg0 int32, arg1 float64, arg2 float64, arg3 float64)
|
|
|
|
func (self *Entity) SetVelocity(velocity witTypes.Tuple3[float64, float64, float64]) {
|
|
|
|
wasm_import_method_entity_set_velocity((self).Handle(), (velocity).F0, (velocity).F1, (velocity).F2)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-velocity
|
|
func wasm_import_method_entity_get_velocity(arg0 int32, arg1 uintptr)
|
|
|
|
func (self *Entity) GetVelocity() witTypes.Tuple3[float64, float64, float64] {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
returnArea := uintptr(witRuntime.Allocate(pinner, 24, 8))
|
|
wasm_import_method_entity_get_velocity((self).Handle(), returnArea)
|
|
result := witTypes.Tuple3[float64, float64, float64]{*(*float64)(unsafe.Add(unsafe.Pointer(returnArea), 0)), *(*float64)(unsafe.Add(unsafe.Pointer(returnArea), 8)), *(*float64)(unsafe.Add(unsafe.Pointer(returnArea), 16))}
|
|
return result
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-pose
|
|
func wasm_import_method_entity_get_pose(arg0 int32) int32
|
|
|
|
func (self *Entity) GetPose() pumpkin_plugin_common.EntityPose {
|
|
|
|
result := wasm_import_method_entity_get_pose((self).Handle())
|
|
return uint8(result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-name
|
|
func wasm_import_method_entity_get_name(arg0 int32) int32
|
|
|
|
func (self *Entity) GetName() *pumpkin_plugin_text.TextComponent {
|
|
|
|
result := wasm_import_method_entity_get_name((self).Handle())
|
|
return pumpkin_plugin_text.TextComponentFromOwnHandle(int32(uintptr(result)))
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-custom-name
|
|
func wasm_import_method_entity_set_custom_name(arg0 int32, arg1 int32)
|
|
|
|
func (self *Entity) SetCustomName(name *pumpkin_plugin_text.TextComponent) {
|
|
|
|
wasm_import_method_entity_set_custom_name((self).Handle(), (name).TakeHandle())
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-custom-name
|
|
func wasm_import_method_entity_get_custom_name(arg0 int32, arg1 uintptr)
|
|
|
|
func (self *Entity) GetCustomName() witTypes.Option[*pumpkin_plugin_text.TextComponent] {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
returnArea := uintptr(witRuntime.Allocate(pinner, 8, 4))
|
|
wasm_import_method_entity_get_custom_name((self).Handle(), returnArea)
|
|
var option witTypes.Option[*pumpkin_plugin_text.TextComponent]
|
|
switch uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))) {
|
|
case 0:
|
|
|
|
option = witTypes.None[*pumpkin_plugin_text.TextComponent]()
|
|
case 1:
|
|
|
|
option = witTypes.Some[*pumpkin_plugin_text.TextComponent](pumpkin_plugin_text.TextComponentFromOwnHandle(int32(uintptr(*(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 4))))))
|
|
default:
|
|
panic("unreachable")
|
|
}
|
|
result := option
|
|
return result
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-custom-name-visible
|
|
func wasm_import_method_entity_set_custom_name_visible(arg0 int32, arg1 int32)
|
|
|
|
func (self *Entity) SetCustomNameVisible(visible bool) {
|
|
|
|
var result int32
|
|
if visible {
|
|
result = 1
|
|
} else {
|
|
result = 0
|
|
}
|
|
wasm_import_method_entity_set_custom_name_visible((self).Handle(), result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-custom-name-visible
|
|
func wasm_import_method_entity_is_custom_name_visible(arg0 int32) int32
|
|
|
|
func (self *Entity) IsCustomNameVisible() bool {
|
|
|
|
result := wasm_import_method_entity_is_custom_name_visible((self).Handle())
|
|
return (result != 0)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.is-invulnerable
|
|
func wasm_import_method_entity_is_invulnerable(arg0 int32) int32
|
|
|
|
func (self *Entity) IsInvulnerable() bool {
|
|
|
|
result := wasm_import_method_entity_is_invulnerable((self).Handle())
|
|
return (result != 0)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-invulnerable
|
|
func wasm_import_method_entity_set_invulnerable(arg0 int32, arg1 int32)
|
|
|
|
func (self *Entity) SetInvulnerable(invulnerable bool) {
|
|
|
|
var result int32
|
|
if invulnerable {
|
|
result = 1
|
|
} else {
|
|
result = 0
|
|
}
|
|
wasm_import_method_entity_set_invulnerable((self).Handle(), result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.get-fire-ticks
|
|
func wasm_import_method_entity_get_fire_ticks(arg0 int32) int32
|
|
|
|
func (self *Entity) GetFireTicks() int32 {
|
|
|
|
result := wasm_import_method_entity_get_fire_ticks((self).Handle())
|
|
return result
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.set-fire-ticks
|
|
func wasm_import_method_entity_set_fire_ticks(arg0 int32, arg1 int32)
|
|
|
|
func (self *Entity) SetFireTicks(ticks int32) {
|
|
|
|
wasm_import_method_entity_set_fire_ticks((self).Handle(), ticks)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.remove
|
|
func wasm_import_method_entity_remove(arg0 int32)
|
|
|
|
func (self *Entity) Remove() {
|
|
|
|
wasm_import_method_entity_remove((self).Handle())
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]entity.raycast
|
|
func wasm_import_method_entity_raycast(arg0 int32, arg1 float64, arg2 int32, arg3 uintptr)
|
|
|
|
func (self *Entity) Raycast(maxDistance float64, fluidHandling bool) witTypes.Option[RaycastResult] {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
returnArea := uintptr(witRuntime.Allocate(pinner, 20, 4))
|
|
var result int32
|
|
if fluidHandling {
|
|
result = 1
|
|
} else {
|
|
result = 0
|
|
}
|
|
wasm_import_method_entity_raycast((self).Handle(), maxDistance, result, returnArea)
|
|
var option witTypes.Option[RaycastResult]
|
|
switch uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))) {
|
|
case 0:
|
|
|
|
option = witTypes.None[RaycastResult]()
|
|
case 1:
|
|
|
|
option = witTypes.Some[RaycastResult](RaycastResult{BlockPos{*(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 4)), *(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 8)), *(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 12))}, uint8(uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 16))))})
|
|
default:
|
|
panic("unreachable")
|
|
}
|
|
result0 := option
|
|
return result0
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-id
|
|
func wasm_import_method_world_get_id(arg0 int32, arg1 uintptr)
|
|
|
|
func (self *World) GetId() string {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
|
|
wasm_import_method_world_get_id((self).Handle(), returnArea)
|
|
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
|
|
result := value
|
|
return result
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-block-state-id
|
|
func wasm_import_method_world_get_block_state_id(arg0 int32, arg1 int32, arg2 int32, arg3 int32) int32
|
|
|
|
func (self *World) GetBlockStateId(pos BlockPos) uint16 {
|
|
|
|
result := wasm_import_method_world_get_block_state_id((self).Handle(), (pos).X, (pos).Y, (pos).Z)
|
|
return uint16(result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-block-state
|
|
func wasm_import_method_world_get_block_state(arg0 int32, arg1 int32, arg2 int32, arg3 int32, arg4 uintptr)
|
|
|
|
func (self *World) GetBlockState(pos BlockPos) BlockState {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
returnArea := uintptr(witRuntime.Allocate(pinner, 16, 4))
|
|
wasm_import_method_world_get_block_state((self).Handle(), (pos).X, (pos).Y, (pos).Z, returnArea)
|
|
result := BlockState{uint16(uint16(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0)))), uint8(uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 2)))), uint8(uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 3)))), *(*float32)(unsafe.Add(unsafe.Pointer(returnArea), 4)), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 8))) != 0), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 9))) != 0), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 10))) != 0), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 11))) != 0), uint8(uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 12)))), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 13))) != 0)}
|
|
return result
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.set-block-state
|
|
func wasm_import_method_world_set_block_state(arg0 int32, arg1 int32, arg2 int32, arg3 int32, arg4 int32, arg5 int32)
|
|
|
|
func (self *World) SetBlockState(pos BlockPos, state uint16, updateFlags BlockFlags) {
|
|
|
|
wasm_import_method_world_set_block_state((self).Handle(), (pos).X, (pos).Y, (pos).Z, int32(state), int32(updateFlags))
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-time-of-day
|
|
func wasm_import_method_world_get_time_of_day(arg0 int32) int64
|
|
|
|
func (self *World) GetTimeOfDay() uint64 {
|
|
|
|
result := wasm_import_method_world_get_time_of_day((self).Handle())
|
|
return uint64(result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.set-time-of-day
|
|
func wasm_import_method_world_set_time_of_day(arg0 int32, arg1 int64)
|
|
|
|
func (self *World) SetTimeOfDay(time uint64) {
|
|
|
|
wasm_import_method_world_set_time_of_day((self).Handle(), int64(time))
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-world-age
|
|
func wasm_import_method_world_get_world_age(arg0 int32) int64
|
|
|
|
func (self *World) GetWorldAge() uint64 {
|
|
|
|
result := wasm_import_method_world_get_world_age((self).Handle())
|
|
return uint64(result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-dimension
|
|
func wasm_import_method_world_get_dimension(arg0 int32, arg1 uintptr)
|
|
|
|
func (self *World) GetDimension() string {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
|
|
wasm_import_method_world_get_dimension((self).Handle(), returnArea)
|
|
value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
|
|
result := value
|
|
return result
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-top-block-y
|
|
func wasm_import_method_world_get_top_block_y(arg0 int32, arg1 int32, arg2 int32) int32
|
|
|
|
func (self *World) GetTopBlockY(x int32, z int32) int32 {
|
|
|
|
result := wasm_import_method_world_get_top_block_y((self).Handle(), x, z)
|
|
return result
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-motion-blocking-height
|
|
func wasm_import_method_world_get_motion_blocking_height(arg0 int32, arg1 int32, arg2 int32) int32
|
|
|
|
func (self *World) GetMotionBlockingHeight(x int32, z int32) int32 {
|
|
|
|
result := wasm_import_method_world_get_motion_blocking_height((self).Handle(), x, z)
|
|
return result
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.is-raining
|
|
func wasm_import_method_world_is_raining(arg0 int32) int32
|
|
|
|
func (self *World) IsRaining() bool {
|
|
|
|
result := wasm_import_method_world_is_raining((self).Handle())
|
|
return (result != 0)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.set-raining
|
|
func wasm_import_method_world_set_raining(arg0 int32, arg1 int32)
|
|
|
|
func (self *World) SetRaining(raining bool) {
|
|
|
|
var result int32
|
|
if raining {
|
|
result = 1
|
|
} else {
|
|
result = 0
|
|
}
|
|
wasm_import_method_world_set_raining((self).Handle(), result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.is-thundering
|
|
func wasm_import_method_world_is_thundering(arg0 int32) int32
|
|
|
|
func (self *World) IsThundering() bool {
|
|
|
|
result := wasm_import_method_world_is_thundering((self).Handle())
|
|
return (result != 0)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.set-thundering
|
|
func wasm_import_method_world_set_thundering(arg0 int32, arg1 int32)
|
|
|
|
func (self *World) SetThundering(thundering bool) {
|
|
|
|
var result int32
|
|
if thundering {
|
|
result = 1
|
|
} else {
|
|
result = 0
|
|
}
|
|
wasm_import_method_world_set_thundering((self).Handle(), result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.broadcast-system-message
|
|
func wasm_import_method_world_broadcast_system_message(arg0 int32, arg1 int32, arg2 int32)
|
|
|
|
func (self *World) BroadcastSystemMessage(message *pumpkin_plugin_text.TextComponent, overlay bool) {
|
|
|
|
var result int32
|
|
if overlay {
|
|
result = 1
|
|
} else {
|
|
result = 0
|
|
}
|
|
wasm_import_method_world_broadcast_system_message((self).Handle(), (message).TakeHandle(), result)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-scoreboard
|
|
func wasm_import_method_world_get_scoreboard(arg0 int32) int32
|
|
|
|
func (self *World) GetScoreboard() *pumpkin_plugin_scoreboard.Scoreboard {
|
|
|
|
result := wasm_import_method_world_get_scoreboard((self).Handle())
|
|
return pumpkin_plugin_scoreboard.ScoreboardFromOwnHandle(int32(uintptr(result)))
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.play-sound
|
|
func wasm_import_method_world_play_sound(arg0 int32, arg1 uintptr, arg2 uint32, arg3 int32, arg4 float64, arg5 float64, arg6 float64, arg7 float32, arg8 float32)
|
|
|
|
func (self *World) PlaySound(sound string, category SoundCategory, pos witTypes.Tuple3[float64, float64, float64], volume float32, pitch float32) {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
utf8 := unsafe.Pointer(unsafe.StringData(sound))
|
|
pinner.Pin(utf8)
|
|
wasm_import_method_world_play_sound((self).Handle(), uintptr(utf8), uint32(len(sound)), int32(category), (pos).F0, (pos).F1, (pos).F2, volume, pitch)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.spawn-particle
|
|
func wasm_import_method_world_spawn_particle(arg0 int32, arg1 uintptr, arg2 uint32, arg3 float64, arg4 float64, arg5 float64, arg6 float64, arg7 float64, arg8 float64, arg9 float32, arg10 int32)
|
|
|
|
func (self *World) SpawnParticle(particle string, pos witTypes.Tuple3[float64, float64, float64], offset witTypes.Tuple3[float64, float64, float64], maxSpeed float32, count int32) {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
utf8 := unsafe.Pointer(unsafe.StringData(particle))
|
|
pinner.Pin(utf8)
|
|
wasm_import_method_world_spawn_particle((self).Handle(), uintptr(utf8), uint32(len(particle)), (pos).F0, (pos).F1, (pos).F2, (offset).F0, (offset).F1, (offset).F2, maxSpeed, count)
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.create-explosion
|
|
func wasm_import_method_world_create_explosion(arg0 int32, arg1 float64, arg2 float64, arg3 float64, arg4 float32, arg5 int32, arg6 int32)
|
|
|
|
func (self *World) CreateExplosion(pos witTypes.Tuple3[float64, float64, float64], power float32, createFire bool, interaction ExplosionInteraction) {
|
|
|
|
var result int32
|
|
if createFire {
|
|
result = 1
|
|
} else {
|
|
result = 0
|
|
}
|
|
wasm_import_method_world_create_explosion((self).Handle(), (pos).F0, (pos).F1, (pos).F2, power, result, int32(interaction))
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-sea-level
|
|
func wasm_import_method_world_get_sea_level(arg0 int32) int32
|
|
|
|
func (self *World) GetSeaLevel() int32 {
|
|
|
|
result := wasm_import_method_world_get_sea_level((self).Handle())
|
|
return result
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-min-y
|
|
func wasm_import_method_world_get_min_y(arg0 int32) int32
|
|
|
|
func (self *World) GetMinY() int32 {
|
|
|
|
result := wasm_import_method_world_get_min_y((self).Handle())
|
|
return result
|
|
|
|
}
|
|
|
|
//go:wasmimport pumpkin:plugin/world@0.1.0 [method]world.get-entities
|
|
func wasm_import_method_world_get_entities(arg0 int32, arg1 uintptr)
|
|
|
|
func (self *World) GetEntities() []*Entity {
|
|
pinner := &runtime.Pinner{}
|
|
defer pinner.Unpin()
|
|
|
|
returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4))
|
|
wasm_import_method_world_get_entities((self).Handle(), returnArea)
|
|
result := make([]*Entity, 0, *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)))
|
|
for index := 0; index < int(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4))); index++ {
|
|
base := unsafe.Add(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0)))), index*4)
|
|
|
|
result = append(result, EntityFromOwnHandle(int32(uintptr(*(*int32)(unsafe.Add(unsafe.Pointer(base), 0))))))
|
|
}
|
|
|
|
result0 := result
|
|
return result0
|
|
|
|
}
|