// Generated by `wit-bindgen` 0.57.1. DO NOT EDIT!
//
#nullable enable
using System;
using System.Runtime.InteropServices;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
namespace PluginWorld {
public interface IPluginWorldImports{
}
public interface IPluginWorldExports{
static abstract void InitPlugin();
static abstract void OnLoad(global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IContextImports.Context context);
static abstract void OnUnload(global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IContextImports.Context context);
static abstract global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event HandleEvent(uint eventId, global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IServerImports.Server server, global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event @event);
static abstract int HandleCommand(uint commandId, global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ICommandImports.CommandSender sender, global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IServerImports.Server server, global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ICommandImports.ConsumedArgs args);
static abstract void HandleTask(uint handlerId, global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IServerImports.Server server);
}
public readonly struct None {}
[global::System.Runtime.InteropServices.StructLayoutAttribute(global::System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly struct Result
{
public readonly byte Tag;
private readonly object value;
private Result(byte tag, object value)
{
Tag = tag;
this.value = value;
}
public static Result Ok(TOk ok)
{
return new Result(Tags.Ok, ok!);
}
public static Result Err(TErr err)
{
return new Result(Tags.Err, err!);
}
public bool IsOk => Tag == Tags.Ok;
public bool IsErr => Tag == Tags.Err;
public TOk AsOk
{
get
{
if (Tag == Tags.Ok)
{
return (TOk)value;
}
throw new global::System.ArgumentException("expected k, got " + Tag);
}
}
public TErr AsErr
{
get
{
if (Tag == Tags.Err)
{
return (TErr)value;
}
throw new global::System.ArgumentException("expected Err, got " + Tag);
}
}
public class Tags
{
public const byte Ok = 0;
public const byte Err = 1;
}
}
public class Option {
private static Option none = new ();
private Option()
{
HasValue = false;
}
public Option(T v)
{
HasValue = true;
Value = v;
}
public static Option None => none;
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute(true, nameof(Value))]
public bool HasValue { get; }
public T? Value { get; }
}
public class WitException: global::System.Exception {
public object Value { get; }
public uint NestingLevel { get; }
public WitException(object v, uint level)
{
Value = v;
NestingLevel = level;
}
}
public class WitException: WitException {
public T TypedValue { get { return (T)this.Value;} }
public WitException(T v, uint level) : base(v!, level)
{
}
}
public static class InteropReturnArea
{
[global::System.Runtime.CompilerServices.InlineArrayAttribute(9)]
[global::System.Runtime.InteropServices.StructLayoutAttribute(global::System.Runtime.InteropServices.LayoutKind.Sequential, Pack = 8)]
internal struct ReturnArea
{
private ulong buffer;
internal unsafe nint AddressOfReturnArea()
{
return (nint)global::System.Runtime.CompilerServices.Unsafe.AsPointer(ref buffer);
}
}
[global::System.ThreadStaticAttribute]
[global::System.Runtime.CompilerServices.FixedAddressValueTypeAttribute]
internal static ReturnArea returnArea = default;
}
public static class MemoryHelper
{
public static unsafe void* AlignStackPtr(void* stackAddress, uint alignment)
{
return (void*)(((nint)stackAddress) + ((int)alignment - 1) & -(int)alignment);
}
}
namespace Imports {
public partial class PluginWorldImportsInterop : IPluginWorldImports
{}
}
namespace Exports {
public static class PluginWorldInterop
{
[global::System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute(EntryPoint = "init-plugin")]
public static unsafe void wasmExportInitPlugin() {
PluginWorldExportsImpl.InitPlugin();
}
[global::System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute(EntryPoint = "on-load")]
public static unsafe nint wasmExportOnLoad(int p0) {
var resource = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IContextImports.Context(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IContextImports.Context.THandle(p0));
Result ret;
try
{
PluginWorldExportsImpl.OnLoad((resource));
ret = Result.Ok(new None());
}
catch (WitException e)
{
switch (e.NestingLevel)
{
case 0:
{
ret = Result.Err((string) e.Value);
break;
}
default: throw new global::System.ArgumentException($"invalid nesting level: {e.NestingLevel}");
}
}
var ptr = InteropReturnArea.returnArea.AddressOfReturnArea();
switch (ret.Tag) {
case 0: {
*(byte*)(ptr + 0) = (byte)0;
break;
}
case 1: {
string payload2 = ret.AsErr;
*(byte*)(ptr + 0) = (byte)1;
var stringSpan = global::System.MemoryExtensions.AsSpan(payload2);
var length = global::System.Text.Encoding.UTF8.GetByteCount(stringSpan);
var strPtr = global::System.Runtime.InteropServices.NativeMemory.Alloc((nuint)length);
global::System.Text.Encoding.UTF8.GetBytes(stringSpan, new global::System.Span(strPtr, length));
new global::System.Span((void*)((byte*)ptr + 8), 1)[0] = length;
new global::System.Span((void*)((byte*)ptr + 4), 1)[0] = (nint)(int)strPtr;
break;
}
default: throw new global::System.ArgumentException("invalid discriminant: " + ret);
}
return ptr;
}
[global::System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute(EntryPoint = "cabi_post_on-load")]
public static unsafe void cabi_post_wasmExportOnLoad(nint p0) {
switch (new global::System.Span((byte*)p0 + 0, 1)[0]) {
case 0: {
break;
}
case 1: {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 4), 1)[0]);
break;
}
}
}
[global::System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute(EntryPoint = "on-unload")]
public static unsafe nint wasmExportOnUnload(int p0) {
var resource = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IContextImports.Context(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IContextImports.Context.THandle(p0));
Result ret;
try
{
PluginWorldExportsImpl.OnUnload((resource));
ret = Result.Ok(new None());
}
catch (WitException e)
{
switch (e.NestingLevel)
{
case 0:
{
ret = Result.Err((string) e.Value);
break;
}
default: throw new global::System.ArgumentException($"invalid nesting level: {e.NestingLevel}");
}
}
var ptr = InteropReturnArea.returnArea.AddressOfReturnArea();
switch (ret.Tag) {
case 0: {
*(byte*)(ptr + 0) = (byte)0;
break;
}
case 1: {
string payload2 = ret.AsErr;
*(byte*)(ptr + 0) = (byte)1;
var stringSpan = global::System.MemoryExtensions.AsSpan(payload2);
var length = global::System.Text.Encoding.UTF8.GetByteCount(stringSpan);
var strPtr = global::System.Runtime.InteropServices.NativeMemory.Alloc((nuint)length);
global::System.Text.Encoding.UTF8.GetBytes(stringSpan, new global::System.Span(strPtr, length));
new global::System.Span((void*)((byte*)ptr + 8), 1)[0] = length;
new global::System.Span((void*)((byte*)ptr + 4), 1)[0] = (nint)(int)strPtr;
break;
}
default: throw new global::System.ArgumentException("invalid discriminant: " + ret);
}
return ptr;
}
[global::System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute(EntryPoint = "cabi_post_on-unload")]
public static unsafe void cabi_post_wasmExportOnUnload(nint p0) {
switch (new global::System.Span((byte*)p0 + 0, 1)[0]) {
case 0: {
break;
}
case 1: {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 4), 1)[0]);
break;
}
}
}
[global::System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute(EntryPoint = "handle-event")]
public static unsafe nint wasmExportHandleEvent(nint p0) {
var resource = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IServerImports.Server(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IServerImports.Server.THandle(new global::System.Span((void*)((byte*)p0 + 4), 1)[0]));
global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event lifted159;
switch (new global::System.Span((byte*)p0 + 8, 1)[0]) {
case 0: {
var resource0 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
var resource1 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ITextImports.TextComponent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ITextImports.TextComponent.THandle(new global::System.Span((void*)((byte*)p0 + 20), 1)[0]));
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerJoinEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerJoinEventData (
resource0, resource1, (new global::System.Span((byte*)p0 + 24, 1)[0] != 0)));
break;
}
case 1: {
var resource4 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
var resource5 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ITextImports.TextComponent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ITextImports.TextComponent.THandle(new global::System.Span((void*)((byte*)p0 + 20), 1)[0]));
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerLeaveEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerLeaveEventData (
resource4, resource5, (new global::System.Span((byte*)p0 + 24, 1)[0] != 0)));
break;
}
case 2: {
var resource8 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
var resource9 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ITextImports.TextComponent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ITextImports.TextComponent.THandle(new global::System.Span((void*)((byte*)p0 + 20), 1)[0]));
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerLoginEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerLoginEventData (
resource8, resource9, (new global::System.Span((byte*)p0 + 24, 1)[0] != 0)));
break;
}
case 3: {
var resource12 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
var str = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 20), 1)[0], new global::System.Span((void*)((byte*)p0 + 24), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 24), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 20), 1)[0]);
}
var array = new global::System.Collections.Generic.List(new global::System.Span((void*)((byte*)p0 + 32), 1)[0]);
for (int index = 0; index < new global::System.Span((void*)((byte*)p0 + 32), 1)[0]; ++index) {
nint basePtr14 = new global::System.Span((void*)((byte*)p0 + 28), 1)[0] + (index * 4);
var resource15 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)basePtr14 + 0), 1)[0]));
array.Add(resource15);
}
if (new global::System.Span((void*)((byte*)p0 + 32), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 28), 1)[0]);
}
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerChatEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerChatEventData (
resource12, str, array, (new global::System.Span((byte*)p0 + 36, 1)[0] != 0)));
break;
}
case 4: {
var resource18 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
var str19 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 20), 1)[0], new global::System.Span((void*)((byte*)p0 + 24), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 24), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 20), 1)[0]);
}
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerCommandSendEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerCommandSendEventData (
resource18, str19, (new global::System.Span((byte*)p0 + 28, 1)[0] != 0)));
break;
}
case 5: {
var resource22 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
var str23 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 20), 1)[0], new global::System.Span((void*)((byte*)p0 + 24), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 24), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 20), 1)[0]);
}
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerPermissionCheckEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerPermissionCheckEventData (
resource22, str23, (new global::System.Span((byte*)p0 + 28, 1)[0] != 0)));
break;
}
case 6: {
var resource26 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerMoveEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerMoveEventData (
resource26, (new global::System.Span((void*)((byte*)p0 + 24), 1)[0], new global::System.Span((void*)((byte*)p0 + 32), 1)[0], new global::System.Span((void*)((byte*)p0 + 40), 1)[0]), (new global::System.Span((void*)((byte*)p0 + 48), 1)[0], new global::System.Span((void*)((byte*)p0 + 56), 1)[0], new global::System.Span((void*)((byte*)p0 + 64), 1)[0]), (new global::System.Span((byte*)p0 + 72, 1)[0] != 0)));
break;
}
case 7: {
var resource29 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerTeleportEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerTeleportEventData (
resource29, (new global::System.Span((void*)((byte*)p0 + 24), 1)[0], new global::System.Span((void*)((byte*)p0 + 32), 1)[0], new global::System.Span((void*)((byte*)p0 + 40), 1)[0]), (new global::System.Span((void*)((byte*)p0 + 48), 1)[0], new global::System.Span((void*)((byte*)p0 + 56), 1)[0], new global::System.Span((void*)((byte*)p0 + 64), 1)[0]), (new global::System.Span((byte*)p0 + 72, 1)[0] != 0)));
break;
}
case 8: {
var resource32 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
var resource33 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IWorldImports.World(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IWorldImports.World.THandle(new global::System.Span((void*)((byte*)p0 + 20), 1)[0]));
var resource34 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IWorldImports.World(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IWorldImports.World.THandle(new global::System.Span((void*)((byte*)p0 + 24), 1)[0]));
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerChangeWorldEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerChangeWorldEventData (
resource32, resource33, resource34, (new global::System.Span((void*)((byte*)p0 + 32), 1)[0], new global::System.Span((void*)((byte*)p0 + 40), 1)[0], new global::System.Span((void*)((byte*)p0 + 48), 1)[0]), new global::System.Span((void*)((byte*)p0 + 56), 1)[0], new global::System.Span((void*)((byte*)p0 + 60), 1)[0], (new global::System.Span((byte*)p0 + 64, 1)[0] != 0)));
break;
}
case 9: {
var resource37 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerExpChangeEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerExpChangeEventData (
resource37, new global::System.Span((void*)((byte*)p0 + 20), 1)[0]));
break;
}
case 10: {
var resource40 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerItemHeldEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerItemHeldEventData (
resource40, ((byte)new global::System.Span((byte*)p0 + 20, 1)[0]), ((byte)new global::System.Span((byte*)p0 + 21, 1)[0]), (new global::System.Span((byte*)p0 + 22, 1)[0] != 0)));
break;
}
case 11: {
var resource43 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerChangedMainHandEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerChangedMainHandEventData (
resource43, (global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ICommonImports.Hand)new global::System.Span((byte*)p0 + 20, 1)[0]));
break;
}
case 12: {
var resource46 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerGamemodeChangeEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerGamemodeChangeEventData (
resource46, (global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ICommonImports.GameMode)new global::System.Span((byte*)p0 + 20, 1)[0], (global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ICommonImports.GameMode)new global::System.Span((byte*)p0 + 21, 1)[0], (new global::System.Span((byte*)p0 + 22, 1)[0] != 0)));
break;
}
case 13: {
var resource49 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
var str50 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 20), 1)[0], new global::System.Span((void*)((byte*)p0 + 24), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 24), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 20), 1)[0]);
}
var array51 = new byte[new global::System.Span((void*)((byte*)p0 + 32), 1)[0]];
new global::System.Span((void*)(new global::System.Span((void*)((byte*)p0 + 28), 1)[0]), new global::System.Span((void*)((byte*)p0 + 32), 1)[0]).CopyTo(new global::System.Span(array51));
if (new global::System.Span((void*)((byte*)p0 + 32), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 28), 1)[0]);
}
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerCustomPayloadEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerCustomPayloadEventData (
resource49, str50, array51));
break;
}
case 14: {
var resource54 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
string? lifted;
switch (new global::System.Span((byte*)p0 + 20, 1)[0]) {
case 0: {
lifted = null;
break;
}
case 1: {
var str59 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 24), 1)[0], new global::System.Span((void*)((byte*)p0 + 28), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 28), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 24), 1)[0]);
}
lifted = str59;
break;
}
default: throw new global::System.ArgumentException("invalid discriminant: " + (new global::System.Span((byte*)p0 + 20, 1)[0]));
}
var str60 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 32), 1)[0], new global::System.Span((void*)((byte*)p0 + 36), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 36), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 32), 1)[0]);
}
var str61 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 40), 1)[0], new global::System.Span((void*)((byte*)p0 + 44), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 44), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 40), 1)[0]);
}
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerFishEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerFishEventData (
resource54, lifted, str60, str61, (global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerFishState)new global::System.Span((byte*)p0 + 48, 1)[0], (global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ICommonImports.Hand)new global::System.Span((byte*)p0 + 49, 1)[0], new global::System.Span((void*)((byte*)p0 + 52), 1)[0], (new global::System.Span((byte*)p0 + 56, 1)[0] != 0)));
break;
}
case 15: {
var resource64 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
var str65 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 20), 1)[0], new global::System.Span((void*)((byte*)p0 + 24), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 24), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 20), 1)[0]);
}
var str66 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 32), 1)[0], new global::System.Span((void*)((byte*)p0 + 36), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 36), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 32), 1)[0]);
}
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerEggThrowEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerEggThrowEventData (
resource64, str65, (new global::System.Span((byte*)p0 + 28, 1)[0] != 0), ((byte)new global::System.Span((byte*)p0 + 29, 1)[0]), str66, (new global::System.Span((byte*)p0 + 40, 1)[0] != 0)));
break;
}
case 16: {
var resource69 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerInteractUnknownEntityEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerInteractUnknownEntityEventData (
resource69, new global::System.Span((void*)((byte*)p0 + 20), 1)[0], (global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.EntityInteractionAction)new global::System.Span((byte*)p0 + 24, 1)[0], (new global::System.Span((byte*)p0 + 25, 1)[0] != 0)));
break;
}
case 17: {
var resource72 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
(int, int, int)? lifted77;
switch (new global::System.Span((byte*)p0 + 24, 1)[0]) {
case 0: {
lifted77 = null;
break;
}
case 1: {
lifted77 = (new global::System.Span((void*)((byte*)p0 + 28), 1)[0], new global::System.Span((void*)((byte*)p0 + 32), 1)[0], new global::System.Span((void*)((byte*)p0 + 36), 1)[0]);
break;
}
default: throw new global::System.ArgumentException("invalid discriminant: " + (new global::System.Span((byte*)p0 + 24, 1)[0]));
}
var str78 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 40), 1)[0], new global::System.Span((void*)((byte*)p0 + 44), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 44), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 40), 1)[0]);
}
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerInteractEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerInteractEventData (
resource72, (global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.InteractAction)new global::System.Span((byte*)p0 + 20, 1)[0], lifted77, str78, (new global::System.Span((byte*)p0 + 48, 1)[0] != 0)));
break;
}
case 18: {
var resource81 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerToggleSneakEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerToggleSneakEventData (
resource81, (new global::System.Span((byte*)p0 + 20, 1)[0] != 0), (new global::System.Span((byte*)p0 + 21, 1)[0] != 0)));
break;
}
case 19: {
var resource84 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerToggleFlightEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerToggleFlightEventData (
resource84, (new global::System.Span((byte*)p0 + 20, 1)[0] != 0), (new global::System.Span((byte*)p0 + 21, 1)[0] != 0)));
break;
}
case 20: {
var resource87 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.PlayerToggleSprintEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.PlayerToggleSprintEventData (
resource87, (new global::System.Span((byte*)p0 + 20, 1)[0] != 0), (new global::System.Span((byte*)p0 + 21, 1)[0] != 0)));
break;
}
case 21: {
var resource90 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
string? lifted96;
switch (new global::System.Span((byte*)p0 + 20, 1)[0]) {
case 0: {
lifted96 = null;
break;
}
case 1: {
var str95 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 24), 1)[0], new global::System.Span((void*)((byte*)p0 + 28), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 28), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 24), 1)[0]);
}
lifted96 = str95;
break;
}
default: throw new global::System.ArgumentException("invalid discriminant: " + (new global::System.Span((byte*)p0 + 20, 1)[0]));
}
global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ICommonImports.ItemStack? lifted102;
switch (new global::System.Span((byte*)p0 + 40, 1)[0]) {
case 0: {
lifted102 = null;
break;
}
case 1: {
var str101 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 44), 1)[0], new global::System.Span((void*)((byte*)p0 + 48), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 48), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 44), 1)[0]);
}
lifted102 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ICommonImports.ItemStack (
str101, ((byte)new global::System.Span((byte*)p0 + 52, 1)[0]));
break;
}
default: throw new global::System.ArgumentException("invalid discriminant: " + (new global::System.Span((byte*)p0 + 40, 1)[0]));
}
global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ICommonImports.ItemStack? lifted108;
switch (new global::System.Span((byte*)p0 + 56, 1)[0]) {
case 0: {
lifted108 = null;
break;
}
case 1: {
var str107 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 60), 1)[0], new global::System.Span((void*)((byte*)p0 + 64), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 64), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 60), 1)[0]);
}
lifted108 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ICommonImports.ItemStack (
str107, ((byte)new global::System.Span((byte*)p0 + 68, 1)[0]));
break;
}
default: throw new global::System.ArgumentException("invalid discriminant: " + (new global::System.Span((byte*)p0 + 56, 1)[0]));
}
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.InventoryClickEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.InventoryClickEventData (
resource90, lifted96, (global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.ICommonImports.ClickType)new global::System.Span((byte*)p0 + 32, 1)[0], ((short)new global::System.Span((void*)((byte*)p0 + 34), 1)[0]), ((short)new global::System.Span((void*)((byte*)p0 + 36), 1)[0]), lifted102, lifted108, new global::System.Span((void*)((byte*)p0 + 72), 1)[0], (new global::System.Span((byte*)p0 + 76, 1)[0] != 0)));
break;
}
case 22: {
var resource111 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
string? lifted117;
switch (new global::System.Span((byte*)p0 + 20, 1)[0]) {
case 0: {
lifted117 = null;
break;
}
case 1: {
var str116 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 24), 1)[0], new global::System.Span((void*)((byte*)p0 + 28), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 28), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 24), 1)[0]);
}
lifted117 = str116;
break;
}
default: throw new global::System.ArgumentException("invalid discriminant: " + (new global::System.Span((byte*)p0 + 20, 1)[0]));
}
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.InventoryCloseEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.InventoryCloseEventData (
resource111, lifted117));
break;
}
case 23: {
var resource120 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IWorldImports.World(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IWorldImports.World.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.BlockRedstoneEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.BlockRedstoneEventData (
resource120, ((ushort)new global::System.Span((void*)((byte*)p0 + 20), 1)[0]), (new global::System.Span((void*)((byte*)p0 + 24), 1)[0], new global::System.Span((void*)((byte*)p0 + 28), 1)[0], new global::System.Span((void*)((byte*)p0 + 32), 1)[0]), new global::System.Span((void*)((byte*)p0 + 36), 1)[0], new global::System.Span((void*)((byte*)p0 + 40), 1)[0], (new global::System.Span((byte*)p0 + 44, 1)[0] != 0)));
break;
}
case 24: {
global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player? lifted128;
switch (new global::System.Span((byte*)p0 + 16, 1)[0]) {
case 0: {
lifted128 = null;
break;
}
case 1: {
var resource127 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 20), 1)[0]));
lifted128 = resource127;
break;
}
default: throw new global::System.ArgumentException("invalid discriminant: " + (new global::System.Span((byte*)p0 + 16, 1)[0]));
}
var str129 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 24), 1)[0], new global::System.Span((void*)((byte*)p0 + 28), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 28), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 24), 1)[0]);
}
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.BlockBreakEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.BlockBreakEventData (
lifted128, str129, (new global::System.Span((void*)((byte*)p0 + 32), 1)[0], new global::System.Span((void*)((byte*)p0 + 36), 1)[0], new global::System.Span((void*)((byte*)p0 + 40), 1)[0]), unchecked((uint)(new global::System.Span((void*)((byte*)p0 + 44), 1)[0])), (new global::System.Span((byte*)p0 + 48, 1)[0] != 0), (new global::System.Span((byte*)p0 + 49, 1)[0] != 0)));
break;
}
case 25: {
var str132 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 16), 1)[0], new global::System.Span((void*)((byte*)p0 + 20), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 20), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 16), 1)[0]);
}
var str133 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 24), 1)[0], new global::System.Span((void*)((byte*)p0 + 28), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 28), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 24), 1)[0]);
}
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.BlockBurnEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.BlockBurnEventData (
str132, str133, (new global::System.Span((byte*)p0 + 32, 1)[0] != 0)));
break;
}
case 26: {
var str136 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 16), 1)[0], new global::System.Span((void*)((byte*)p0 + 20), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 20), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 16), 1)[0]);
}
var resource137 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IPlayerImports.Player.THandle(new global::System.Span((void*)((byte*)p0 + 28), 1)[0]));
var str138 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 32), 1)[0], new global::System.Span((void*)((byte*)p0 + 36), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 36), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 32), 1)[0]);
}
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.BlockCanBuildEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.BlockCanBuildEventData (
str136, (new global::System.Span((byte*)p0 + 24, 1)[0] != 0), resource137, str138, (new global::System.Span((byte*)p0 + 40, 1)[0] != 0)));
break;
}
case 27: {
var resource141 = new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IWorldImports.World(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IWorldImports.World.THandle(new global::System.Span((void*)((byte*)p0 + 16), 1)[0]));
var str142 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 20), 1)[0], new global::System.Span((void*)((byte*)p0 + 24), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 24), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 20), 1)[0]);
}
var str143 = global::System.Text.Encoding.UTF8.GetString((byte*)new global::System.Span((void*)((byte*)p0 + 32), 1)[0], new global::System.Span((void*)((byte*)p0 + 36), 1)[0]);
if (new global::System.Span((void*)((byte*)p0 + 36), 1)[0] > 0) {
global::System.Runtime.InteropServices.NativeMemory.Free((void*)new global::System.Span((void*)((byte*)p0 + 32), 1)[0]);
}
lifted159 = global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.Event.BlockGrowEvent(new global::PluginWorld.wit.Imports.pumpkin.plugin.v0_1_0.IEventImports.BlockGrowEventData (
resource141, str142, ((ushort)new global::System.Span((void*)((byte*)p0 + 28), 1)[0]), str143, ((ushort)new global::System.Span((void*)((byte*)p0 + 40), 1)[0]), (new global::System.Span((void*)((byte*)p0 + 44), 1)[0], new global::System.Span((void*)((byte*)p0 + 48), 1)[0], new global::System.Span((void*)((byte*)p0 + 52), 1)[0]), (new global::System.Span