// 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_block_entity import ( witRuntime "go.bytecodealliance.org/pkg/wit/runtime" witTypes "go.bytecodealliance.org/pkg/wit/types" "runtime" "unsafe" ) type BlockPosition = witTypes.Tuple3[int32, int32, int32] //go:wasmimport pumpkin:plugin/block-entity@0.1.0 [resource-drop]block-entity func resourceDropBlockEntity(handle int32) type BlockEntity struct { handle *witRuntime.Handle } func (self *BlockEntity) TakeHandle() int32 { return self.handle.Take() } func (self *BlockEntity) SetHandle(handle int32) { self.handle.Set(handle) } func (self *BlockEntity) Handle() int32 { return self.handle.Use() } func (self *BlockEntity) Drop() { handle := self.handle.TakeOrNil() if handle != 0 { resourceDropBlockEntity(handle) } } func BlockEntityFromOwnHandle(handleValue int32) *BlockEntity { handle := witRuntime.MakeHandle(handleValue) value := &BlockEntity{handle} runtime.AddCleanup(value, func(_ int) { handleValue := handle.TakeOrNil() if handleValue != 0 { resourceDropBlockEntity(handleValue) } }, 0) return value } func BlockEntityFromBorrowHandle(handleValue int32) *BlockEntity { handle := witRuntime.MakeHandle(handleValue) return &BlockEntity{handle} } //go:wasmimport pumpkin:plugin/block-entity@0.1.0 [resource-drop]command-block-entity func resourceDropCommandBlockEntity(handle int32) type CommandBlockEntity struct { handle *witRuntime.Handle } func (self *CommandBlockEntity) TakeHandle() int32 { return self.handle.Take() } func (self *CommandBlockEntity) SetHandle(handle int32) { self.handle.Set(handle) } func (self *CommandBlockEntity) Handle() int32 { return self.handle.Use() } func (self *CommandBlockEntity) Drop() { handle := self.handle.TakeOrNil() if handle != 0 { resourceDropCommandBlockEntity(handle) } } func CommandBlockEntityFromOwnHandle(handleValue int32) *CommandBlockEntity { handle := witRuntime.MakeHandle(handleValue) value := &CommandBlockEntity{handle} runtime.AddCleanup(value, func(_ int) { handleValue := handle.TakeOrNil() if handleValue != 0 { resourceDropCommandBlockEntity(handleValue) } }, 0) return value } func CommandBlockEntityFromBorrowHandle(handleValue int32) *CommandBlockEntity { handle := witRuntime.MakeHandle(handleValue) return &CommandBlockEntity{handle} } const ( BlockEntityTypeCommandBlockEntity uint8 = 0 ) type BlockEntityType struct { tag uint8 value any } func (self BlockEntityType) Tag() uint8 { return self.tag } func (self BlockEntityType) CommandBlockEntity() *CommandBlockEntity { if self.tag != BlockEntityTypeCommandBlockEntity { panic("tag mismatch") } return self.value.(*CommandBlockEntity) } func MakeBlockEntityTypeCommandBlockEntity(value *CommandBlockEntity) BlockEntityType { return BlockEntityType{BlockEntityTypeCommandBlockEntity, value} } //go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]block-entity.resource-location func wasm_import_method_block_entity_resource_location(arg0 int32, arg1 uintptr) func (self *BlockEntity) ResourceLocation() string { pinner := &runtime.Pinner{} defer pinner.Unpin() returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4)) wasm_import_method_block_entity_resource_location((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/block-entity@0.1.0 [method]block-entity.get-position func wasm_import_method_block_entity_get_position(arg0 int32, arg1 uintptr) func (self *BlockEntity) GetPosition() witTypes.Tuple3[int32, int32, int32] { pinner := &runtime.Pinner{} defer pinner.Unpin() returnArea := uintptr(witRuntime.Allocate(pinner, 12, 4)) wasm_import_method_block_entity_get_position((self).Handle(), returnArea) result := witTypes.Tuple3[int32, int32, int32]{*(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 0)), *(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 4)), *(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 8))} return result } //go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]block-entity.get-id func wasm_import_method_block_entity_get_id(arg0 int32) int32 func (self *BlockEntity) GetId() uint32 { result := wasm_import_method_block_entity_get_id((self).Handle()) return uint32(result) } //go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]block-entity.is-dirty func wasm_import_method_block_entity_is_dirty(arg0 int32) int32 func (self *BlockEntity) IsDirty() bool { result := wasm_import_method_block_entity_is_dirty((self).Handle()) return (result != 0) } //go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]block-entity.clear-dirty func wasm_import_method_block_entity_clear_dirty(arg0 int32) func (self *BlockEntity) ClearDirty() { wasm_import_method_block_entity_clear_dirty((self).Handle()) } //go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]command-block-entity.get-block-entity func wasm_import_method_command_block_entity_get_block_entity(arg0 int32) int32 func (self *CommandBlockEntity) GetBlockEntity() *BlockEntity { result := wasm_import_method_command_block_entity_get_block_entity((self).Handle()) return BlockEntityFromOwnHandle(int32(uintptr(result))) } //go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]command-block-entity.last-output func wasm_import_method_command_block_entity_last_output(arg0 int32, arg1 uintptr) func (self *CommandBlockEntity) LastOutput() string { pinner := &runtime.Pinner{} defer pinner.Unpin() returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4)) wasm_import_method_command_block_entity_last_output((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/block-entity@0.1.0 [method]command-block-entity.track-output func wasm_import_method_command_block_entity_track_output(arg0 int32) int32 func (self *CommandBlockEntity) TrackOutput() bool { result := wasm_import_method_command_block_entity_track_output((self).Handle()) return (result != 0) } //go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]command-block-entity.success-count func wasm_import_method_command_block_entity_success_count(arg0 int32) int32 func (self *CommandBlockEntity) SuccessCount() uint32 { result := wasm_import_method_command_block_entity_success_count((self).Handle()) return uint32(result) } //go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]command-block-entity.command func wasm_import_method_command_block_entity_command(arg0 int32, arg1 uintptr) func (self *CommandBlockEntity) Command() string { pinner := &runtime.Pinner{} defer pinner.Unpin() returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4)) wasm_import_method_command_block_entity_command((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/block-entity@0.1.0 [method]command-block-entity.auto func wasm_import_method_command_block_entity_auto(arg0 int32) int32 func (self *CommandBlockEntity) Auto() bool { result := wasm_import_method_command_block_entity_auto((self).Handle()) return (result != 0) } //go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]command-block-entity.condition-met func wasm_import_method_command_block_entity_condition_met(arg0 int32) int32 func (self *CommandBlockEntity) ConditionMet() bool { result := wasm_import_method_command_block_entity_condition_met((self).Handle()) return (result != 0) } //go:wasmimport pumpkin:plugin/block-entity@0.1.0 [method]command-block-entity.powered func wasm_import_method_command_block_entity_powered(arg0 int32) int32 func (self *CommandBlockEntity) Powered() bool { result := wasm_import_method_command_block_entity_powered((self).Handle()) return (result != 0) }