Initial setup
This commit is contained in:
commit
facbde984e
17
.gitignore
vendored
Normal file
17
.gitignore
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
.dub
|
||||
docs.json
|
||||
__dummy.html
|
||||
docs/
|
||||
/pumpkin-api-d
|
||||
pumpkin-api-d.so
|
||||
pumpkin-api-d.dylib
|
||||
pumpkin-api-d.dll
|
||||
libpumpkin-api-d.a
|
||||
pumpkin-api-d.a
|
||||
pumpkin-api-d.lib
|
||||
pumpkin-api-d-test-*
|
||||
*.exe
|
||||
*.pdb
|
||||
*.o
|
||||
*.obj
|
||||
*.lst
|
||||
13
dub.json
Normal file
13
dub.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"description": "D bindings to PumpkinMC's plugin API.",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"authors": ["Demetrius Kanios"],
|
||||
"copyright": "Copyright © 2026, Demetrius Kanios",
|
||||
"name": "pumpkin-api-d",
|
||||
"targetType": "staticLibrary",
|
||||
"toolchainRequirements": {
|
||||
"dmd": "no",
|
||||
"gdc": "no",
|
||||
"ldc": ">=1.43.0"
|
||||
}
|
||||
}
|
||||
5
dub.selections.json
Normal file
5
dub.selections.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"fileVersion": 1,
|
||||
"versions": {
|
||||
}
|
||||
}
|
||||
514
src/pumpkin/register.d
Normal file
514
src/pumpkin/register.d
Normal file
@ -0,0 +1,514 @@
|
||||
module pumpkin.register;
|
||||
|
||||
import wit.pumpkin.plugin.plugin;
|
||||
import wit.common;
|
||||
|
||||
import std.meta : AliasSeq, staticIndexOf;
|
||||
import std.traits : isFunction, getUDAs, EnumMembers;
|
||||
|
||||
struct GetMetadata;
|
||||
struct OnLoad;
|
||||
struct OnUnload;
|
||||
struct HandleIpcMessage;
|
||||
|
||||
struct NoAutoRegister;
|
||||
|
||||
struct EventHandler {
|
||||
EventType type;
|
||||
EventPriority priority = EventPriority.normal;
|
||||
bool blocking = true;
|
||||
}
|
||||
|
||||
struct CommandHandler;
|
||||
struct TaskHandler;
|
||||
struct SuggestionHandler;
|
||||
struct AIGoal(Plugin);
|
||||
struct ChunkGenerator(Plugin);
|
||||
|
||||
template PluginInfo(P) {
|
||||
alias members = __traits(allMembers, P);
|
||||
|
||||
alias getMetadatas = AliasSeq!();
|
||||
alias onLoads = AliasSeq!();
|
||||
alias onUnloads = AliasSeq!();
|
||||
alias ipcHandlers = AliasSeq!();
|
||||
alias eventHandlers = AliasSeq!();
|
||||
|
||||
static foreach (memberName; members) {
|
||||
static foreach (member; __traits(getOverloads, P, memberName)) {
|
||||
static foreach (uda; __traits(getAttributes, member)) {
|
||||
static if (is(uda == GetMetadata) || is(typeof(uda) == GetMetadata)) {
|
||||
getMetadatas = AliasSeq!(member);
|
||||
} else static if (is(uda == OnLoad) || is(typeof(uda) == OnLoad)) {
|
||||
onLoads = AliasSeq!(member);
|
||||
} else static if (is(uda == OnUnload) || is(typeof(uda) == OnUnload)) {
|
||||
onUnloads = AliasSeq!(member);
|
||||
} else static if (is(uda == HandleIpcMessage) || is(typeof(uda) == HandleIpcMessage)) {
|
||||
ipcHandlers = AliasSeq!(member);
|
||||
} else static if (is(uda == EventHandler) || is(typeof(uda) == EventHandler)) {
|
||||
eventHandlers = AliasSeq!(eventHandlers, member);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static assert(getMetadatas.length == 1, "Exactly one method must be marked `@GetMetadata` in plugin `", __traits(
|
||||
fullyQualifiedName, symbol), "`");
|
||||
static assert(onLoads.length <= 1, "At most one method can be marked `@OnLoad` in plugin `", __traits(
|
||||
fullyQualifiedName, symbol), "`");
|
||||
static assert(onUnloads.length <= 1, "At most one method can be marked `@OnUnload` in plugin `", __traits(
|
||||
fullyQualifiedName, symbol), "`");
|
||||
static assert(ipcHandlers.length <= 1, "At most one method can be marked `@HandleIpcMessage` in plugin `", __traits(
|
||||
fullyQualifiedName, symbol), "`");
|
||||
}
|
||||
|
||||
/// A fatal error has occurred. Log an error and trap.
|
||||
noreturn bail(in char[] msg)
|
||||
{
|
||||
import core.stdc.stdlib : abort;
|
||||
|
||||
log(Level.error, msg.witList);
|
||||
abort();
|
||||
}
|
||||
|
||||
private template eventHandlerShim(alias symbol)
|
||||
if (isFunction!symbol && !__traits(isStaticFunction, symbol)) {
|
||||
alias udas = getUDAs!(symbol, EventHandler);
|
||||
static assert(udas.length == 1,
|
||||
"Handler must be marked with exactly one `@EventHandler`");
|
||||
|
||||
static assert(is(typeof(udas[0]) == EventHandler),
|
||||
"`@EventHandler` must be given parameters. `@EventHandler(...)`, not plain `@EventHandler`");
|
||||
|
||||
static if (udas.length) {
|
||||
alias Sig = void function(Server, scope ref Event.Types[udas[0].type]);
|
||||
static assert(is(typeof(&symbol) : Sig), "The event handler `", __traits(fullyQualifiedName, symbol), "` ",
|
||||
"must conform to the necessary signature. ", "Found `",
|
||||
typeof(&symbol), "`", ", but expected `", Sig, "`");
|
||||
}
|
||||
|
||||
alias P = __traits(parent, symbol);
|
||||
void shim(ref P plugin, Server server, scope ref Event e)
|
||||
{
|
||||
enum tag = EnumMembers!(Event.Tag)[udas[0].type];
|
||||
__traits(child, plugin, symbol)(server, e._get!tag);
|
||||
}
|
||||
|
||||
enum eventHandlerShim = &shim;
|
||||
}
|
||||
|
||||
private template commandHandlerShim(alias symbol)
|
||||
if (isFunction!symbol && !__traits(isStaticFunction, symbol)) {
|
||||
alias udas = getUDAs!(symbol, CommandHandler);
|
||||
static assert(udas.length == 1,
|
||||
"Handler must be marked with exactly one `@CommandHandler`");
|
||||
|
||||
alias Sig = Result!(int, CommandError) function(CommandSender, Server, ConsumedArgs);
|
||||
static assert(is(typeof(&symbol) : Sig), "The command handler `", __traits(fullyQualifiedName, symbol), "` ",
|
||||
"must conform to the necessary signature. ", "Found `",
|
||||
typeof(&symbol), "`", ", but expected `", Sig, "`");
|
||||
|
||||
alias P = __traits(parent, symbol);
|
||||
Result!(int, CommandError) shim(ref P plugin, CommandSender sender, Server server, ConsumedArgs args)
|
||||
{
|
||||
return __traits(child, plugin, symbol)(sender, server, args);
|
||||
}
|
||||
|
||||
enum commandHandlerShim = &shim;
|
||||
}
|
||||
|
||||
private template suggestionHandlerShim(alias symbol)
|
||||
if (isFunction!symbol && !__traits(isStaticFunction, symbol)) {
|
||||
alias udas = getUDAs!(symbol, SuggestionHandler);
|
||||
static assert(udas.length == 1,
|
||||
"Handler must be marked with exactly one `@SuggestionHandler`");
|
||||
|
||||
alias Sig = CommandSuggestions function(CommandSender, Server, in SuggestionRequest);
|
||||
static assert(is(typeof(&symbol) : Sig), "Suggestion handler signature mismatch for `", __traits(
|
||||
fullyQualifiedName, symbol), "`");
|
||||
|
||||
alias P = __traits(parent, symbol);
|
||||
CommandSuggestions shim(ref P plugin, CommandSender sender, Server server, in SuggestionRequest request)
|
||||
{
|
||||
return __traits(child, plugin, symbol)(sender, server, request);
|
||||
}
|
||||
|
||||
enum suggestionHandlerShim = &shim;
|
||||
}
|
||||
|
||||
private template taskHandlerShim(alias symbol)
|
||||
if (isFunction!symbol && !__traits(isStaticFunction, symbol)) {
|
||||
alias udas = getUDAs!(symbol, TaskHandler);
|
||||
static assert(udas.length == 1,
|
||||
"Handler must be marked with exactly one `@TaskHandler`");
|
||||
|
||||
alias Sig = void function(Server);
|
||||
static assert(is(typeof(&symbol) : Sig), "The task handler `", __traits(fullyQualifiedName, symbol), "` ",
|
||||
"must conform to the necessary signature. ", "Found `",
|
||||
typeof(&symbol), "`", ", but expected `", Sig, "`");
|
||||
|
||||
alias P = __traits(parent, symbol);
|
||||
void shim(ref P plugin, Server server)
|
||||
{
|
||||
__traits(child, plugin, symbol)(server);
|
||||
}
|
||||
|
||||
enum taskHandlerShim = &shim;
|
||||
}
|
||||
|
||||
struct AIGoalShimTable(P) {
|
||||
bool function(ref P, Server, Entity) canStart;
|
||||
bool function(ref P, Server, Entity) shouldContinue;
|
||||
void function(ref P, Server, Entity) start;
|
||||
void function(ref P, Server, Entity) tick;
|
||||
void function(ref P, Server, Entity) stop;
|
||||
}
|
||||
|
||||
private template pluginForAIGoal(Goal) {
|
||||
alias udas = getUDAs!(Goal, AIGoal);
|
||||
static assert(udas.length == 1, "AI goal `", __traits(fullyQualifiedName, Goal), "` must be marked with exactly one `@AIGoal!PluginType`");
|
||||
|
||||
static if (udas.length) {
|
||||
static if (is(udas[0] == AIGoal!P, P)) {
|
||||
alias pluginForAIGoal = P;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private template aiGoalShim(Goal) {
|
||||
alias P = pluginForAIGoal!Goal;
|
||||
|
||||
static assert(__traits(hasMember, Goal, "canStart"), "AI goal `", __traits(
|
||||
fullyQualifiedName, Goal), "` needs a static method named `canStart`");
|
||||
static assert(__traits(hasMember, Goal, "shouldContinue"), "AI goal `", __traits(
|
||||
fullyQualifiedName, Goal), "` needs a static method named `shouldContinue`");
|
||||
static assert(__traits(hasMember, Goal, "start"), "AI goal `", __traits(
|
||||
fullyQualifiedName, Goal), "` needs a static method named `start`");
|
||||
static assert(__traits(hasMember, Goal, "tick"), "AI goal `", __traits(
|
||||
fullyQualifiedName, Goal), "` needs a static method named `tick`");
|
||||
static assert(__traits(hasMember, Goal, "stop"), "AI goal `", __traits(
|
||||
fullyQualifiedName, Goal), "` needs a static method named `stop`");
|
||||
|
||||
static assert(__traits(isStaticFunction, Goal.canStart), "`" ~ __traits(
|
||||
fullyQualifiedName, Goal.canStart) ~ "` must be static (AI goals must be stateless)");
|
||||
static assert(__traits(isStaticFunction, Goal.shouldContinue), "`" ~ __traits(
|
||||
fullyQualifiedName, Goal.shouldContinue) ~ "` must be static (AI goals must be stateless)");
|
||||
static assert(__traits(isStaticFunction, Goal.start), "`" ~ __traits(
|
||||
fullyQualifiedName, Goal.start) ~ "` must be static (AI goals must be stateless)");
|
||||
static assert(__traits(isStaticFunction, Goal.tick), "`" ~ __traits(
|
||||
fullyQualifiedName, Goal.tick) ~ "` must be static (AI goals must be stateless)");
|
||||
static assert(__traits(isStaticFunction, Goal.stop), "`" ~ __traits(
|
||||
fullyQualifiedName, Goal.stop) ~ "` must be static (AI goals must be stateless)");
|
||||
|
||||
alias BoolSig = bool function(ref P, Server, Entity);
|
||||
alias VoidSig = void function(ref P, Server, Entity);
|
||||
|
||||
static assert(is(typeof(&Goal.canStart) : BoolSig), "The AI goal method `", __traits(fullyQualifiedName, Goal
|
||||
.canStart), "` ",
|
||||
"must conform to the necessary signature. ", "Found `",
|
||||
typeof(&Goal.canStart), "`", ", but expected `", BoolSig, "`");
|
||||
static assert(is(typeof(&Goal.shouldContinue) : BoolSig), "The AI goal method `", __traits(fullyQualifiedName, Goal
|
||||
.shouldContinue), "` ",
|
||||
"must conform to the necessary signature. ", "Found `",
|
||||
typeof(&Goal.shouldContinue), "`", ", but expected `", BoolSig, "`");
|
||||
static assert(is(typeof(&Goal.start) : VoidSig), "The AI goal method `", __traits(fullyQualifiedName, Goal
|
||||
.start), "` ",
|
||||
"must conform to the necessary signature. ", "Found `",
|
||||
typeof(&Goal.start), "`", ", but expected `", VoidSig, "`");
|
||||
static assert(is(typeof(&Goal.tick) : VoidSig), "The AI goal method `", __traits(fullyQualifiedName, Goal
|
||||
.tick), "` ",
|
||||
"must conform to the necessary signature. ", "Found `",
|
||||
typeof(&Goal.tick), "`", ", but expected `", VoidSig, "`");
|
||||
static assert(is(typeof(&Goal.stop) : VoidSig), "The AI goal method `", __traits(fullyQualifiedName, Goal
|
||||
.stop), "` ",
|
||||
"must conform to the necessary signature. ", "Found `",
|
||||
typeof(&Goal.stop), "`", ", but expected `", VoidSig, "`");
|
||||
|
||||
bool shimCanStart(ref P plugin, Server server, Entity entity) => Goal.canStart(plugin, server, entity);
|
||||
bool shimShouldContinue(ref P plugin, Server server, Entity entity) => Goal.shouldContinue(plugin, server, entity);
|
||||
void shimStart(ref P plugin, Server server, Entity entity) => Goal.start(plugin, server, entity);
|
||||
void shimTick(ref P plugin, Server server, Entity entity) => Goal.tick(plugin, server, entity);
|
||||
void shimStop(ref P plugin, Server server, Entity entity) => Goal.stop(plugin, server, entity);
|
||||
|
||||
__gshared immutable AIGoalShimTable!P shim = AIGoalShimTable!P(
|
||||
&shimCanStart,
|
||||
&shimShouldContinue,
|
||||
&shimStart,
|
||||
&shimTick,
|
||||
&shimStop
|
||||
);
|
||||
|
||||
enum aiGoalShim = &shim;
|
||||
}
|
||||
|
||||
struct ChunkGeneratorShimTable(P) {
|
||||
void function(ref P, ChunkBuffer) biomes;
|
||||
void function(ref P, ChunkBuffer) noise;
|
||||
void function(ref P, ChunkBuffer) surface;
|
||||
void function(ref P, ChunkBuffer) features;
|
||||
}
|
||||
|
||||
private template pluginForChunkGenerator(Generator) {
|
||||
alias udas = getUDAs!(Generator, ChunkGenerator);
|
||||
static assert(udas.length == 1, "Chunk generator `", __traits(fullyQualifiedName, Goal), "` must be marked with exactly one `@ChunkGenerator!PluginType`");
|
||||
|
||||
static if (udas.length) {
|
||||
static if (is(udas[0] == ChunkGenerator!P, P)) {
|
||||
alias pluginForChunkGenerator = P;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private template chunkGeneratorShim(Generator) {
|
||||
alias P = pluginForChunkGenerator!Generator;
|
||||
|
||||
static assert(__traits(hasMember, Generator, "biomes"), "Chunk generator `", __traits(
|
||||
fullyQualifiedName, Generator), "` needs a static method named `biomes`");
|
||||
static assert(__traits(hasMember, Generator, "noise"), "Chunk generator `", __traits(
|
||||
fullyQualifiedName, Generator), "` needs a static method named `noise`");
|
||||
static assert(__traits(hasMember, Generator, "surface"), "Chunk generator `", __traits(
|
||||
fullyQualifiedName, Generator), "` needs a static method named `surface`");
|
||||
static assert(__traits(hasMember, Generator, "features"), "Chunk generator `", __traits(
|
||||
fullyQualifiedName, Generator), "` needs a static method named `features`");
|
||||
|
||||
static assert(__traits(isStaticFunction, Generator.biomes), "`" ~ __traits(
|
||||
fullyQualifiedName, Generator.biomes) ~ "` must be static");
|
||||
static assert(__traits(isStaticFunction, Generator.noise), "`" ~ __traits(
|
||||
fullyQualifiedName, Generator.noise) ~ "` must be static");
|
||||
static assert(__traits(isStaticFunction, Generator.surface), "`" ~ __traits(
|
||||
fullyQualifiedName, Generator.surface) ~ "` must be static");
|
||||
static assert(__traits(isStaticFunction, Generator.features), "`" ~ __traits(
|
||||
fullyQualifiedName, Generator.features) ~ "` must be static");
|
||||
|
||||
alias Sig = void function(ref P, ChunkBuffer);
|
||||
|
||||
static assert(is(typeof(&Generator.biomes) : Sig), "The chunk generator method `", __traits(fullyQualifiedName, Generator
|
||||
.biomes), "` ",
|
||||
"must conform to the necessary signature. ", "Found `",
|
||||
typeof(&Generator.biomes), "`", ", but expected `", Sig, "`");
|
||||
static assert(is(typeof(&Generator.noise) : Sig), "The chunk generator method `", __traits(fullyQualifiedName, Generator
|
||||
.noise), "` ",
|
||||
"must conform to the necessary signature. ", "Found `",
|
||||
typeof(&Generator.noise), "`", ", but expected `", Sig, "`");
|
||||
static assert(is(typeof(&Generator.surface) : Sig), "The chunk generator method `", __traits(fullyQualifiedName, Generator
|
||||
.surface), "` ",
|
||||
"must conform to the necessary signature. ", "Found `",
|
||||
typeof(&Generator.surface), "`", ", but expected `", Sig, "`");
|
||||
static assert(is(typeof(&Generator.features) : Sig), "The chunk generator method `", __traits(fullyQualifiedName, Generator
|
||||
.features), "` ",
|
||||
"must conform to the necessary signature. ", "Found `",
|
||||
typeof(&Generator.features), "`", ", but expected `", Sig, "`");
|
||||
|
||||
void shimBiomes(ref P plugin, ChunkBuffer buffer) => Generator.biomes(plugin, buffer);
|
||||
void shimNoise(ref P plugin, ChunkBuffer buffer) => Generator.noise(plugin, buffer);
|
||||
void shimSurface(ref P plugin, ChunkBuffer buffer) => Generator.surface(plugin, buffer);
|
||||
void shimFeatures(ref P plugin, ChunkBuffer buffer) => Generator.features(plugin, buffer);
|
||||
|
||||
__gshared immutable ChunkGeneratorShimTable!P shim = ChunkGeneratorShimTable!P(
|
||||
&shimBiomes,
|
||||
&shimNoise,
|
||||
&shimSurface,
|
||||
&shimFeatures
|
||||
);
|
||||
|
||||
enum chunkGeneratorShim = &shim;
|
||||
}
|
||||
|
||||
void registerEventHandler(alias symbol)(Context ctx)
|
||||
{
|
||||
alias udas = getUDAs!(symbol, EventHandler);
|
||||
|
||||
static bool registered = false;
|
||||
if (registered) {
|
||||
log(Level.warn, ("Tried to register the same event handler `" ~ __traits(fullyQualifiedName,
|
||||
symbol) ~ "` multiple times.").witList);
|
||||
return;
|
||||
}
|
||||
registered = true;
|
||||
|
||||
ctx.registerEvent(cast(size_t)eventHandlerShim!symbol, udas[0].type, udas[0].priority, udas[0]
|
||||
.blocking);
|
||||
}
|
||||
|
||||
void execute(alias symbol)(Command.Borrow command)
|
||||
{
|
||||
command.executeWithHandlerId(cast(size_t)commandHandlerShim!symbol);
|
||||
}
|
||||
|
||||
void execute(alias symbol)(CommandNode.Borrow node)
|
||||
{
|
||||
node.executeWithHandlerId(cast(size_t)commandHandlerShim!symbol);
|
||||
}
|
||||
|
||||
void suggest(alias symbol)(CommandNode.Borrow node)
|
||||
{
|
||||
node.suggestWithHandlerId(cast(size_t)suggestionHandlerShim!symbol);
|
||||
}
|
||||
|
||||
uint scheduleDelayed(alias symbol)(ulong delayTicks)
|
||||
{
|
||||
return scheduleDelayedTask(cast(size_t)taskHandlerShim!symbol, delayTicks);
|
||||
}
|
||||
|
||||
uint scheduleRepeating(alias symbol)(ulong delayTicks, ulong periodTicks)
|
||||
{
|
||||
return scheduleRepeatingTask(cast(size_t)taskHandlerShim!symbol, delayTicks, periodTicks);
|
||||
}
|
||||
|
||||
void attachCustomAiGoal(Goal)(Mob.Borrow mob, ubyte priority = 0)
|
||||
{
|
||||
mob.addCustomAiGoal(priority, cast(size_t)aiGoalShim!Goal);
|
||||
}
|
||||
|
||||
void setCustomChunkGenerator(alias Generator)(World.Borrow world)
|
||||
{
|
||||
world.setChunkGenerator(cast(size_t)chunkGeneratorShim!Generator);
|
||||
}
|
||||
|
||||
mixin template RegisterPlugin(P) {
|
||||
__gshared P globalPluginInst;
|
||||
|
||||
alias PInfo = PluginInfo!P;
|
||||
|
||||
@witInterface("pumpkin:plugin/metadata@0.1.0")
|
||||
@witExport PluginMetadata getMetadata()
|
||||
{
|
||||
return __traits(child, globalPluginInst, PInfo.getMetadatas[0])();
|
||||
}
|
||||
|
||||
@witInterface("$root") {
|
||||
@witExport void initPlugin()
|
||||
{
|
||||
version (D_BetterC) {
|
||||
} else {
|
||||
import core.runtime;
|
||||
|
||||
Runtime.initialize();
|
||||
}
|
||||
|
||||
import core.lifetime;
|
||||
|
||||
emplace(&globalPluginInst);
|
||||
}
|
||||
|
||||
@witExport Result!(void, WitString) onLoad(Context ctx)
|
||||
{
|
||||
import std.traits : hasUDA;
|
||||
|
||||
static foreach (alias handler; PInfo.eventHandlers) {
|
||||
static if (!hasUDA!(handler, NoAutoRegister)) {
|
||||
ctx.registerEventHandler!handler;
|
||||
}
|
||||
}
|
||||
|
||||
static if (PInfo.onLoads.length == 1) {
|
||||
return __traits(child, globalPluginInst, PInfo.onLoads[0])(ctx);
|
||||
} else {
|
||||
return ok!WitString();
|
||||
}
|
||||
}
|
||||
|
||||
@witExport Result!(void, WitString) onUnload(Context ctx)
|
||||
{
|
||||
static if (PInfo.onUnloads.length == 1) {
|
||||
return __traits(child, globalPluginInst, PInfo.onUnloads[0])(ctx);
|
||||
} else {
|
||||
return ok!WitString();
|
||||
}
|
||||
}
|
||||
|
||||
@witExport Event handleEvent(uint eventId, Server server, ref scope Event event)
|
||||
{
|
||||
auto ret = event.witClone;
|
||||
|
||||
alias EventShim = void function(ref P plugin, Server, scope ref Event);
|
||||
(cast(EventShim)eventId)(globalPluginInst, server, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@witExport Result!(int, CommandError) handleCommand(uint commandId,
|
||||
CommandSender sender, Server server, ConsumedArgs args)
|
||||
{
|
||||
alias CommandShim = Result!(int, CommandError) function(ref P, CommandSender, Server, ConsumedArgs);
|
||||
return (cast(CommandShim)(commandId))(globalPluginInst, sender, server, args);
|
||||
}
|
||||
|
||||
@witExport CommandSuggestions handleCommandSuggestion(uint suggestionId,
|
||||
CommandSender sender, Server server, in SuggestionRequest request)
|
||||
{
|
||||
alias SuggestionShim = CommandSuggestions function(ref P, CommandSender, Server, in SuggestionRequest);
|
||||
return (cast(SuggestionShim)(suggestionId))(globalPluginInst, sender, server, request);
|
||||
}
|
||||
|
||||
@witExport void handleTask(uint taskId, Server server)
|
||||
{
|
||||
alias TaskShim = void function(ref P, Server);
|
||||
(cast(TaskShim)(taskId))(globalPluginInst, server);
|
||||
}
|
||||
|
||||
@witExport Result!(IpcMessage, WitString) handleIpcMessage(in WitString sender,
|
||||
in IpcMessage message)
|
||||
{
|
||||
static if (PInfo.ipcHandlers.length == 1) {
|
||||
return __traits(child, globalPluginInst, PInfo.ipcHandlers[0])(sender, message);
|
||||
} else {
|
||||
return err!IpcMessage("This plugin cannot recieve messages.".witList.witClone);
|
||||
}
|
||||
}
|
||||
|
||||
@witExport bool handleAIGoalCanStart(uint goalId, Server server, Entity entity)
|
||||
{
|
||||
auto table = cast(const(AIGoalShimTable!P)*)goalId;
|
||||
return table.canStart(globalPluginInst, server, entity);
|
||||
}
|
||||
|
||||
@witExport bool handleAIGoalShouldContinue(uint goalId, Server server, Entity entity)
|
||||
{
|
||||
auto table = cast(const(AIGoalShimTable!P)*)goalId;
|
||||
return table.shouldContinue(globalPluginInst, server, entity);
|
||||
}
|
||||
|
||||
@witExport void handleAIGoalStart(uint goalId, Server server, Entity entity)
|
||||
{
|
||||
auto table = cast(const(AIGoalShimTable!P)*)goalId;
|
||||
table.start(globalPluginInst, server, entity);
|
||||
}
|
||||
|
||||
@witExport void handleAIGoalTick(uint goalId, Server server, Entity entity)
|
||||
{
|
||||
auto table = cast(const(AIGoalShimTable!P)*)goalId;
|
||||
table.tick(globalPluginInst, server, entity);
|
||||
}
|
||||
|
||||
@witExport void handleAIGoalStop(uint goalId, Server server, Entity entity)
|
||||
{
|
||||
auto table = cast(const(AIGoalShimTable!P)*)goalId;
|
||||
table.stop(globalPluginInst, server, entity);
|
||||
}
|
||||
|
||||
@witExport void handleGeneratePhase(uint generatorId, GenerationPhase phase, ChunkBuffer buffer)
|
||||
{
|
||||
auto table = cast(const(ChunkGeneratorShimTable!P)*)generatorId;
|
||||
|
||||
final switch (phase) {
|
||||
case GenerationPhase.biomes:
|
||||
table.biomes(globalPluginInst, buffer);
|
||||
break;
|
||||
case GenerationPhase.noise:
|
||||
table.noise(globalPluginInst, buffer);
|
||||
break;
|
||||
case GenerationPhase.surface:
|
||||
table.surface(globalPluginInst, buffer);
|
||||
break;
|
||||
case GenerationPhase.features:
|
||||
table.features(globalPluginInst, buffer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
alias Exports = wit.pumpkin.plugin.plugin.Exports!(getMetadata,
|
||||
initPlugin, onLoad, onUnload, handleEvent, handleCommand,
|
||||
handleCommandSuggestion, handleTask, handleIpcMessage, handleAIGoalCanStart, handleAIGoalShouldContinue,
|
||||
handleAIGoalStart, handleAIGoalTick, handleAIGoalStop, handleGeneratePhase);
|
||||
}
|
||||
786
src/wit/common.d
Normal file
786
src/wit/common.d
Normal file
@ -0,0 +1,786 @@
|
||||
module wit.common;
|
||||
|
||||
import core.attribute : mustuse;
|
||||
import ldc.attributes : llvmAttr;
|
||||
|
||||
alias wasmImport(string mod, string name) = AliasSeq!(
|
||||
llvmAttr("wasm-import-module", mod),
|
||||
llvmAttr("wasm-import-name", name)
|
||||
);
|
||||
|
||||
enum wasmExport(string name) = llvmAttr("wasm-export-name", name);
|
||||
|
||||
struct witInterface { string name; }
|
||||
struct witExport { string name; }
|
||||
|
||||
/// Thin CABI compliant wrapper over `T[]`
|
||||
struct WitList(T) {
|
||||
@safe @nogc pure nothrow pragma(inline, true):
|
||||
T* ptr;
|
||||
size_t length;
|
||||
|
||||
this(inout T[] slice) inout @trusted {
|
||||
ptr = slice.ptr;
|
||||
length = slice.length;
|
||||
}
|
||||
|
||||
void opAssign(T[] slice) @trusted {
|
||||
ptr = slice.ptr;
|
||||
length = slice.length;
|
||||
}
|
||||
|
||||
alias asSlice this;
|
||||
inout(T)[] asSlice() @trusted inout {
|
||||
return (ptr && length) ? ptr[0..length] : null;
|
||||
}
|
||||
|
||||
bool opEquals(in T[] other) const => this[] == other;
|
||||
size_t toHash() const => this[].hashOf;
|
||||
}
|
||||
pragma(inline, true) auto witList(T)(inout T[] slice) => inout WitList!T(slice);
|
||||
|
||||
// WIT ABI for string matches List,
|
||||
// except list<char> in WIT is actually List!(dchar)
|
||||
//
|
||||
// We assume UTF-8 data (as D native strings are UTF-8)
|
||||
alias WitString = WitList!(char);
|
||||
|
||||
// TODO: split this file up and give Tuple a full port of the Phobos version?
|
||||
/// adapted from Phobos std.typecons.Tuple
|
||||
/// No support for naming members.
|
||||
struct Tuple(Types...) if (is(Types)) {
|
||||
Types expand;
|
||||
alias expand this;
|
||||
}
|
||||
|
||||
inout(Tuple!Types) tuple(Types...)(inout Types vals) => inout Tuple!Types(vals);
|
||||
|
||||
mixin template WitFlags(T) if (__traits(isUnsigned, T)) {
|
||||
private alias F = typeof(this);
|
||||
|
||||
T bits;
|
||||
|
||||
@safe nothrow @nogc pure pragma(inline, true):
|
||||
|
||||
static typeof(this) opIndex(size_t i)
|
||||
in(i < T.sizeof*8) => F(cast(T)(1 << i));
|
||||
|
||||
auto opUnary(string op : "~")() const => F(~bits);
|
||||
|
||||
auto ref opOpAssign(string op)(F rhs)
|
||||
if (op == "|" || op == "&" || op == "^")
|
||||
{
|
||||
mixin("bits "~op~"= rhs.bits;");
|
||||
return this;
|
||||
}
|
||||
|
||||
auto opBinary(string op)(F flags) const
|
||||
if (op == "|" || op == "&" || op == "^")
|
||||
{
|
||||
F result = this;
|
||||
result.opOpAssign!op(flags);
|
||||
return result;
|
||||
}
|
||||
|
||||
typeof(this) witClone() const { return this; }
|
||||
}
|
||||
|
||||
|
||||
mixin template WitVariant(T...) {
|
||||
public alias Types = T;
|
||||
|
||||
private:
|
||||
static assert(is(typeof(this).Tag));
|
||||
static assert(is(Tag U == enum) && __traits(isIntegral, U));
|
||||
|
||||
static assert(__traits(allMembers, Tag).length == Types.length);
|
||||
static foreach (i, M; __traits(allMembers, Tag)) {
|
||||
static assert(i == __traits(getMember, Tag, M));
|
||||
}
|
||||
|
||||
union Storage {
|
||||
template ReplacedTypes() {
|
||||
alias ReplacedTypes = AliasSeq!();
|
||||
|
||||
static foreach (T; Types) {
|
||||
static if (is(T == void))
|
||||
ReplacedTypes = AliasSeq!(ReplacedTypes, void[0]);
|
||||
else
|
||||
ReplacedTypes = AliasSeq!(ReplacedTypes, T);
|
||||
}
|
||||
}
|
||||
|
||||
ubyte __zeroinit = 0;
|
||||
ReplacedTypes!() members;
|
||||
}
|
||||
|
||||
Tag _tag;
|
||||
Storage _storage;
|
||||
|
||||
|
||||
@disable this();
|
||||
|
||||
pragma(inline, true)
|
||||
this(Tag tag, inout Storage storage = Storage.init) inout @nogc nothrow @trusted {
|
||||
_tag = tag;
|
||||
_storage = storage;
|
||||
}
|
||||
|
||||
public:
|
||||
pragma(inline, true)
|
||||
static auto _create(Tag tag)() if (is(Types[tag] == void)) {
|
||||
return typeof(this)(tag);
|
||||
}
|
||||
|
||||
pragma(inline, true)
|
||||
static auto _create(Tag tag)(inout Types[tag] val) if (!is(Types[tag] == void)) {
|
||||
Storage storage = Storage.init;
|
||||
storage.tupleof[tag+1] = cast(Types[tag])val;
|
||||
return inout typeof(this)(tag, cast(inout(Storage))storage);
|
||||
}
|
||||
|
||||
pragma(inline, true)
|
||||
ref auto _get(Tag tag)() inout return if (!is(Types[tag] == void))
|
||||
in (_tag == tag) do { return cast(inout)_storage.tupleof[tag+1]; }
|
||||
}
|
||||
|
||||
/// Based on Rust's Option
|
||||
struct Option(T) {
|
||||
private:
|
||||
bool _present = false;
|
||||
T _value;
|
||||
|
||||
pragma(inline, true)
|
||||
this(bool present, inout T value) inout @safe @nogc nothrow {
|
||||
_present = present;
|
||||
_value = value;
|
||||
}
|
||||
public:
|
||||
pragma(inline, true)
|
||||
static inout(Option) makeSome(inout T value) @safe @nogc nothrow {
|
||||
return inout Option(true, value);
|
||||
}
|
||||
|
||||
pragma(inline, true)
|
||||
static Option makeNone() @safe @nogc nothrow {
|
||||
return Option(false, T.init);
|
||||
}
|
||||
|
||||
pragma(inline, true)
|
||||
bool isSome() const @safe @nogc nothrow => _present;
|
||||
alias isSome this; // implicit conversion to bool
|
||||
|
||||
pragma(inline, true)
|
||||
bool isNone() const @safe @nogc nothrow => !_present;
|
||||
|
||||
pragma(inline, true)
|
||||
ref inout(T) unwrap() inout @trusted @nogc nothrow return
|
||||
in (_present) do { return _value; }
|
||||
|
||||
pragma(inline, true)
|
||||
T unwrapOr(T fallback) @trusted @nogc nothrow => _present ? _value : fallback;
|
||||
|
||||
T unwrapOrElse(D)(scope D fallback)
|
||||
if (is(D R == return) && is(R : T) && is(D == __parameters))
|
||||
{ return _present ? _value : fallback(); }
|
||||
|
||||
bool opEquals(in Option rhs) const {
|
||||
if (isSome != rhs.isSome) return false;
|
||||
|
||||
if (isSome) return unwrap == rhs.unwrap;
|
||||
else return true;
|
||||
}
|
||||
|
||||
size_t toHash() const @safe pure nothrow
|
||||
{
|
||||
if (isSome) return this.unwrap.hashOf(true.hashOf);
|
||||
return false.hashOf;
|
||||
}
|
||||
}
|
||||
|
||||
pragma(inline, true)
|
||||
auto some(T)(inout T value) @safe @nogc nothrow {
|
||||
return Option!T.makeSome(value);
|
||||
}
|
||||
|
||||
pragma(inline, true)
|
||||
auto none(T)() @safe @nogc nothrow {
|
||||
return Option!T.makeNone;
|
||||
}
|
||||
|
||||
/// Based on Rust's Result
|
||||
@mustuse
|
||||
struct Result(T = void, E = void) {
|
||||
private:
|
||||
bool _hasError;
|
||||
union Storage {
|
||||
ubyte __zeroinit = 0;
|
||||
static if (!is(T == void)) {
|
||||
T value;
|
||||
}
|
||||
static if (!is(E == void)) {
|
||||
E error;
|
||||
}
|
||||
}
|
||||
Storage _storage;
|
||||
|
||||
this(bool hasError, inout(Storage) storage) inout @safe @nogc nothrow {
|
||||
_hasError = hasError;
|
||||
_storage = storage;
|
||||
}
|
||||
|
||||
public:
|
||||
static if (is(T == void)) {
|
||||
pragma(inline, true)
|
||||
static Result makeOk() @safe @nogc nothrow => Result(false, Storage.init);
|
||||
} else {
|
||||
pragma(inline, true)
|
||||
static inout(Result) makeOk(inout(T) value) @trusted @nogc nothrow {
|
||||
Storage newStorage = Storage.init;
|
||||
newStorage.value = cast(T)value;
|
||||
|
||||
return inout Result(false, cast(inout Storage)newStorage);
|
||||
}
|
||||
}
|
||||
|
||||
static if (is(E == void)) {
|
||||
pragma(inline, true)
|
||||
static Result makeErr() @safe @nogc nothrow => Result(true, Storage.init);
|
||||
} else {
|
||||
pragma(inline, true)
|
||||
static inout(Result) makeErr(inout(E) error) @trusted @nogc nothrow {
|
||||
Storage newStorage = Storage.init;
|
||||
newStorage.error = cast(E)error;
|
||||
|
||||
return inout Result(true, cast(inout Storage)newStorage);
|
||||
}
|
||||
}
|
||||
|
||||
pragma(inline, true)
|
||||
bool isOk() const @safe @nogc nothrow => !_hasError;
|
||||
|
||||
pragma(inline, true)
|
||||
bool isErr() const @safe @nogc nothrow => _hasError;
|
||||
alias isErr this; // implicit conversion to bool
|
||||
|
||||
static if (!is(T == void)) {
|
||||
pragma(inline, true)
|
||||
ref inout(T) unwrap() inout @trusted @nogc nothrow return
|
||||
in (isOk) do { return _storage.value; }
|
||||
|
||||
pragma(inline, true)
|
||||
T unwrapOr(T fallback) @trusted @nogc nothrow => isOk ? _storage.value : fallback;
|
||||
|
||||
T unwrapOrElse(D)(scope D fallback)
|
||||
if (is(D R == return) && is(R : T) && is(D == __parameters))
|
||||
{ return isOk ? _storage.value : fallback(); }
|
||||
}
|
||||
|
||||
static if (!is(E == void)) {
|
||||
pragma(inline, true)
|
||||
ref inout(E) unwrapErr() inout @trusted @nogc nothrow return
|
||||
in (isErr) do { return _storage.error; }
|
||||
}
|
||||
|
||||
bool opEquals(in Result rhs) const {
|
||||
if (isErr != rhs.isErr) return false;
|
||||
|
||||
if (isErr) {
|
||||
static if (!is(E == void)) return unwrapErr == rhs.unwrapErr;
|
||||
else return true;
|
||||
}
|
||||
|
||||
static if (!is(T == void)) return unwrap == rhs.unwrap;
|
||||
else return true;
|
||||
}
|
||||
|
||||
size_t toHash() const @safe pure nothrow
|
||||
{
|
||||
if (isErr) {
|
||||
static if (!is(E == void)) return this.unwrapErr.hashOf(true.hashOf);
|
||||
return true.hashOf;
|
||||
}
|
||||
|
||||
static if (!is(T == void)) return this.unwrap.hashOf(false.hashOf);
|
||||
else return false.hashOf;
|
||||
}
|
||||
}
|
||||
|
||||
pragma(inline, true)
|
||||
auto ok(E, T)(inout T value) @safe @nogc nothrow {
|
||||
return Result!(T, E).makeOk(value);
|
||||
}
|
||||
pragma(inline, true)
|
||||
auto ok(E)() @safe @nogc nothrow {
|
||||
return Result!(void, E).makeOk();
|
||||
}
|
||||
|
||||
pragma(inline, true)
|
||||
auto err(T, E)(inout E value) @safe @nogc nothrow {
|
||||
return Result!(T, E).makeErr(value);
|
||||
}
|
||||
pragma(inline, true)
|
||||
auto err(T)() @safe @nogc nothrow {
|
||||
return Result!(T, void).makeErr();
|
||||
}
|
||||
|
||||
pragma(inline, true)
|
||||
void witFree(T)(scope ref T val) if (__traits(isArithmetic, T)) {
|
||||
// no-op
|
||||
}
|
||||
pragma(inline, true)
|
||||
void witDrop(T)(scope ref T val) if (__traits(isArithmetic, T)) {
|
||||
// no-op
|
||||
}
|
||||
pragma(inline, true)
|
||||
T witClone(T)(in T val) if (__traits(isArithmetic, T)) {
|
||||
return val;
|
||||
}
|
||||
|
||||
pragma(inline, true)
|
||||
void witFree(T : Option!U, U)(scope ref T val) {
|
||||
static if (!is(U == void)) if (val.isSome) val.unwrap.witFree;
|
||||
}
|
||||
pragma(inline, true)
|
||||
void witDrop(T : Option!U, U)(scope ref T val) {
|
||||
static if (!is(U == void)) if (val.isSome) val.unwrap.witDrop;
|
||||
}
|
||||
pragma(inline, true)
|
||||
T witClone(T : Option!U, U)(in T val) {
|
||||
if (val.isSome) {
|
||||
static if (!is(U == void)) {
|
||||
return T.makeSome(val.unwrap.witClone);
|
||||
} else {
|
||||
return T.makeSome;
|
||||
}
|
||||
} else {
|
||||
return T.makeNone;
|
||||
}
|
||||
}
|
||||
|
||||
pragma(inline, true)
|
||||
void witFree(T : Result!(U, V), U, V)(scope ref T val) {
|
||||
if (val.isErr) {
|
||||
static if (!is(V == void)) val.unwrapErr.witFree;
|
||||
} else {
|
||||
static if (!is(U == void)) val.unwrap.witFree;
|
||||
}
|
||||
}
|
||||
pragma(inline, true)
|
||||
void witDrop(T : Result!(U, V), U, V)(scope ref T val) {
|
||||
if (val.isErr) {
|
||||
static if (!is(V == void)) val.unwrapErr.witDrop;
|
||||
} else {
|
||||
static if (!is(U == void)) val.unwrap.witDrop;
|
||||
}
|
||||
}
|
||||
pragma(inline, true)
|
||||
T witClone(T : Result!(U, V), U, V)(in T val) {
|
||||
if (val.isErr) {
|
||||
static if (!is(V == void)) {
|
||||
return T.makeErr(val.unwrapErr.witClone);
|
||||
} else {
|
||||
return T.makeErr;
|
||||
}
|
||||
} else {
|
||||
static if (!is(U == void)) {
|
||||
return T.makeOk(val.unwrap.witClone);
|
||||
} else {
|
||||
return T.makeOk;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pragma(inline, true)
|
||||
void witFree(T : WitList!U, U)(scope ref T val) {
|
||||
foreach (ref e; val) {
|
||||
e.witFree;
|
||||
}
|
||||
if (val.ptr && val.length) free(val.ptr);
|
||||
val = null;
|
||||
}
|
||||
pragma(inline, true)
|
||||
void witDrop(T : WitList!U, U)(scope ref T val) {
|
||||
foreach (ref e; val) {
|
||||
e.witDrop;
|
||||
}
|
||||
val = null;
|
||||
}
|
||||
T witClone(T : WitList!U, U)(in T val) @trusted {
|
||||
if (val.ptr == null || val.length == 0) return T(null);
|
||||
|
||||
auto clone = mallocSlice!U(val.length);
|
||||
|
||||
foreach (i, ref e; clone) {
|
||||
e = val[i].witClone;
|
||||
}
|
||||
|
||||
return clone.witList;
|
||||
}
|
||||
|
||||
pragma(inline, true)
|
||||
void witFree(T : Tuple!U, U...)(scope ref T val) {
|
||||
static foreach (F; T.tupleof) {
|
||||
__traits(child, val, F).witFree;
|
||||
}
|
||||
}
|
||||
pragma(inline, true)
|
||||
void witDrop(T : Tuple!U, U...)(scope ref T val) {
|
||||
static foreach (F; T.tupleof) {
|
||||
__traits(child, val, F).witDrop;
|
||||
}
|
||||
}
|
||||
pragma(inline, true)
|
||||
T witClone(T : Tuple!U, U...)(in T val) {
|
||||
T clone = void;
|
||||
static foreach (F; T.tupleof) {
|
||||
__traits(child, clone, F) = __traits(child, val, F).witClone;
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
|
||||
pragma(inline, true)
|
||||
void witFree(T, size_t L)(scope ref T[L] val) {
|
||||
foreach (ref e; val) {
|
||||
e.witFree;
|
||||
}
|
||||
}
|
||||
pragma(inline, true)
|
||||
void witDrop(T, size_t L)(scope ref T[L] val) {
|
||||
foreach (ref e; val) {
|
||||
e.witDrop;
|
||||
}
|
||||
}
|
||||
pragma(inline, true)
|
||||
T[L] witClone(T, size_t L)(in T[L] val) {
|
||||
T[L] clone;
|
||||
foreach (i, ref e; clone) {
|
||||
e = val[i].witClone;
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
package:
|
||||
|
||||
extern(C) @nogc nothrow {
|
||||
void* malloc(size_t size);
|
||||
void* realloc(void* ptr, size_t newSize);
|
||||
void free(void* ptr);
|
||||
noreturn abort();
|
||||
}
|
||||
|
||||
// from https://github.com/Inochi2D/numem/blob/main/source/numem/casting.d
|
||||
// Copyright © 2023-2025, Kitsunebi Games
|
||||
// Copyright © 2023-2025, Inochi2D Project
|
||||
// License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
||||
// Authors: Luna Nielsen
|
||||
pragma(inline, true)
|
||||
auto ref T reinterpretCast(T, U)(auto ref U from) @trusted if (T.sizeof == U.sizeof) {
|
||||
union tmp { U from; T to; }
|
||||
return tmp(from).to;
|
||||
}
|
||||
|
||||
pragma(inline, true)
|
||||
T[] mallocSlice(T)(size_t count) @nogc nothrow {
|
||||
if (count == 0) return [];
|
||||
auto ptr = malloc(count*T.sizeof);
|
||||
if (ptr is null) return [];
|
||||
|
||||
return (cast(T*)ptr)[0..count];
|
||||
}
|
||||
|
||||
// from std.meta
|
||||
alias AliasSeq(T...) = T;
|
||||
|
||||
template witInterfaceOf(alias Symbol) {
|
||||
alias udas = AliasSeq!();
|
||||
static foreach (uda; __traits(getAttributes, Symbol)) {
|
||||
static if (!is(uda) && is(typeof(uda) == witInterface)) {
|
||||
udas = AliasSeq!(udas, uda);
|
||||
}
|
||||
}
|
||||
|
||||
static assert(
|
||||
udas.length <= 1,
|
||||
"There must be at most one `@witInterface` attached. Found multiple on `",
|
||||
__traits(fullyQualifiedName, Symbol), "`.",
|
||||
);
|
||||
|
||||
static if (udas.length) {
|
||||
enum string witInterfaceOf = udas[0].name;
|
||||
} else {
|
||||
enum string witInterfaceOf = "";
|
||||
}
|
||||
}
|
||||
|
||||
alias toKebabCase = (string s) { // lambda to satisfy `betterC` (use of GC)
|
||||
if (s.length == 0) return "";
|
||||
|
||||
char[] buf;
|
||||
foreach (i, c; s) {
|
||||
if (i > 0 && c >= 'A' && c <= 'Z') {
|
||||
char prev = s[i - 1];
|
||||
char next = ((i + 1) < s.length) ? s[i + 1] : '\0';
|
||||
if (
|
||||
(prev >= 'a' && prev <= 'z') ||
|
||||
(
|
||||
next != '\0' &&
|
||||
prev >= 'A' && prev <= 'Z' &&
|
||||
!(next >= 'A' && next <= 'Z')
|
||||
)
|
||||
) {
|
||||
buf ~= '-';
|
||||
}
|
||||
}
|
||||
buf ~= (c >= 'A' && c <= 'Z') ? (c + 32) : c;
|
||||
}
|
||||
return cast(string)buf;
|
||||
};
|
||||
|
||||
template witNameOf(alias Symbol) {
|
||||
alias udas = AliasSeq!();
|
||||
static foreach (uda; __traits(getAttributes, Symbol)) {
|
||||
static if ((!is(uda) && is(typeof(uda) == witExport)) || is(uda == witExport)) {
|
||||
udas = AliasSeq!(udas, uda);
|
||||
}
|
||||
}
|
||||
|
||||
static assert(
|
||||
udas.length <= 1,
|
||||
"There must be at most one `@witExport` attached. Found multiple on `",
|
||||
__traits(fullyQualifiedName, Symbol), "`.",
|
||||
);
|
||||
|
||||
static if (udas.length) {
|
||||
static if (is(udas[0])) {
|
||||
enum string witNameOf = toKebabCase(__traits(identifier, Symbol));
|
||||
} else {
|
||||
static assert(
|
||||
udas[0].name.length,
|
||||
"Specifying an empty name for `@witExport(...)` is not allowed. Found empty on `",
|
||||
__traits(fullyQualifiedName, Symbol), "`. Omit the parenthesis and parameter",
|
||||
" (i.e. use as `@witExport`) or specify non-empty name.",
|
||||
);
|
||||
enum string witNameOf = udas[0].name;
|
||||
}
|
||||
} else {
|
||||
enum string witNameOf = "";
|
||||
}
|
||||
}
|
||||
|
||||
template witNameInResourceOf(T, alias Func) {
|
||||
enum resName = witNameOf!T;
|
||||
enum name = witNameOf!Func;
|
||||
|
||||
static if (name == "[constructor]") {
|
||||
enum witNameInResourceOf = "[constructor]" ~ resName;
|
||||
} else {
|
||||
enum witNameInResourceOf = (__traits(isStaticFunction, Func) ? "[static]" : "[method]") ~ resName ~ "." ~ name;
|
||||
}
|
||||
}
|
||||
|
||||
template findWitExportFunc(string mod, string name, Sig, Impl...) {
|
||||
static foreach(Func; Impl) {
|
||||
static if (witNameOf!Func == name && witInterfaceOf!Func == mod) {
|
||||
static assert(
|
||||
!is(Func) &&
|
||||
(is(typeof(Func) == function)),
|
||||
"The implementation of '", mod, "#", name, "' ",
|
||||
"`", __traits(fullyQualifiedName, findWitExportFunc), "` ",
|
||||
"must be a function or method."
|
||||
);
|
||||
|
||||
static assert(
|
||||
!is(typeof(findWitExportFunc) == void) || __traits(isSame, findWitExportFunc, Func),
|
||||
"There must be only one implementation of '", mod, "#", name, "'. ",
|
||||
"Found at least `", __traits(fullyQualifiedName, findWitExportFunc),
|
||||
"` and `", __traits(fullyQualifiedName, Func), "`."
|
||||
);
|
||||
alias findWitExportFunc = Func;
|
||||
}
|
||||
}
|
||||
|
||||
static assert(
|
||||
!is(typeof(findWitExportFunc) == void),
|
||||
"Could not find implementation for '", mod, "#", name, "'"
|
||||
);
|
||||
|
||||
static assert(
|
||||
__traits(isStaticFunction, findWitExportFunc),
|
||||
"The implementation of '", mod, "#", name, "' ",
|
||||
"`", __traits(fullyQualifiedName, findWitExportFunc), "` ",
|
||||
"must be static.",
|
||||
);
|
||||
|
||||
static assert(
|
||||
is(typeof(&findWitExportFunc) : Sig),
|
||||
"The implementation of '", mod, "#", name, "' ",
|
||||
"`", __traits(fullyQualifiedName, findWitExportFunc), "` ",
|
||||
"must conform to the necessary signature. ",
|
||||
"Found `", typeof(&findWitExportFunc), "`",
|
||||
", but expected `", Sig, "`"
|
||||
);
|
||||
}
|
||||
|
||||
template findWitExportMethod(T, string name, Sig, bool isStatic) {
|
||||
alias Impl = witExportsIn!T;
|
||||
|
||||
enum mod = witInterfaceOf!T;
|
||||
|
||||
static foreach(Func; Impl) {
|
||||
static if (witNameInResourceOf!(T, Func) == name) {
|
||||
static assert(
|
||||
!is(Func) &&
|
||||
(is(typeof(Func) == function)),
|
||||
"The implementation of '", mod, "#", name, "' ",
|
||||
"`", __traits(fullyQualifiedName, findWitExportMethod), "` ",
|
||||
"must be a function or method."
|
||||
);
|
||||
|
||||
static assert(
|
||||
!is(typeof(findWitExportMethod) == void) || __traits(isSame, findWitExportMethod, Func),
|
||||
"There must be only one implementation of '", mod, "#", name, "'. ",
|
||||
"Found at least `", __traits(fullyQualifiedName, findWitExportMethod),
|
||||
"` and `", __traits(fullyQualifiedName, Func), "`."
|
||||
);
|
||||
alias findWitExportMethod = Func;
|
||||
}
|
||||
}
|
||||
|
||||
static assert(
|
||||
!is(typeof(findWitExportMethod) == void),
|
||||
"Could not find implementation for '", mod, "#", name, "'"
|
||||
);
|
||||
|
||||
static assert(
|
||||
__traits(isStaticFunction, findWitExportMethod) == isStatic,
|
||||
"The implementation of '", mod, "#", name, "' ",
|
||||
"`", __traits(fullyQualifiedName, findWitExportMethod), "` ",
|
||||
"must " ~ (isSttic ? "be static" : "have implicit `this`") ~ ".",
|
||||
);
|
||||
|
||||
static assert(
|
||||
is(typeof(&findWitExportMethod) : Sig),
|
||||
"The implementation of '", mod, "#", name, "' ",
|
||||
"`", __traits(fullyQualifiedName, findWitExportMethod), "` ",
|
||||
"must conform to the necessary signature. ",
|
||||
"Found `", typeof(&findWitExportMethod), "`",
|
||||
", but expected `", Sig, "`"
|
||||
);
|
||||
}
|
||||
|
||||
template findWitExportResource(string mod, string name, Impl...) {
|
||||
static foreach(Resource; Impl) {
|
||||
static if (witNameOf!Resource == name && witInterfaceOf!Resource == mod) {
|
||||
static assert(
|
||||
is(Resource == struct),
|
||||
"The implementation of '", mod, "#", name, "' ",
|
||||
"`", __traits(fullyQualifiedName, findWitExportResource), "` ",
|
||||
"must be a struct."
|
||||
);
|
||||
|
||||
static assert(
|
||||
!is(typeof(findWitExportResource) == void) || __traits(isSame, findWitExportResource, Resource),
|
||||
"There must be only one implementation of '", mod, "#", name, "'. ",
|
||||
"Found at least `", __traits(fullyQualifiedName, findWitExportResource),
|
||||
"` and `", __traits(fullyQualifiedName, Resource), "`."
|
||||
);
|
||||
alias findWitExportResource = Resource;
|
||||
}
|
||||
}
|
||||
|
||||
static assert(
|
||||
!is(typeof(findWitExportResource) == void),
|
||||
"Could not find implementation for '", mod, "#", name, "'"
|
||||
);
|
||||
}
|
||||
|
||||
public template witExportsIn(T) {
|
||||
alias witExportsIn = AliasSeq!();
|
||||
|
||||
static foreach(member; __traits(allMembers, T)) {
|
||||
witExportsIn = AliasSeq!(witExportsIn, findWitExports!(__traits(getOverloads, T, member)));
|
||||
}
|
||||
}
|
||||
|
||||
public template findWitExports(Exports...) {
|
||||
alias findWitExports = AliasSeq!();
|
||||
|
||||
static foreach (elem; Exports) {
|
||||
static foreach(uda; __traits(getAttributes, elem)) {
|
||||
static if ((!is(uda) && is(typeof(uda) == witExport)) || is(uda == witExport)) {
|
||||
findWitExports = AliasSeq!(findWitExports, elem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct DeallocateBuffer {
|
||||
@nogc nothrow:
|
||||
struct Page {
|
||||
void*[32] slots;
|
||||
static assert(slots.length < 256);
|
||||
|
||||
ubyte cursor;
|
||||
Page* next;
|
||||
}
|
||||
|
||||
Page first;
|
||||
Page* head;
|
||||
|
||||
@disable this(this);
|
||||
|
||||
private void allocNewPage() {
|
||||
Page* page = cast(Page*)malloc(Page.sizeof);
|
||||
if (page is null) abort();
|
||||
|
||||
*page = Page.init;
|
||||
page.next = head;
|
||||
head = page;
|
||||
}
|
||||
|
||||
void opOpAssign(string op: "~")(void* ptr) {
|
||||
import core.builtins : unlikely;
|
||||
|
||||
if (unlikely(ptr is null)) return;
|
||||
if (/*unlikely?*/(head is null)) head = &first;
|
||||
|
||||
if (head.cursor >= head.slots.length) allocNewPage();
|
||||
|
||||
head.slots[head.cursor++] = ptr;
|
||||
}
|
||||
|
||||
void purge() {
|
||||
auto page = head;
|
||||
while (page) {
|
||||
foreach (ptr; page.slots[0..page.cursor]) free(ptr);
|
||||
|
||||
auto next = page.next;
|
||||
if (page != &first) free(page);
|
||||
page = next;
|
||||
}
|
||||
|
||||
first = Page.init;
|
||||
head = null;
|
||||
}
|
||||
|
||||
~this() {
|
||||
purge();
|
||||
}
|
||||
}
|
||||
|
||||
version (CRuntime_WASI) {
|
||||
version (WASIp1) {}
|
||||
else version = LibcDefinesCABIRealloc;
|
||||
}
|
||||
|
||||
version (LibcDefinesCABIRealloc) {}
|
||||
else
|
||||
@wasmExport!("cabi_realloc")
|
||||
void* cabi_realloc(void *ptr, size_t oldSize, size_t alignment, size_t newSize) {
|
||||
if (newSize == 0) return cast(void*)alignment;
|
||||
void *ret = realloc(ptr, newSize);
|
||||
if (!ret) abort();
|
||||
return ret;
|
||||
}
|
||||
73
src/wit/pumpkin/plugin/advancement/common.d
Normal file
73
src/wit/pumpkin/plugin/advancement/common.d
Normal file
@ -0,0 +1,73 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.advancement.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.text.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
Frame type for an advancement.
|
||||
+/
|
||||
enum FrameType : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
task,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
challenge,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
goal,
|
||||
}
|
||||
/++
|
||||
Represents progress of an advancement for a player.
|
||||
+/
|
||||
struct AdvancementProgress {
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString advancementId;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bool done;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitList!(WitString) awardedCriteria;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitList!(WitString) remainingCriteria;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
advancementId.witFree;
|
||||
awardedCriteria.witFree;
|
||||
remainingCriteria.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
AdvancementProgress witClone() const @nogc nothrow {
|
||||
AdvancementProgress clone = void;
|
||||
clone.advancementId = this.advancementId.witClone;
|
||||
clone.done = this.done.witClone;
|
||||
clone.awardedCriteria = this.awardedCriteria.witClone;
|
||||
clone.remainingCriteria = this.remainingCriteria.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
136
src/wit/pumpkin/plugin/advancement/imports.d
Normal file
136
src/wit/pumpkin/plugin/advancement/imports.d
Normal file
@ -0,0 +1,136 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.advancement.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.advancement.common;
|
||||
|
||||
static import wit.pumpkin.plugin.text.imports;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias TextComponent = wit.pumpkin.plugin.text.imports.TextComponent;
|
||||
|
||||
/++
|
||||
Display information for an advancement.
|
||||
+/
|
||||
struct AdvancementDisplay {
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent title;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent description;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
FrameType frame;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bool showToast;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bool hidden;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bool announceToChat;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(WitString) background;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
float x;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
float y;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
background.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
title.witDrop;
|
||||
description.witDrop;
|
||||
}
|
||||
|
||||
AdvancementDisplay witClone() const @nogc nothrow {
|
||||
AdvancementDisplay clone = void;
|
||||
clone.title = this.title.witClone;
|
||||
clone.description = this.description.witClone;
|
||||
clone.frame = this.frame.witClone;
|
||||
clone.showToast = this.showToast.witClone;
|
||||
clone.hidden = this.hidden.witClone;
|
||||
clone.announceToChat = this.announceToChat.witClone;
|
||||
clone.background = this.background.witClone;
|
||||
clone.x = this.x.witClone;
|
||||
clone.y = this.y.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Detailed information about an advancement.
|
||||
+/
|
||||
struct AdvancementInfo {
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString id;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(WitString) parentId;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitList!(WitString) criteria;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(AdvancementDisplay) display;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
id.witFree;
|
||||
parentId.witFree;
|
||||
criteria.witFree;
|
||||
display.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
display.witDrop;
|
||||
}
|
||||
|
||||
AdvancementInfo witClone() const @nogc nothrow {
|
||||
AdvancementInfo clone = void;
|
||||
clone.id = this.id.witClone;
|
||||
clone.parentId = this.parentId.witClone;
|
||||
clone.criteria = this.criteria.witClone;
|
||||
clone.display = this.display.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
268
src/wit/pumpkin/plugin/attributes/common.d
Normal file
268
src/wit/pumpkin/plugin/attributes/common.d
Normal file
@ -0,0 +1,268 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.attributes.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum Attribute : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
airDragModifier,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
armor,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
armorToughness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
attackDamage,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
attackKnockback,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
attackSpeed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
belowNameDistance,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockBreakSpeed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockInteractionRange,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bounciness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
burningTime,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cameraDistance,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
explosionKnockbackResistance,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
entityInteractionRange,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fallDamageMultiplier,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
flyingSpeed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
followRange,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
frictionModifier,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
gravity,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
jumpStrength,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
knockbackResistance,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
luck,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
maxAbsorption,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
maxHealth,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
miningEfficiency,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
movementEfficiency,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
movementSpeed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
nameTagDistance,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
oxygenBonus,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
safeFallDistance,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
scale,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sneakingSpeed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spawnReinforcements,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
stepHeight,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
submergedMiningSpeed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sweepingDamageRatio,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
temptRange,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
waterMovementEfficiency,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
waypointTransmitRange,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
waypointReceiveRange,
|
||||
}
|
||||
/++
|
||||
|
||||
+/
|
||||
enum ModifierOperation : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
add,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
multiplyBase,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
multiplyTotal,
|
||||
}
|
||||
/++
|
||||
|
||||
+/
|
||||
struct AttributeModifier {
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString id;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
double amount;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
ModifierOperation operation;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
id.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
AttributeModifier witClone() const @nogc nothrow {
|
||||
AttributeModifier clone = void;
|
||||
clone.id = this.id.witClone;
|
||||
clone.amount = this.amount.witClone;
|
||||
clone.operation = this.operation.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
12
src/wit/pumpkin/plugin/attributes/imports.d
Normal file
12
src/wit/pumpkin/plugin/attributes/imports.d
Normal file
@ -0,0 +1,12 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.attributes.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.attributes.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
12018
src/wit/pumpkin/plugin/bedrock_packets/common.d
Normal file
12018
src/wit/pumpkin/plugin/bedrock_packets/common.d
Normal file
File diff suppressed because it is too large
Load Diff
13
src/wit/pumpkin/plugin/bedrock_packets/imports.d
Normal file
13
src/wit/pumpkin/plugin/bedrock_packets/imports.d
Normal file
@ -0,0 +1,13 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.bedrock_packets.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.bedrock_packets.common;
|
||||
|
||||
static import wit.pumpkin.plugin.uuid.imports;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
345
src/wit/pumpkin/plugin/biomes/common.d
Normal file
345
src/wit/pumpkin/plugin/biomes/common.d
Normal file
@ -0,0 +1,345 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.biomes.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum Biome : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
badlands,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bambooJungle,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
basaltDeltas,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
beach,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
birchForest,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cherryGrove,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
coldOcean,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
crimsonForest,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
darkForest,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
deepColdOcean,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
deepDark,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
deepFrozenOcean,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
deepLukewarmOcean,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
deepOcean,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
desert,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
dripstoneCaves,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
endBarrens,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
endHighlands,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
endMidlands,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
erodedBadlands,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
flowerForest,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
forest,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
frozenOcean,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
frozenPeaks,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
frozenRiver,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
grove,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
iceSpikes,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
jaggedPeaks,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
jungle,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lukewarmOcean,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lushCaves,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mangroveSwamp,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
meadow,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mushroomFields,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
netherWastes,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
ocean,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
oldGrowthBirchForest,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
oldGrowthPineTaiga,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
oldGrowthSpruceTaiga,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
paleGarden,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
plains,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
river,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
savanna,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
savannaPlateau,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
smallEndIslands,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
snowyBeach,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
snowyPlains,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
snowySlopes,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
snowyTaiga,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
soulSandValley,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sparseJungle,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
stonyPeaks,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
stonyShore,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sulfurCaves,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sunflowerPlains,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
swamp,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
taiga,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
theEnd,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
theVoid,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
warmOcean,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
warpedForest,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
windsweptForest,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
windsweptGravellyHills,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
windsweptHills,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
windsweptSavanna,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
woodedBadlands,
|
||||
}
|
||||
12
src/wit/pumpkin/plugin/biomes/imports.d
Normal file
12
src/wit/pumpkin/plugin/biomes/imports.d
Normal file
@ -0,0 +1,12 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.biomes.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.biomes.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
142
src/wit/pumpkin/plugin/block_entity/common.d
Normal file
142
src/wit/pumpkin/plugin/block_entity/common.d
Normal file
@ -0,0 +1,142 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.block_entity.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.common.common;
|
||||
static import wit.pumpkin.plugin.item_stack.common;
|
||||
static import wit.pumpkin.plugin.inventory.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias BlockPos = wit.pumpkin.plugin.common.common.BlockPos;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias NbtTree = wit.pumpkin.plugin.common.common.NbtTree;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum DyeColor : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
white,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
orange,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
magenta,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lightBlue,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
yellow,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lime,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
pink,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
gray,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lightGray,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cyan,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
purple,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blue,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
brown,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
green,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
red,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
black,
|
||||
}
|
||||
/++
|
||||
|
||||
+/
|
||||
struct SignText {
|
||||
/++
|
||||
|
||||
+/
|
||||
WitList!(WitString) messages;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
DyeColor color;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bool hasGlowingText;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
messages.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
SignText witClone() const @nogc nothrow {
|
||||
SignText clone = void;
|
||||
clone.messages = this.messages.witClone;
|
||||
clone.color = this.color.witClone;
|
||||
clone.hasGlowingText = this.hasGlowingText.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
5827
src/wit/pumpkin/plugin/block_entity/imports.d
Normal file
5827
src/wit/pumpkin/plugin/block_entity/imports.d
Normal file
File diff suppressed because it is too large
Load Diff
114
src/wit/pumpkin/plugin/boss_bar/common.d
Normal file
114
src/wit/pumpkin/plugin/boss_bar/common.d
Normal file
@ -0,0 +1,114 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.boss_bar.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.text.common;
|
||||
static import wit.pumpkin.plugin.player.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
Represents the color of a boss bar.
|
||||
+/
|
||||
enum BossBarColor : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
pink,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blue,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
red,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
green,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
yellow,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
purple,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
white,
|
||||
}
|
||||
/++
|
||||
Represents the notches/divisions of a boss bar.
|
||||
+/
|
||||
enum BossBarDivision : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
noDivision,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
notches6,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
notches10,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
notches12,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
notches20,
|
||||
}
|
||||
/++
|
||||
Metadata flags that can be toggled on a boss bar.
|
||||
+/
|
||||
struct BossBarMetadata {
|
||||
/++
|
||||
Darkens the sky for players who see the boss bar.
|
||||
+/
|
||||
bool darkenSky;
|
||||
|
||||
/++
|
||||
If true, the bar is considered a "dragon bar" (used for Ender Dragon).
|
||||
+/
|
||||
bool dragonBar;
|
||||
|
||||
/++
|
||||
If true, fog is created around the players who see the boss bar.
|
||||
+/
|
||||
bool createFog;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
BossBarMetadata witClone() const @nogc nothrow {
|
||||
BossBarMetadata clone = void;
|
||||
clone.darkenSky = this.darkenSky.witClone;
|
||||
clone.dragonBar = this.dragonBar.witClone;
|
||||
clone.createFog = this.createFog.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
253
src/wit/pumpkin/plugin/boss_bar/imports.d
Normal file
253
src/wit/pumpkin/plugin/boss_bar/imports.d
Normal file
@ -0,0 +1,253 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.boss_bar.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.boss_bar.common;
|
||||
|
||||
static import wit.pumpkin.plugin.text.imports;
|
||||
static import wit.pumpkin.plugin.player.imports;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias TextComponent = wit.pumpkin.plugin.text.imports.TextComponent;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias Player = wit.pumpkin.plugin.player.imports.Player;
|
||||
|
||||
/++
|
||||
Represents a boss bar that can be shown to players.
|
||||
+/
|
||||
struct BossBar {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
|
||||
/++
|
||||
Creates a new boss bar.
|
||||
+/
|
||||
static BossBar makeNew(TextComponent title, BossBarColor color, BossBarDivision division) @trusted nothrow {
|
||||
auto _ret = __import_makeNew(title.__handle, cast(uint)(color), cast(uint)(division));
|
||||
auto _handle0 = BossBar(_ret);
|
||||
return _handle0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/boss-bar@0.1.0", "[constructor]boss-bar")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__boss_bar@0.1.0__:constructor:boss_bar")
|
||||
static private extern(C) uint __import_makeNew(uint, uint, uint) nothrow;
|
||||
|
||||
pragma(inline, true) void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
@wasmImport!("pumpkin:plugin/boss-bar@0.1.0", "[resource-drop]boss-bar")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__boss_bar@0.1.0__:resource_drop:boss_bar")
|
||||
static private extern(C) void __import_drop(uint) @nogc nothrow;
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true) typeof(this) witClone() const @safe @nogc nothrow { return typeof(this)(__handle); }
|
||||
// TODO: make RAII? disable copy for the own
|
||||
|
||||
Borrow borrow() => Borrow(__handle);
|
||||
alias borrow this;
|
||||
|
||||
struct Borrow {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true)
|
||||
void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
pragma(inline, true) Borrow witClone() const @safe @nogc nothrow { return Borrow(__handle); }
|
||||
|
||||
/++
|
||||
Returns the title of this boss bar.
|
||||
+/
|
||||
TextComponent getTitle() @trusted nothrow {
|
||||
auto _ret = __import_getTitle(this.__handle);
|
||||
auto _handle0 = TextComponent(_ret);
|
||||
return _handle0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/boss-bar@0.1.0", "[method]boss-bar.get-title")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__boss_bar@0.1.0__:method:boss_bar.get_title")
|
||||
static private extern(C) uint __import_getTitle(uint) nothrow;
|
||||
|
||||
/++
|
||||
Sets the title of this boss bar.
|
||||
+/
|
||||
void setTitle(TextComponent title) @trusted nothrow {
|
||||
__import_setTitle(this.__handle, title.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/boss-bar@0.1.0", "[method]boss-bar.set-title")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__boss_bar@0.1.0__:method:boss_bar.set_title")
|
||||
static private extern(C) void __import_setTitle(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns the health (0.0 to 1.0) of this boss bar.
|
||||
+/
|
||||
float getHealth() @trusted nothrow {
|
||||
auto _ret = __import_getHealth(this.__handle);
|
||||
return _ret;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/boss-bar@0.1.0", "[method]boss-bar.get-health")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__boss_bar@0.1.0__:method:boss_bar.get_health")
|
||||
static private extern(C) float __import_getHealth(uint) nothrow;
|
||||
|
||||
/++
|
||||
Sets the health (0.0 to 1.0) of this boss bar.
|
||||
+/
|
||||
void setHealth(float health) @trusted nothrow {
|
||||
__import_setHealth(this.__handle, health);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/boss-bar@0.1.0", "[method]boss-bar.set-health")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__boss_bar@0.1.0__:method:boss_bar.set_health")
|
||||
static private extern(C) void __import_setHealth(uint, float) nothrow;
|
||||
|
||||
/++
|
||||
Returns the color of this boss bar.
|
||||
+/
|
||||
BossBarColor getColor() @trusted nothrow {
|
||||
auto _ret = __import_getColor(this.__handle);
|
||||
return cast(BossBarColor)(_ret);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/boss-bar@0.1.0", "[method]boss-bar.get-color")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__boss_bar@0.1.0__:method:boss_bar.get_color")
|
||||
static private extern(C) uint __import_getColor(uint) nothrow;
|
||||
|
||||
/++
|
||||
Sets the color of this boss bar.
|
||||
+/
|
||||
void setColor(BossBarColor color) @trusted nothrow {
|
||||
__import_setColor(this.__handle, cast(uint)(color));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/boss-bar@0.1.0", "[method]boss-bar.set-color")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__boss_bar@0.1.0__:method:boss_bar.set_color")
|
||||
static private extern(C) void __import_setColor(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns the division of this boss bar.
|
||||
+/
|
||||
BossBarDivision getDivision() @trusted nothrow {
|
||||
auto _ret = __import_getDivision(this.__handle);
|
||||
return cast(BossBarDivision)(_ret);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/boss-bar@0.1.0", "[method]boss-bar.get-division")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__boss_bar@0.1.0__:method:boss_bar.get_division")
|
||||
static private extern(C) uint __import_getDivision(uint) nothrow;
|
||||
|
||||
/++
|
||||
Sets the division of this boss bar.
|
||||
+/
|
||||
void setDivision(BossBarDivision division) @trusted nothrow {
|
||||
__import_setDivision(this.__handle, cast(uint)(division));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/boss-bar@0.1.0", "[method]boss-bar.set-division")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__boss_bar@0.1.0__:method:boss_bar.set_division")
|
||||
static private extern(C) void __import_setDivision(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns the currently active metadata on this boss bar.
|
||||
+/
|
||||
BossBarMetadata getMetadata() @trusted nothrow {
|
||||
align(1) void[3] _retArea = void;
|
||||
__import_getMetadata(this.__handle, _retArea.ptr);
|
||||
BossBarMetadata _record0 = {
|
||||
darkenSky: (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0,
|
||||
dragonBar: (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 1)))) != 0,
|
||||
createFog: (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 2)))) != 0,
|
||||
};
|
||||
auto _flush1 = _record0;
|
||||
return _flush1;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/boss-bar@0.1.0", "[method]boss-bar.get-metadata")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__boss_bar@0.1.0__:method:boss_bar.get_metadata")
|
||||
static private extern(C) void __import_getMetadata(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Updates the metadata on this boss bar.
|
||||
+/
|
||||
void setMetadata(in BossBarMetadata metadata) @trusted nothrow {
|
||||
__import_setMetadata(this.__handle, cast(uint)(metadata.darkenSky), cast(uint)(metadata.dragonBar), cast(uint)(metadata.createFog));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/boss-bar@0.1.0", "[method]boss-bar.set-metadata")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__boss_bar@0.1.0__:method:boss_bar.set_metadata")
|
||||
static private extern(C) void __import_setMetadata(uint, uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Adds a player to this boss bar, making it visible to them.
|
||||
+/
|
||||
void addPlayer(Player player) @trusted nothrow {
|
||||
__import_addPlayer(this.__handle, player.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/boss-bar@0.1.0", "[method]boss-bar.add-player")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__boss_bar@0.1.0__:method:boss_bar.add_player")
|
||||
static private extern(C) void __import_addPlayer(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Removes a player from this boss bar, hiding it from them.
|
||||
+/
|
||||
void removePlayer(Player player) @trusted nothrow {
|
||||
__import_removePlayer(this.__handle, player.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/boss-bar@0.1.0", "[method]boss-bar.remove-player")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__boss_bar@0.1.0__:method:boss_bar.remove_player")
|
||||
static private extern(C) void __import_removePlayer(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns a list of all players currently seeing this boss bar.
|
||||
+/
|
||||
WitList!(Player) getPlayers() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_getPlayers(this.__handle, _retArea.ptr);
|
||||
auto _len0 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _ptr0 = _len0 ? cast(Player*)(*(cast(void**)(_retArea.ptr + 0))) : null;
|
||||
auto _list1 = WitList!(Player)(_ptr0[0.._len0]);
|
||||
auto _flush2 = _list1;
|
||||
return _flush2;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/boss-bar@0.1.0", "[method]boss-bar.get-players")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__boss_bar@0.1.0__:method:boss_bar.get_players")
|
||||
static private extern(C) void __import_getPlayers(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Removes this boss bar from all players and cleans it up.
|
||||
+/
|
||||
void removeAll() @trusted nothrow {
|
||||
__import_removeAll(this.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/boss-bar@0.1.0", "[method]boss-bar.remove-all")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__boss_bar@0.1.0__:method:boss_bar.remove_all")
|
||||
static private extern(C) void __import_removeAll(uint) nothrow;
|
||||
}
|
||||
}
|
||||
1261
src/wit/pumpkin/plugin/command/common.d
Normal file
1261
src/wit/pumpkin/plugin/command/common.d
Normal file
File diff suppressed because it is too large
Load Diff
2272
src/wit/pumpkin/plugin/command/imports.d
Normal file
2272
src/wit/pumpkin/plugin/command/imports.d
Normal file
File diff suppressed because it is too large
Load Diff
1324
src/wit/pumpkin/plugin/common/common.d
Normal file
1324
src/wit/pumpkin/plugin/common/common.d
Normal file
File diff suppressed because it is too large
Load Diff
12
src/wit/pumpkin/plugin/common/imports.d
Normal file
12
src/wit/pumpkin/plugin/common/imports.d
Normal file
@ -0,0 +1,12 @@
|
||||
/++
|
||||
Provides common types and utilities used across the entire plugin API.
|
||||
+/
|
||||
module wit.pumpkin.plugin.common.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.common.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
111
src/wit/pumpkin/plugin/context/common.d
Normal file
111
src/wit/pumpkin/plugin/context/common.d
Normal file
@ -0,0 +1,111 @@
|
||||
/++
|
||||
The core context provided to a plugin during initialization and event handling.
|
||||
+/
|
||||
module wit.pumpkin.plugin.context.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.permission.common;
|
||||
static import wit.pumpkin.plugin.event.common;
|
||||
static import wit.pumpkin.plugin.server.common;
|
||||
static import wit.pumpkin.plugin.command.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias EventType = wit.pumpkin.plugin.event.common.EventType;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias EventPriority = wit.pumpkin.plugin.event.common.EventPriority;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias Permission = wit.pumpkin.plugin.permission.common.Permission;
|
||||
|
||||
/++
|
||||
Verified marketplace metadata for signed plugins.
|
||||
+/
|
||||
struct MarketplaceMetadata {
|
||||
/++
|
||||
The marketplace base URL where this plugin is registered.
|
||||
+/
|
||||
WitString marketplaceUrl;
|
||||
|
||||
/++
|
||||
The unique plugin ID on the marketplace.
|
||||
+/
|
||||
long pluginId;
|
||||
|
||||
/++
|
||||
The canonical plugin name.
|
||||
+/
|
||||
WitString pluginName;
|
||||
|
||||
/++
|
||||
The semver version string of the plugin.
|
||||
+/
|
||||
WitString version_;
|
||||
|
||||
/++
|
||||
Developer ID.
|
||||
+/
|
||||
long devId;
|
||||
|
||||
/++
|
||||
Developer display name or username.
|
||||
+/
|
||||
WitString devName;
|
||||
|
||||
/++
|
||||
Whether this is a paid marketplace plugin.
|
||||
+/
|
||||
bool isPaid;
|
||||
|
||||
/++
|
||||
The buyer / licensee user ID (0 for free/open-source).
|
||||
+/
|
||||
long userId;
|
||||
|
||||
/++
|
||||
Unique license key issued to the buyer, if paid.
|
||||
+/
|
||||
Option!(WitString) licenseKey;
|
||||
|
||||
/++
|
||||
ISO-8601 timestamp of when this binary/license was issued.
|
||||
+/
|
||||
WitString issuedAt;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
marketplaceUrl.witFree;
|
||||
pluginName.witFree;
|
||||
version_.witFree;
|
||||
devName.witFree;
|
||||
licenseKey.witFree;
|
||||
issuedAt.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
MarketplaceMetadata witClone() const @nogc nothrow {
|
||||
MarketplaceMetadata clone = void;
|
||||
clone.marketplaceUrl = this.marketplaceUrl.witClone;
|
||||
clone.pluginId = this.pluginId.witClone;
|
||||
clone.pluginName = this.pluginName.witClone;
|
||||
clone.version_ = this.version_.witClone;
|
||||
clone.devId = this.devId.witClone;
|
||||
clone.devName = this.devName.witClone;
|
||||
clone.isPaid = this.isPaid.witClone;
|
||||
clone.userId = this.userId.witClone;
|
||||
clone.licenseKey = this.licenseKey.witClone;
|
||||
clone.issuedAt = this.issuedAt.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
249
src/wit/pumpkin/plugin/context/imports.d
Normal file
249
src/wit/pumpkin/plugin/context/imports.d
Normal file
@ -0,0 +1,249 @@
|
||||
/++
|
||||
The core context provided to a plugin during initialization and event handling.
|
||||
+/
|
||||
module wit.pumpkin.plugin.context.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.context.common;
|
||||
|
||||
static import wit.pumpkin.plugin.permission.imports;
|
||||
static import wit.pumpkin.plugin.event.imports;
|
||||
static import wit.pumpkin.plugin.server.imports;
|
||||
static import wit.pumpkin.plugin.command.imports;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias Server = wit.pumpkin.plugin.server.imports.Server;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias Command = wit.pumpkin.plugin.command.imports.Command;
|
||||
|
||||
/++
|
||||
A contextual handle for plugin-related operations.
|
||||
+/
|
||||
struct Context {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
|
||||
pragma(inline, true) void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
@wasmImport!("pumpkin:plugin/context@0.1.0", "[resource-drop]context")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__context@0.1.0__:resource_drop:context")
|
||||
static private extern(C) void __import_drop(uint) @nogc nothrow;
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true) typeof(this) witClone() const @safe @nogc nothrow { return typeof(this)(__handle); }
|
||||
// TODO: make RAII? disable copy for the own
|
||||
|
||||
Borrow borrow() => Borrow(__handle);
|
||||
alias borrow this;
|
||||
|
||||
struct Borrow {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true)
|
||||
void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
pragma(inline, true) Borrow witClone() const @safe @nogc nothrow { return Borrow(__handle); }
|
||||
|
||||
/++
|
||||
Registers a handler for a specific event.
|
||||
|
||||
* `handler-id`: Unique ID for the event handler.
|
||||
* `event-type`: The type of event to listen for.
|
||||
* `event-priority`: When this handler should be called relative to others.
|
||||
* `blocking`: Whether the event should wait for this handler to finish.
|
||||
+/
|
||||
void registerEvent(uint handlerId, EventType eventType, EventPriority eventPriority, bool blocking) @trusted nothrow {
|
||||
__import_registerEvent(this.__handle, handlerId, cast(uint)(eventType), cast(uint)(eventPriority), cast(uint)(blocking));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/context@0.1.0", "[method]context.register-event")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__context@0.1.0__:method:context.register_event")
|
||||
static private extern(C) void __import_registerEvent(uint, uint, uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Registers a new command.
|
||||
|
||||
* `command`: The command definition.
|
||||
* `permission`: The required permission node to execute this command.
|
||||
+/
|
||||
void registerCommand(Command command, in WitString permission) @trusted nothrow {
|
||||
__import_registerCommand(this.__handle, command.__handle, cast(void*)(permission.ptr), permission.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/context@0.1.0", "[method]context.register-command")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__context@0.1.0__:method:context.register_command")
|
||||
static private extern(C) void __import_registerCommand(uint, uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Registers a permission node with the server.
|
||||
+/
|
||||
Result!(void, WitString) registerPermission(in Permission permission) @trusted nothrow {
|
||||
align(size_t.sizeof) void[(3*size_t.sizeof)] _retArea = void;
|
||||
wit.common.DeallocateBuffer deallocate;
|
||||
uint _variantPart6 = void;
|
||||
uint _variantPart7 = void;
|
||||
alias _Tag8 = wit.pumpkin.plugin.permission.imports.PermissionDefault.Tag;
|
||||
final switch (permission.default_.tag) {
|
||||
case _Tag8.deny: {
|
||||
_variantPart6 = 0;
|
||||
_variantPart7 = 0;
|
||||
break;
|
||||
}
|
||||
case _Tag8.allow: {
|
||||
_variantPart6 = 1;
|
||||
_variantPart7 = 0;
|
||||
break;
|
||||
}
|
||||
case _Tag8.op: {
|
||||
const ref wit.pumpkin.plugin.permission.imports.PermissionLevel _payload5 = permission.default_.getOp();
|
||||
_variantPart6 = 2;
|
||||
_variantPart7 = cast(uint)(_payload5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
auto _listSrc10 = permission.children;
|
||||
auto _list10 = _listSrc10.length ? wit.common.malloc(_listSrc10.length * ((3*size_t.sizeof))) : null;
|
||||
assert(!_listSrc10.length || _list10);
|
||||
if (_listSrc10.length) deallocate ~= _list10;
|
||||
foreach (_elem9_idx, ref _elem9; _listSrc10) {
|
||||
auto _base9 = _list10 + _elem9_idx * ((3*size_t.sizeof));
|
||||
*cast(size_t*)(_base9 + size_t.sizeof) = cast(size_t)(_elem9.node.length);
|
||||
*cast(void**)(_base9 + 0) = cast(void*)(cast(void*)(_elem9.node.ptr));
|
||||
*cast(ubyte*)(_base9 + (2*size_t.sizeof)) = cast(ubyte)(cast(uint)(_elem9.value));
|
||||
|
||||
}
|
||||
__import_registerPermission(this.__handle, cast(void*)(permission.node.ptr), permission.node.length, cast(void*)(permission.description.ptr), permission.description.length, _variantPart6, _variantPart7, _list10, permission.children.length, _retArea.ptr);
|
||||
deallocate.purge();
|
||||
Result!(void, WitString) _result15 = void;
|
||||
bool _isErr15 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isErr15) {
|
||||
auto _len13 = *(cast(size_t*)(_retArea.ptr + (2*size_t.sizeof)));
|
||||
auto _ptr13 = _len13 ? cast(char*)(*(cast(void**)(_retArea.ptr + size_t.sizeof))) : null;
|
||||
auto _list14 = WitString(_ptr13[0.._len13]);
|
||||
|
||||
_result15 = Result!(void, WitString).makeErr(_list14);
|
||||
} else {
|
||||
|
||||
_result15 = Result!(void, WitString).makeOk();
|
||||
}
|
||||
auto _flush16 = _result15;
|
||||
return _flush16;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/context@0.1.0", "[method]context.register-permission")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__context@0.1.0__:method:context.register_permission")
|
||||
static private extern(C) void __import_registerPermission(uint, void*, size_t, void*, size_t, uint, uint, void*, size_t, void*) nothrow;
|
||||
|
||||
/++
|
||||
Returns the path to the plugin's private data folder.
|
||||
+/
|
||||
WitString getDataFolder() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_getDataFolder(this.__handle, _retArea.ptr);
|
||||
auto _len0 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _ptr0 = _len0 ? cast(char*)(*(cast(void**)(_retArea.ptr + 0))) : null;
|
||||
auto _list1 = WitString(_ptr0[0.._len0]);
|
||||
auto _flush2 = _list1;
|
||||
return _flush2;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/context@0.1.0", "[method]context.get-data-folder")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__context@0.1.0__:method:context.get_data_folder")
|
||||
static private extern(C) void __import_getDataFolder(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Returns the global server instance.
|
||||
+/
|
||||
Server getServer() @trusted nothrow {
|
||||
auto _ret = __import_getServer(this.__handle);
|
||||
auto _handle0 = Server(_ret);
|
||||
return _handle0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/context@0.1.0", "[method]context.get-server")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__context@0.1.0__:method:context.get_server")
|
||||
static private extern(C) uint __import_getServer(uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns verified marketplace metadata if this plugin binary is signed, or none if unsigned.
|
||||
+/
|
||||
Option!(MarketplaceMetadata) getMarketplaceMetadata() @trusted nothrow {
|
||||
align(8) void[(48+12*size_t.sizeof)] _retArea = void;
|
||||
__import_getMarketplaceMetadata(this.__handle, _retArea.ptr);
|
||||
Option!(MarketplaceMetadata) _option18 = void;
|
||||
bool _isSome18 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome18) {
|
||||
auto _len2 = *(cast(size_t*)(_retArea.ptr + (8+1*size_t.sizeof)));
|
||||
auto _ptr2 = _len2 ? cast(char*)(*(cast(void**)(_retArea.ptr + 8))) : null;
|
||||
auto _list3 = WitString(_ptr2[0.._len2]);
|
||||
auto _len4 = *(cast(size_t*)(_retArea.ptr + (16+3*size_t.sizeof)));
|
||||
auto _ptr4 = _len4 ? cast(char*)(*(cast(void**)(_retArea.ptr + (16+2*size_t.sizeof)))) : null;
|
||||
auto _list5 = WitString(_ptr4[0.._len4]);
|
||||
auto _len6 = *(cast(size_t*)(_retArea.ptr + (16+5*size_t.sizeof)));
|
||||
auto _ptr6 = _len6 ? cast(char*)(*(cast(void**)(_retArea.ptr + (16+4*size_t.sizeof)))) : null;
|
||||
auto _list7 = WitString(_ptr6[0.._len6]);
|
||||
auto _len8 = *(cast(size_t*)(_retArea.ptr + (24+7*size_t.sizeof)));
|
||||
auto _ptr8 = _len8 ? cast(char*)(*(cast(void**)(_retArea.ptr + (24+6*size_t.sizeof)))) : null;
|
||||
auto _list9 = WitString(_ptr8[0.._len8]);
|
||||
Option!(WitString) _option14 = void;
|
||||
bool _isSome14 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + (40+8*size_t.sizeof))))) != 0;
|
||||
if (_isSome14) {
|
||||
auto _len12 = *(cast(size_t*)(_retArea.ptr + (40+10*size_t.sizeof)));
|
||||
auto _ptr12 = _len12 ? cast(char*)(*(cast(void**)(_retArea.ptr + (40+9*size_t.sizeof)))) : null;
|
||||
auto _list13 = WitString(_ptr12[0.._len12]);
|
||||
|
||||
_option14 = Option!(WitString).makeSome(_list13);
|
||||
} else {
|
||||
_option14 = Option!(WitString).makeNone;
|
||||
}
|
||||
auto _len15 = *(cast(size_t*)(_retArea.ptr + (40+12*size_t.sizeof)));
|
||||
auto _ptr15 = _len15 ? cast(char*)(*(cast(void**)(_retArea.ptr + (40+11*size_t.sizeof)))) : null;
|
||||
auto _list16 = WitString(_ptr15[0.._len15]);
|
||||
MarketplaceMetadata _record17 = {
|
||||
marketplaceUrl: _list3,
|
||||
pluginId: cast(long)(*(cast(ulong*)(_retArea.ptr + (8+2*size_t.sizeof)))),
|
||||
pluginName: _list5,
|
||||
version_: _list7,
|
||||
devId: cast(long)(*(cast(ulong*)(_retArea.ptr + (16+6*size_t.sizeof)))),
|
||||
devName: _list9,
|
||||
isPaid: (cast(uint)(*(cast(ubyte*)(_retArea.ptr + (24+8*size_t.sizeof))))) != 0,
|
||||
userId: cast(long)(*(cast(ulong*)(_retArea.ptr + (32+8*size_t.sizeof)))),
|
||||
licenseKey: _option14,
|
||||
issuedAt: _list16,
|
||||
};
|
||||
|
||||
_option18 = Option!(MarketplaceMetadata).makeSome(_record17);
|
||||
} else {
|
||||
_option18 = Option!(MarketplaceMetadata).makeNone;
|
||||
}
|
||||
auto _flush19 = _option18;
|
||||
return _flush19;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/context@0.1.0", "[method]context.get-marketplace-metadata")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__context@0.1.0__:method:context.get_marketplace_metadata")
|
||||
static private extern(C) void __import_getMarketplaceMetadata(uint, void*) nothrow;
|
||||
}
|
||||
}
|
||||
270
src/wit/pumpkin/plugin/damage_types/common.d
Normal file
270
src/wit/pumpkin/plugin/damage_types/common.d
Normal file
@ -0,0 +1,270 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.damage_types.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum DamageType : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
arrow,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
badRespawnPoint,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cactus,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
campfire,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cramming,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
dragonBreath,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
drown,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
dryOut,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enderPearl,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
explosion,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fall,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fallingAnvil,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fallingBlock,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fallingStalactite,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fireball,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fireworks,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
flyIntoWall,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
freeze,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
generic,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
genericKill,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
hotFloor,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
inFire,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
inWall,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
indirectMagic,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lava,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lightningBolt,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
maceSmash,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
magic,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mobAttack,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mobAttackNoAggro,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mobProjectile,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
onFire,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
outOfWorld,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
outsideBorder,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
playerAttack,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
playerExplosion,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sonicBoom,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spear,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spit,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
stalagmite,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
starve,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sting,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sulfurCubeHot,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sweetBerryBush,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
thorns,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
thrown,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
trident,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
unattributedFireball,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
windCharge,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
wither,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
witherSkull,
|
||||
}
|
||||
12
src/wit/pumpkin/plugin/damage_types/imports.d
Normal file
12
src/wit/pumpkin/plugin/damage_types/imports.d
Normal file
@ -0,0 +1,12 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.damage_types.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.damage_types.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
570
src/wit/pumpkin/plugin/data_components/common.d
Normal file
570
src/wit/pumpkin/plugin/data_components/common.d
Normal file
@ -0,0 +1,570 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.data_components.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum DataComponent : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
customData,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
maxStackSize,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
maxDamage,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
damage,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
unbreakable,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
useEffects,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
customName,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
minimumAttackCharge,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
damageType,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
itemName,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
itemModel,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lore,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
rarity,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enchantments,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
canPlaceOn,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
canBreak,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
attributeModifiers,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
customModelData,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tooltipDisplay,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
repairCost,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
creativeSlotLock,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enchantmentGlintOverride,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
intangibleProjectile,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
food,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
consumable,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
useRemainder,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
useCooldown,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
damageResistant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tool,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
weapon,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
attackRange,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enchantable,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
equippable,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
repairable,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
glider,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tooltipStyle,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
deathProtection,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blocksAttacks,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
piercingWeapon,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
kineticWeapon,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
swingAnimation,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
additionalTradeCost,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
storedEnchantments,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
dye,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
dyedColor,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mapColor,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mapId,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mapDecorations,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mapPostProcessing,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
chargedProjectiles,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bundleContents,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
potionContents,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
potionDurationScale,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
suspiciousStewEffects,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
writableBookContent,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
writtenBookContent,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
trim,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
debugStickState,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
entityData,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bucketEntityData,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockEntityData,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
instrument,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
providesTrimMaterial,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
ominousBottleAmplifier,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
jukeboxPlayable,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
providesBannerPatterns,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
recipes,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lodestoneTracker,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fireworkExplosion,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fireworks,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
profile,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
noteBlockSound,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bannerPatterns,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
baseColor,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
potDecorations,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
container,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockState,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bees,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sulfurCubeContent,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lock,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
containerLoot,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
breakSound,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
villagerVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
wolfVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
wolfSoundVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
wolfCollar,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
foxVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
salmonSize,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
parrotVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tropicalFishPattern,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tropicalFishBaseColor,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tropicalFishPatternColor,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mooshroomVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
rabbitVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
pigVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
pigSoundVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cowVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cowSoundVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
chickenVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
chickenSoundVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
zombieNautilusVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
frogVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
horseVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
paintingVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
llamaVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
axolotlVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
catVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
catSoundVariant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
catCollar,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sheepColor,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
shulkerColor,
|
||||
}
|
||||
12
src/wit/pumpkin/plugin/data_components/imports.d
Normal file
12
src/wit/pumpkin/plugin/data_components/imports.d
Normal file
@ -0,0 +1,12 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.data_components.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.data_components.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
159
src/wit/pumpkin/plugin/datapack/common.d
Normal file
159
src/wit/pumpkin/plugin/datapack/common.d
Normal file
@ -0,0 +1,159 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.datapack.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
Information about a discovered or loaded datapack.
|
||||
+/
|
||||
struct DatapackInfo {
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString id;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString name;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString description;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
uint packFormat;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bool isEnabled;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
uint recipeCount;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
uint functionCount;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
id.witFree;
|
||||
name.witFree;
|
||||
description.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
DatapackInfo witClone() const @nogc nothrow {
|
||||
DatapackInfo clone = void;
|
||||
clone.id = this.id.witClone;
|
||||
clone.name = this.name.witClone;
|
||||
clone.description = this.description.witClone;
|
||||
clone.packFormat = this.packFormat.witClone;
|
||||
clone.isEnabled = this.isEnabled.witClone;
|
||||
clone.recipeCount = this.recipeCount.witClone;
|
||||
clone.functionCount = this.functionCount.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Position options for enabling a datapack relative to other packs.
|
||||
+/
|
||||
struct EnablePosition {
|
||||
mixin WitVariant!(
|
||||
void, // first
|
||||
void, // last
|
||||
WitString, // before
|
||||
WitString, // after
|
||||
);
|
||||
|
||||
public:
|
||||
enum Tag : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
first,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
last,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
before,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
after,
|
||||
}
|
||||
pragma(inline, true) Tag tag() const @safe @nogc nothrow pure => _tag;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias first = _create!(Tag.first);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isFirst() const => _tag == Tag.first;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias last = _create!(Tag.last);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isLast() const => _tag == Tag.last;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias before = _create!(Tag.before);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isBefore() const => _tag == Tag.before;
|
||||
///ditto
|
||||
alias getBefore = _get!(Tag.before);
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias after = _create!(Tag.after);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isAfter() const => _tag == Tag.after;
|
||||
///ditto
|
||||
alias getAfter = _get!(Tag.after);
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
switch (_tag) with (Tag) {
|
||||
case before: _get!(Tag.before).witFree; break;
|
||||
case after: _get!(Tag.after).witFree; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
EnablePosition witClone() const @nogc nothrow {
|
||||
final switch (_tag) {
|
||||
case Tag.first: return _create!(Tag.first); break;
|
||||
case Tag.last: return _create!(Tag.last); break;
|
||||
case Tag.before: return _create!(Tag.before)(this._get!(Tag.before).witClone); break;
|
||||
case Tag.after: return _create!(Tag.after)(this._get!(Tag.after).witClone); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
371
src/wit/pumpkin/plugin/datapack/imports.d
Normal file
371
src/wit/pumpkin/plugin/datapack/imports.d
Normal file
@ -0,0 +1,371 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.datapack.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.datapack.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
Global manager for inspecting and controlling server datapacks.
|
||||
+/
|
||||
struct DatapackManager {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
|
||||
pragma(inline, true) void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
@wasmImport!("pumpkin:plugin/datapack@0.1.0", "[resource-drop]datapack-manager")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__datapack@0.1.0__:resource_drop:datapack_manager")
|
||||
static private extern(C) void __import_drop(uint) @nogc nothrow;
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true) typeof(this) witClone() const @safe @nogc nothrow { return typeof(this)(__handle); }
|
||||
// TODO: make RAII? disable copy for the own
|
||||
|
||||
Borrow borrow() => Borrow(__handle);
|
||||
alias borrow this;
|
||||
|
||||
struct Borrow {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true)
|
||||
void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
pragma(inline, true) Borrow witClone() const @safe @nogc nothrow { return Borrow(__handle); }
|
||||
|
||||
/++
|
||||
Returns all known datapacks (both enabled and available/disabled).
|
||||
+/
|
||||
WitList!(DatapackInfo) listAllPacks() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_listAllPacks(this.__handle, _retArea.ptr);
|
||||
auto _listSrcPtr8 = *(cast(void**)(_retArea.ptr + 0));
|
||||
auto _listLen8 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _list8 = _listLen8 ? wit.common.mallocSlice!(DatapackInfo)(_listLen8) : [];
|
||||
assert(!_listLen8 || _list8.ptr);
|
||||
foreach (_elem0_idx, ref _elem0; _list8) {
|
||||
const auto _base0 = _listSrcPtr8 + _elem0_idx * (16+6*size_t.sizeof);
|
||||
auto _len1 = *(cast(size_t*)(_base0 + size_t.sizeof));
|
||||
auto _ptr1 = _len1 ? cast(char*)(*(cast(void**)(_base0 + 0))) : null;
|
||||
auto _list2 = WitString(_ptr1[0.._len1]);
|
||||
auto _len3 = *(cast(size_t*)(_base0 + (3*size_t.sizeof)));
|
||||
auto _ptr3 = _len3 ? cast(char*)(*(cast(void**)(_base0 + (2*size_t.sizeof)))) : null;
|
||||
auto _list4 = WitString(_ptr3[0.._len3]);
|
||||
auto _len5 = *(cast(size_t*)(_base0 + (5*size_t.sizeof)));
|
||||
auto _ptr5 = _len5 ? cast(char*)(*(cast(void**)(_base0 + (4*size_t.sizeof)))) : null;
|
||||
auto _list6 = WitString(_ptr5[0.._len5]);
|
||||
DatapackInfo _record7 = {
|
||||
id: _list2,
|
||||
name: _list4,
|
||||
description: _list6,
|
||||
packFormat: *(cast(uint*)(_base0 + (6*size_t.sizeof))),
|
||||
isEnabled: (cast(uint)(*(cast(ubyte*)(_base0 + (4+6*size_t.sizeof))))) != 0,
|
||||
recipeCount: *(cast(uint*)(_base0 + (8+6*size_t.sizeof))),
|
||||
functionCount: *(cast(uint*)(_base0 + (12+6*size_t.sizeof))),
|
||||
};
|
||||
_elem0 = _record7;
|
||||
}
|
||||
if (_listLen8) wit.common.free(_listSrcPtr8);
|
||||
auto _witList9 = WitList!(DatapackInfo)(_list8);
|
||||
auto _flush10 = _witList9;
|
||||
return _flush10;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/datapack@0.1.0", "[method]datapack-manager.list-all-packs")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__datapack@0.1.0__:method:datapack_manager.list_all_packs")
|
||||
static private extern(C) void __import_listAllPacks(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Returns only currently enabled datapacks.
|
||||
+/
|
||||
WitList!(DatapackInfo) listEnabledPacks() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_listEnabledPacks(this.__handle, _retArea.ptr);
|
||||
auto _listSrcPtr8 = *(cast(void**)(_retArea.ptr + 0));
|
||||
auto _listLen8 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _list8 = _listLen8 ? wit.common.mallocSlice!(DatapackInfo)(_listLen8) : [];
|
||||
assert(!_listLen8 || _list8.ptr);
|
||||
foreach (_elem0_idx, ref _elem0; _list8) {
|
||||
const auto _base0 = _listSrcPtr8 + _elem0_idx * (16+6*size_t.sizeof);
|
||||
auto _len1 = *(cast(size_t*)(_base0 + size_t.sizeof));
|
||||
auto _ptr1 = _len1 ? cast(char*)(*(cast(void**)(_base0 + 0))) : null;
|
||||
auto _list2 = WitString(_ptr1[0.._len1]);
|
||||
auto _len3 = *(cast(size_t*)(_base0 + (3*size_t.sizeof)));
|
||||
auto _ptr3 = _len3 ? cast(char*)(*(cast(void**)(_base0 + (2*size_t.sizeof)))) : null;
|
||||
auto _list4 = WitString(_ptr3[0.._len3]);
|
||||
auto _len5 = *(cast(size_t*)(_base0 + (5*size_t.sizeof)));
|
||||
auto _ptr5 = _len5 ? cast(char*)(*(cast(void**)(_base0 + (4*size_t.sizeof)))) : null;
|
||||
auto _list6 = WitString(_ptr5[0.._len5]);
|
||||
DatapackInfo _record7 = {
|
||||
id: _list2,
|
||||
name: _list4,
|
||||
description: _list6,
|
||||
packFormat: *(cast(uint*)(_base0 + (6*size_t.sizeof))),
|
||||
isEnabled: (cast(uint)(*(cast(ubyte*)(_base0 + (4+6*size_t.sizeof))))) != 0,
|
||||
recipeCount: *(cast(uint*)(_base0 + (8+6*size_t.sizeof))),
|
||||
functionCount: *(cast(uint*)(_base0 + (12+6*size_t.sizeof))),
|
||||
};
|
||||
_elem0 = _record7;
|
||||
}
|
||||
if (_listLen8) wit.common.free(_listSrcPtr8);
|
||||
auto _witList9 = WitList!(DatapackInfo)(_list8);
|
||||
auto _flush10 = _witList9;
|
||||
return _flush10;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/datapack@0.1.0", "[method]datapack-manager.list-enabled-packs")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__datapack@0.1.0__:method:datapack_manager.list_enabled_packs")
|
||||
static private extern(C) void __import_listEnabledPacks(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Returns available (disabled) datapacks.
|
||||
+/
|
||||
WitList!(DatapackInfo) listAvailablePacks() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_listAvailablePacks(this.__handle, _retArea.ptr);
|
||||
auto _listSrcPtr8 = *(cast(void**)(_retArea.ptr + 0));
|
||||
auto _listLen8 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _list8 = _listLen8 ? wit.common.mallocSlice!(DatapackInfo)(_listLen8) : [];
|
||||
assert(!_listLen8 || _list8.ptr);
|
||||
foreach (_elem0_idx, ref _elem0; _list8) {
|
||||
const auto _base0 = _listSrcPtr8 + _elem0_idx * (16+6*size_t.sizeof);
|
||||
auto _len1 = *(cast(size_t*)(_base0 + size_t.sizeof));
|
||||
auto _ptr1 = _len1 ? cast(char*)(*(cast(void**)(_base0 + 0))) : null;
|
||||
auto _list2 = WitString(_ptr1[0.._len1]);
|
||||
auto _len3 = *(cast(size_t*)(_base0 + (3*size_t.sizeof)));
|
||||
auto _ptr3 = _len3 ? cast(char*)(*(cast(void**)(_base0 + (2*size_t.sizeof)))) : null;
|
||||
auto _list4 = WitString(_ptr3[0.._len3]);
|
||||
auto _len5 = *(cast(size_t*)(_base0 + (5*size_t.sizeof)));
|
||||
auto _ptr5 = _len5 ? cast(char*)(*(cast(void**)(_base0 + (4*size_t.sizeof)))) : null;
|
||||
auto _list6 = WitString(_ptr5[0.._len5]);
|
||||
DatapackInfo _record7 = {
|
||||
id: _list2,
|
||||
name: _list4,
|
||||
description: _list6,
|
||||
packFormat: *(cast(uint*)(_base0 + (6*size_t.sizeof))),
|
||||
isEnabled: (cast(uint)(*(cast(ubyte*)(_base0 + (4+6*size_t.sizeof))))) != 0,
|
||||
recipeCount: *(cast(uint*)(_base0 + (8+6*size_t.sizeof))),
|
||||
functionCount: *(cast(uint*)(_base0 + (12+6*size_t.sizeof))),
|
||||
};
|
||||
_elem0 = _record7;
|
||||
}
|
||||
if (_listLen8) wit.common.free(_listSrcPtr8);
|
||||
auto _witList9 = WitList!(DatapackInfo)(_list8);
|
||||
auto _flush10 = _witList9;
|
||||
return _flush10;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/datapack@0.1.0", "[method]datapack-manager.list-available-packs")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__datapack@0.1.0__:method:datapack_manager.list_available_packs")
|
||||
static private extern(C) void __import_listAvailablePacks(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Retrieves details about a specific datapack by name or ID.
|
||||
+/
|
||||
Option!(DatapackInfo) getPack(in WitString name) @trusted nothrow {
|
||||
align(size_t.sizeof) void[(16+7*size_t.sizeof)] _retArea = void;
|
||||
__import_getPack(this.__handle, cast(void*)(name.ptr), name.length, _retArea.ptr);
|
||||
Option!(DatapackInfo) _option9 = void;
|
||||
bool _isSome9 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome9) {
|
||||
auto _len2 = *(cast(size_t*)(_retArea.ptr + (2*size_t.sizeof)));
|
||||
auto _ptr2 = _len2 ? cast(char*)(*(cast(void**)(_retArea.ptr + size_t.sizeof))) : null;
|
||||
auto _list3 = WitString(_ptr2[0.._len2]);
|
||||
auto _len4 = *(cast(size_t*)(_retArea.ptr + (4*size_t.sizeof)));
|
||||
auto _ptr4 = _len4 ? cast(char*)(*(cast(void**)(_retArea.ptr + (3*size_t.sizeof)))) : null;
|
||||
auto _list5 = WitString(_ptr4[0.._len4]);
|
||||
auto _len6 = *(cast(size_t*)(_retArea.ptr + (6*size_t.sizeof)));
|
||||
auto _ptr6 = _len6 ? cast(char*)(*(cast(void**)(_retArea.ptr + (5*size_t.sizeof)))) : null;
|
||||
auto _list7 = WitString(_ptr6[0.._len6]);
|
||||
DatapackInfo _record8 = {
|
||||
id: _list3,
|
||||
name: _list5,
|
||||
description: _list7,
|
||||
packFormat: *(cast(uint*)(_retArea.ptr + (7*size_t.sizeof))),
|
||||
isEnabled: (cast(uint)(*(cast(ubyte*)(_retArea.ptr + (4+7*size_t.sizeof))))) != 0,
|
||||
recipeCount: *(cast(uint*)(_retArea.ptr + (8+7*size_t.sizeof))),
|
||||
functionCount: *(cast(uint*)(_retArea.ptr + (12+7*size_t.sizeof))),
|
||||
};
|
||||
|
||||
_option9 = Option!(DatapackInfo).makeSome(_record8);
|
||||
} else {
|
||||
_option9 = Option!(DatapackInfo).makeNone;
|
||||
}
|
||||
auto _flush10 = _option9;
|
||||
return _flush10;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/datapack@0.1.0", "[method]datapack-manager.get-pack")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__datapack@0.1.0__:method:datapack_manager.get_pack")
|
||||
static private extern(C) void __import_getPack(uint, void*, size_t, void*) nothrow;
|
||||
|
||||
/++
|
||||
Checks if a datapack is currently enabled.
|
||||
+/
|
||||
bool isEnabled(in WitString name) @trusted nothrow {
|
||||
auto _ret = __import_isEnabled(this.__handle, cast(void*)(name.ptr), name.length);
|
||||
return (_ret) != 0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/datapack@0.1.0", "[method]datapack-manager.is-enabled")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__datapack@0.1.0__:method:datapack_manager.is_enabled")
|
||||
static private extern(C) uint __import_isEnabled(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Enables a datapack with a specific priority position.
|
||||
+/
|
||||
Result!(void, WitString) enablePack(in WitString name, in EnablePosition position) @trusted nothrow {
|
||||
align(size_t.sizeof) void[(3*size_t.sizeof)] _retArea = void;
|
||||
uint _variantPart8 = void;
|
||||
void* _variantPart9 = void;
|
||||
size_t _variantPart10 = void;
|
||||
alias _Tag11 = EnablePosition.Tag;
|
||||
final switch (position.tag) {
|
||||
case _Tag11.first: {
|
||||
_variantPart8 = 0;
|
||||
_variantPart9 = null;
|
||||
_variantPart10 = 0;
|
||||
break;
|
||||
}
|
||||
case _Tag11.last: {
|
||||
_variantPart8 = 1;
|
||||
_variantPart9 = null;
|
||||
_variantPart10 = 0;
|
||||
break;
|
||||
}
|
||||
case _Tag11.before: {
|
||||
const ref WitString _payload5 = position.getBefore();
|
||||
_variantPart8 = 2;
|
||||
_variantPart9 = cast(void*)(_payload5.ptr);
|
||||
_variantPart10 = _payload5.length;
|
||||
break;
|
||||
}
|
||||
case _Tag11.after: {
|
||||
const ref WitString _payload7 = position.getAfter();
|
||||
_variantPart8 = 3;
|
||||
_variantPart9 = cast(void*)(_payload7.ptr);
|
||||
_variantPart10 = _payload7.length;
|
||||
break;
|
||||
}
|
||||
}
|
||||
__import_enablePack(this.__handle, cast(void*)(name.ptr), name.length, _variantPart8, _variantPart9, _variantPart10, _retArea.ptr);
|
||||
Result!(void, WitString) _result16 = void;
|
||||
bool _isErr16 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isErr16) {
|
||||
auto _len14 = *(cast(size_t*)(_retArea.ptr + (2*size_t.sizeof)));
|
||||
auto _ptr14 = _len14 ? cast(char*)(*(cast(void**)(_retArea.ptr + size_t.sizeof))) : null;
|
||||
auto _list15 = WitString(_ptr14[0.._len14]);
|
||||
|
||||
_result16 = Result!(void, WitString).makeErr(_list15);
|
||||
} else {
|
||||
|
||||
_result16 = Result!(void, WitString).makeOk();
|
||||
}
|
||||
auto _flush17 = _result16;
|
||||
return _flush17;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/datapack@0.1.0", "[method]datapack-manager.enable-pack")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__datapack@0.1.0__:method:datapack_manager.enable_pack")
|
||||
static private extern(C) void __import_enablePack(uint, void*, size_t, uint, void*, size_t, void*) nothrow;
|
||||
|
||||
/++
|
||||
Disables an enabled datapack.
|
||||
+/
|
||||
Result!(void, WitString) disablePack(in WitString name) @trusted nothrow {
|
||||
align(size_t.sizeof) void[(3*size_t.sizeof)] _retArea = void;
|
||||
__import_disablePack(this.__handle, cast(void*)(name.ptr), name.length, _retArea.ptr);
|
||||
Result!(void, WitString) _result4 = void;
|
||||
bool _isErr4 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isErr4) {
|
||||
auto _len2 = *(cast(size_t*)(_retArea.ptr + (2*size_t.sizeof)));
|
||||
auto _ptr2 = _len2 ? cast(char*)(*(cast(void**)(_retArea.ptr + size_t.sizeof))) : null;
|
||||
auto _list3 = WitString(_ptr2[0.._len2]);
|
||||
|
||||
_result4 = Result!(void, WitString).makeErr(_list3);
|
||||
} else {
|
||||
|
||||
_result4 = Result!(void, WitString).makeOk();
|
||||
}
|
||||
auto _flush5 = _result4;
|
||||
return _flush5;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/datapack@0.1.0", "[method]datapack-manager.disable-pack")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__datapack@0.1.0__:method:datapack_manager.disable_pack")
|
||||
static private extern(C) void __import_disablePack(uint, void*, size_t, void*) nothrow;
|
||||
|
||||
/++
|
||||
Reloads all enabled datapacks, recipes, and function tags,
|
||||
synchronizes recipes with online players, and triggers `#minecraft:load`.
|
||||
+/
|
||||
Result!(void, WitString) reload() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(3*size_t.sizeof)] _retArea = void;
|
||||
__import_reload(this.__handle, _retArea.ptr);
|
||||
Result!(void, WitString) _result4 = void;
|
||||
bool _isErr4 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isErr4) {
|
||||
auto _len2 = *(cast(size_t*)(_retArea.ptr + (2*size_t.sizeof)));
|
||||
auto _ptr2 = _len2 ? cast(char*)(*(cast(void**)(_retArea.ptr + size_t.sizeof))) : null;
|
||||
auto _list3 = WitString(_ptr2[0.._len2]);
|
||||
|
||||
_result4 = Result!(void, WitString).makeErr(_list3);
|
||||
} else {
|
||||
|
||||
_result4 = Result!(void, WitString).makeOk();
|
||||
}
|
||||
auto _flush5 = _result4;
|
||||
return _flush5;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/datapack@0.1.0", "[method]datapack-manager.reload")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__datapack@0.1.0__:method:datapack_manager.reload")
|
||||
static private extern(C) void __import_reload(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Executes a datapack function or function tag (e.g. "namespace:fn" or "#namespace:tag").
|
||||
Returns the number of commands executed.
|
||||
+/
|
||||
Result!(uint, WitString) executeFunction(in WitString name) @trusted nothrow {
|
||||
align(size_t.sizeof) void[(3*size_t.sizeof)] _retArea = void;
|
||||
__import_executeFunction(this.__handle, cast(void*)(name.ptr), name.length, _retArea.ptr);
|
||||
Result!(uint, WitString) _result4 = void;
|
||||
bool _isErr4 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isErr4) {
|
||||
auto _len2 = *(cast(size_t*)(_retArea.ptr + (2*size_t.sizeof)));
|
||||
auto _ptr2 = _len2 ? cast(char*)(*(cast(void**)(_retArea.ptr + size_t.sizeof))) : null;
|
||||
auto _list3 = WitString(_ptr2[0.._len2]);
|
||||
|
||||
_result4 = Result!(uint, WitString).makeErr(_list3);
|
||||
} else {
|
||||
|
||||
_result4 = Result!(uint, WitString).makeOk(*(cast(uint*)(_retArea.ptr + size_t.sizeof)));
|
||||
}
|
||||
auto _flush5 = _result4;
|
||||
return _flush5;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/datapack@0.1.0", "[method]datapack-manager.execute-function")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__datapack@0.1.0__:method:datapack_manager.execute_function")
|
||||
static private extern(C) void __import_executeFunction(uint, void*, size_t, void*) nothrow;
|
||||
}
|
||||
}
|
||||
225
src/wit/pumpkin/plugin/display/common.d
Normal file
225
src/wit/pumpkin/plugin/display/common.d
Normal file
@ -0,0 +1,225 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.display.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.text.common;
|
||||
static import wit.pumpkin.plugin.item_stack.common;
|
||||
static import wit.pumpkin.plugin.uuid.common;
|
||||
static import wit.pumpkin.plugin.world.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias Uuid = wit.pumpkin.plugin.uuid.common.Uuid;
|
||||
|
||||
/++
|
||||
Billboard rendering constraints for display entities.
|
||||
+/
|
||||
enum BillboardMode : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
fixed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
vertical,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
horizontal,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
center,
|
||||
}
|
||||
/++
|
||||
Item display transformation modes for item display entities.
|
||||
+/
|
||||
enum ItemDisplayMode : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
none,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
thirdpersonLefthand,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
thirdpersonRighthand,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
firstpersonLefthand,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
firstpersonRighthand,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
head,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
gui,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
ground,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fixed,
|
||||
}
|
||||
/++
|
||||
Text alignment options for text display entities.
|
||||
+/
|
||||
enum TextAlignment : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
center,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
left,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
right,
|
||||
}
|
||||
/++
|
||||
3D single-precision vector.
|
||||
+/
|
||||
struct Vector3f {
|
||||
/++
|
||||
|
||||
+/
|
||||
float x;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
float y;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
float z;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
Vector3f witClone() const @nogc nothrow {
|
||||
Vector3f clone = void;
|
||||
clone.x = this.x.witClone;
|
||||
clone.y = this.y.witClone;
|
||||
clone.z = this.z.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Single-precision quaternion representing a 3D rotation.
|
||||
+/
|
||||
struct Quaternionf {
|
||||
/++
|
||||
|
||||
+/
|
||||
float x;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
float y;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
float z;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
float w;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
Quaternionf witClone() const @nogc nothrow {
|
||||
Quaternionf clone = void;
|
||||
clone.x = this.x.witClone;
|
||||
clone.y = this.y.witClone;
|
||||
clone.z = this.z.witClone;
|
||||
clone.w = this.w.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Transformation (translation, scale, left and right rotations) for display entities.
|
||||
+/
|
||||
struct DisplayTransformation {
|
||||
/++
|
||||
|
||||
+/
|
||||
Vector3f translation;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Vector3f scale;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Quaternionf leftRotation;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Quaternionf rightRotation;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
DisplayTransformation witClone() const @nogc nothrow {
|
||||
DisplayTransformation clone = void;
|
||||
clone.translation = this.translation.witClone;
|
||||
clone.scale = this.scale.witClone;
|
||||
clone.leftRotation = this.leftRotation.witClone;
|
||||
clone.rightRotation = this.rightRotation.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
1167
src/wit/pumpkin/plugin/display/imports.d
Normal file
1167
src/wit/pumpkin/plugin/display/imports.d
Normal file
File diff suppressed because it is too large
Load Diff
290
src/wit/pumpkin/plugin/enchantments/common.d
Normal file
290
src/wit/pumpkin/plugin/enchantments/common.d
Normal file
@ -0,0 +1,290 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.enchantments.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.text.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
Equipment slot where an enchantment is active.
|
||||
+/
|
||||
enum AttributeModifierSlot : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
any,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mainHand,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
offHand,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
hand,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
feet,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
legs,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
chest,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
head,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
armor,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
body_,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
saddle,
|
||||
}
|
||||
/++
|
||||
Vanilla enchantments enum.
|
||||
+/
|
||||
enum Enchantment : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
aquaAffinity,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
baneOfArthropods,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bindingCurse,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blastProtection,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
breach,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
channeling,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
density,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
depthStrider,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
efficiency,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
featherFalling,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fireAspect,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fireProtection,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
flame,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fortune,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
frostWalker,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
impaling,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
infinity,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
knockback,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
looting,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
loyalty,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
luckOfTheSea,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lunge,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lure,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mending,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
multishot,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
piercing,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
power,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
projectileProtection,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
protection,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
punch,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
quickCharge,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
respiration,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
riptide,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sharpness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
silkTouch,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
smite,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
soulSpeed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sweepingEdge,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
swiftSneak,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
thorns,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
unbreaking,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
vanishingCurse,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
windBurst,
|
||||
}
|
||||
278
src/wit/pumpkin/plugin/enchantments/imports.d
Normal file
278
src/wit/pumpkin/plugin/enchantments/imports.d
Normal file
@ -0,0 +1,278 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.enchantments.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.enchantments.common;
|
||||
|
||||
static import wit.pumpkin.plugin.text.imports;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias TextComponent = wit.pumpkin.plugin.text.imports.TextComponent;
|
||||
|
||||
/++
|
||||
Represents a custom enchantment definition.
|
||||
+/
|
||||
struct CustomEnchantment {
|
||||
/++
|
||||
Unique identifier for the enchantment (e.g. "my_plugin:lifesteal").
|
||||
+/
|
||||
WitString id;
|
||||
|
||||
/++
|
||||
Description or display name of the enchantment.
|
||||
+/
|
||||
TextComponent description;
|
||||
|
||||
/++
|
||||
Maximum level of the enchantment (e.g. 1..=10).
|
||||
+/
|
||||
uint maxLevel;
|
||||
|
||||
/++
|
||||
Base anvil repair/combination cost multiplier.
|
||||
+/
|
||||
uint anvilCost;
|
||||
|
||||
/++
|
||||
Tag or item pattern for supported items (e.g. "#minecraft:enchantable/weapon").
|
||||
+/
|
||||
WitString supportedItems;
|
||||
|
||||
/++
|
||||
Weight / rarity of the enchantment (higher = more common, default 5).
|
||||
+/
|
||||
uint weight;
|
||||
|
||||
/++
|
||||
Equipment slots where this enchantment is active.
|
||||
+/
|
||||
WitList!(AttributeModifierSlot) slots;
|
||||
|
||||
/++
|
||||
List of exclusive/conflicting enchantment IDs.
|
||||
+/
|
||||
WitList!(WitString) exclusiveSet;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
id.witFree;
|
||||
supportedItems.witFree;
|
||||
slots.witFree;
|
||||
exclusiveSet.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
description.witDrop;
|
||||
}
|
||||
|
||||
CustomEnchantment witClone() const @nogc nothrow {
|
||||
CustomEnchantment clone = void;
|
||||
clone.id = this.id.witClone;
|
||||
clone.description = this.description.witClone;
|
||||
clone.maxLevel = this.maxLevel.witClone;
|
||||
clone.anvilCost = this.anvilCost.witClone;
|
||||
clone.supportedItems = this.supportedItems.witClone;
|
||||
clone.weight = this.weight.witClone;
|
||||
clone.slots = this.slots.witClone;
|
||||
clone.exclusiveSet = this.exclusiveSet.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Global manager for registering and querying custom enchantments.
|
||||
+/
|
||||
struct EnchantmentManager {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
|
||||
pragma(inline, true) void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
@wasmImport!("pumpkin:plugin/enchantments@0.1.0", "[resource-drop]enchantment-manager")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__enchantments@0.1.0__:resource_drop:enchantment_manager")
|
||||
static private extern(C) void __import_drop(uint) @nogc nothrow;
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true) typeof(this) witClone() const @safe @nogc nothrow { return typeof(this)(__handle); }
|
||||
// TODO: make RAII? disable copy for the own
|
||||
|
||||
Borrow borrow() => Borrow(__handle);
|
||||
alias borrow this;
|
||||
|
||||
struct Borrow {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true)
|
||||
void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
pragma(inline, true) Borrow witClone() const @safe @nogc nothrow { return Borrow(__handle); }
|
||||
|
||||
/++
|
||||
Registers a new custom enchantment with the server.
|
||||
+/
|
||||
Result!(void, WitString) registerEnchantment(in CustomEnchantment enchantment) @trusted nothrow {
|
||||
align(size_t.sizeof) void[(3*size_t.sizeof)] _retArea = void;
|
||||
wit.common.DeallocateBuffer deallocate;
|
||||
auto _listSrc1 = enchantment.slots;
|
||||
auto _list1 = _listSrc1.length ? wit.common.malloc(_listSrc1.length * (1)) : null;
|
||||
assert(!_listSrc1.length || _list1);
|
||||
if (_listSrc1.length) deallocate ~= _list1;
|
||||
foreach (_elem0_idx, ref _elem0; _listSrc1) {
|
||||
auto _base0 = _list1 + _elem0_idx * (1);
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(cast(uint)(_elem0));
|
||||
|
||||
}
|
||||
auto _listSrc3 = enchantment.exclusiveSet;
|
||||
auto _list3 = _listSrc3.length ? wit.common.malloc(_listSrc3.length * ((2*size_t.sizeof))) : null;
|
||||
assert(!_listSrc3.length || _list3);
|
||||
if (_listSrc3.length) deallocate ~= _list3;
|
||||
foreach (_elem2_idx, ref _elem2; _listSrc3) {
|
||||
auto _base2 = _list3 + _elem2_idx * ((2*size_t.sizeof));
|
||||
*cast(size_t*)(_base2 + size_t.sizeof) = cast(size_t)(_elem2.length);
|
||||
*cast(void**)(_base2 + 0) = cast(void*)(cast(void*)(_elem2.ptr));
|
||||
|
||||
}
|
||||
__import_registerEnchantment(this.__handle, cast(void*)(enchantment.id.ptr), enchantment.id.length, enchantment.description.__handle, enchantment.maxLevel, enchantment.anvilCost, cast(void*)(enchantment.supportedItems.ptr), enchantment.supportedItems.length, enchantment.weight, _list1, enchantment.slots.length, _list3, enchantment.exclusiveSet.length, _retArea.ptr);
|
||||
deallocate.purge();
|
||||
Result!(void, WitString) _result8 = void;
|
||||
bool _isErr8 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isErr8) {
|
||||
auto _len6 = *(cast(size_t*)(_retArea.ptr + (2*size_t.sizeof)));
|
||||
auto _ptr6 = _len6 ? cast(char*)(*(cast(void**)(_retArea.ptr + size_t.sizeof))) : null;
|
||||
auto _list7 = WitString(_ptr6[0.._len6]);
|
||||
|
||||
_result8 = Result!(void, WitString).makeErr(_list7);
|
||||
} else {
|
||||
|
||||
_result8 = Result!(void, WitString).makeOk();
|
||||
}
|
||||
auto _flush9 = _result8;
|
||||
return _flush9;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/enchantments@0.1.0", "[method]enchantment-manager.register-enchantment")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__enchantments@0.1.0__:method:enchantment_manager.register_enchantment")
|
||||
static private extern(C) void __import_registerEnchantment(uint, void*, size_t, uint, uint, uint, void*, size_t, uint, void*, size_t, void*, size_t, void*) nothrow;
|
||||
|
||||
/++
|
||||
Gets an enchantment definition by its ID.
|
||||
+/
|
||||
Option!(CustomEnchantment) getEnchantment(in WitString id) @trusted nothrow {
|
||||
align(size_t.sizeof) void[(8+11*size_t.sizeof)] _retArea = void;
|
||||
__import_getEnchantment(this.__handle, cast(void*)(id.ptr), id.length, _retArea.ptr);
|
||||
Option!(CustomEnchantment) _option16 = void;
|
||||
bool _isSome16 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome16) {
|
||||
auto _len2 = *(cast(size_t*)(_retArea.ptr + (2*size_t.sizeof)));
|
||||
auto _ptr2 = _len2 ? cast(char*)(*(cast(void**)(_retArea.ptr + size_t.sizeof))) : null;
|
||||
auto _list3 = WitString(_ptr2[0.._len2]);
|
||||
auto _handle4 = TextComponent(*(cast(uint*)(_retArea.ptr + (3*size_t.sizeof))));
|
||||
auto _len5 = *(cast(size_t*)(_retArea.ptr + (8+5*size_t.sizeof)));
|
||||
auto _ptr5 = _len5 ? cast(char*)(*(cast(void**)(_retArea.ptr + (8+4*size_t.sizeof)))) : null;
|
||||
auto _list6 = WitString(_ptr5[0.._len5]);
|
||||
auto _listSrcPtr8 = *(cast(void**)(_retArea.ptr + (8+7*size_t.sizeof)));
|
||||
auto _listLen8 = *(cast(size_t*)(_retArea.ptr + (8+8*size_t.sizeof)));
|
||||
auto _list8 = _listLen8 ? wit.common.mallocSlice!(AttributeModifierSlot)(_listLen8) : [];
|
||||
assert(!_listLen8 || _list8.ptr);
|
||||
foreach (_elem7_idx, ref _elem7; _list8) {
|
||||
const auto _base7 = _listSrcPtr8 + _elem7_idx * 1;
|
||||
_elem7 = cast(AttributeModifierSlot)(cast(uint)(*(cast(ubyte*)(_base7 + 0))));
|
||||
}
|
||||
if (_listLen8) wit.common.free(_listSrcPtr8);
|
||||
auto _witList9 = WitList!(AttributeModifierSlot)(_list8);
|
||||
auto _listSrcPtr13 = *(cast(void**)(_retArea.ptr + (8+9*size_t.sizeof)));
|
||||
auto _listLen13 = *(cast(size_t*)(_retArea.ptr + (8+10*size_t.sizeof)));
|
||||
auto _list13 = _listLen13 ? wit.common.mallocSlice!(WitString)(_listLen13) : [];
|
||||
assert(!_listLen13 || _list13.ptr);
|
||||
foreach (_elem10_idx, ref _elem10; _list13) {
|
||||
const auto _base10 = _listSrcPtr13 + _elem10_idx * (2*size_t.sizeof);
|
||||
auto _len11 = *(cast(size_t*)(_base10 + size_t.sizeof));
|
||||
auto _ptr11 = _len11 ? cast(char*)(*(cast(void**)(_base10 + 0))) : null;
|
||||
auto _list12 = WitString(_ptr11[0.._len11]);
|
||||
_elem10 = _list12;
|
||||
}
|
||||
if (_listLen13) wit.common.free(_listSrcPtr13);
|
||||
auto _witList14 = WitList!(WitString)(_list13);
|
||||
CustomEnchantment _record15 = {
|
||||
id: _list3,
|
||||
description: _handle4,
|
||||
maxLevel: *(cast(uint*)(_retArea.ptr + (4+3*size_t.sizeof))),
|
||||
anvilCost: *(cast(uint*)(_retArea.ptr + (8+3*size_t.sizeof))),
|
||||
supportedItems: _list6,
|
||||
weight: *(cast(uint*)(_retArea.ptr + (8+6*size_t.sizeof))),
|
||||
slots: _witList9,
|
||||
exclusiveSet: _witList14,
|
||||
};
|
||||
|
||||
_option16 = Option!(CustomEnchantment).makeSome(_record15);
|
||||
} else {
|
||||
_option16 = Option!(CustomEnchantment).makeNone;
|
||||
}
|
||||
auto _flush17 = _option16;
|
||||
return _flush17;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/enchantments@0.1.0", "[method]enchantment-manager.get-enchantment")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__enchantments@0.1.0__:method:enchantment_manager.get_enchantment")
|
||||
static private extern(C) void __import_getEnchantment(uint, void*, size_t, void*) nothrow;
|
||||
|
||||
/++
|
||||
Checks if an enchantment ID is registered.
|
||||
+/
|
||||
bool hasEnchantment(in WitString id) @trusted nothrow {
|
||||
auto _ret = __import_hasEnchantment(this.__handle, cast(void*)(id.ptr), id.length);
|
||||
return (_ret) != 0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/enchantments@0.1.0", "[method]enchantment-manager.has-enchantment")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__enchantments@0.1.0__:method:enchantment_manager.has_enchantment")
|
||||
static private extern(C) uint __import_hasEnchantment(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Returns all registered custom enchantment IDs.
|
||||
+/
|
||||
WitList!(WitString) getAllEnchantmentIds() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_getAllEnchantmentIds(this.__handle, _retArea.ptr);
|
||||
auto _listSrcPtr3 = *(cast(void**)(_retArea.ptr + 0));
|
||||
auto _listLen3 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _list3 = _listLen3 ? wit.common.mallocSlice!(WitString)(_listLen3) : [];
|
||||
assert(!_listLen3 || _list3.ptr);
|
||||
foreach (_elem0_idx, ref _elem0; _list3) {
|
||||
const auto _base0 = _listSrcPtr3 + _elem0_idx * (2*size_t.sizeof);
|
||||
auto _len1 = *(cast(size_t*)(_base0 + size_t.sizeof));
|
||||
auto _ptr1 = _len1 ? cast(char*)(*(cast(void**)(_base0 + 0))) : null;
|
||||
auto _list2 = WitString(_ptr1[0.._len1]);
|
||||
_elem0 = _list2;
|
||||
}
|
||||
if (_listLen3) wit.common.free(_listSrcPtr3);
|
||||
auto _witList4 = WitList!(WitString)(_list3);
|
||||
auto _flush5 = _witList4;
|
||||
return _flush5;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/enchantments@0.1.0", "[method]enchantment-manager.get-all-enchantment-ids")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__enchantments@0.1.0__:method:enchantment_manager.get_all_enchantment_ids")
|
||||
static private extern(C) void __import_getAllEnchantmentIds(uint, void*) nothrow;
|
||||
}
|
||||
}
|
||||
106
src/wit/pumpkin/plugin/entity/common.d
Normal file
106
src/wit/pumpkin/plugin/entity/common.d
Normal file
@ -0,0 +1,106 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.entity.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.world.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias PathNodeType = wit.pumpkin.plugin.world.common.PathNodeType;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias DyeColor = wit.pumpkin.plugin.world.common.DyeColor;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias VillagerProfession = wit.pumpkin.plugin.world.common.VillagerProfession;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias MobData = wit.pumpkin.plugin.world.common.MobData;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias SheepData = wit.pumpkin.plugin.world.common.SheepData;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias WolfData = wit.pumpkin.plugin.world.common.WolfData;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias CatData = wit.pumpkin.plugin.world.common.CatData;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias VillagerData = wit.pumpkin.plugin.world.common.VillagerData;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias CreeperData = wit.pumpkin.plugin.world.common.CreeperData;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias SlimeData = wit.pumpkin.plugin.world.common.SlimeData;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias EndermanData = wit.pumpkin.plugin.world.common.EndermanData;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias IronGolemData = wit.pumpkin.plugin.world.common.IronGolemData;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias FoxData = wit.pumpkin.plugin.world.common.FoxData;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias AgeableData = wit.pumpkin.plugin.world.common.AgeableData;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias ZombieData = wit.pumpkin.plugin.world.common.ZombieData;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias ShulkerData = wit.pumpkin.plugin.world.common.ShulkerData;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias RaycastResult = wit.pumpkin.plugin.world.common.RaycastResult;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias RayTraceBlockResult = wit.pumpkin.plugin.world.common.RayTraceBlockResult;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias BlockDirection = wit.pumpkin.plugin.world.common.BlockDirection;
|
||||
33
src/wit/pumpkin/plugin/entity/imports.d
Normal file
33
src/wit/pumpkin/plugin/entity/imports.d
Normal file
@ -0,0 +1,33 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.entity.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.entity.common;
|
||||
|
||||
static import wit.pumpkin.plugin.world.imports;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias Entity = wit.pumpkin.plugin.world.imports.Entity;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias LivingEntity = wit.pumpkin.plugin.world.imports.LivingEntity;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias Mob = wit.pumpkin.plugin.world.imports.Mob;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias RayTraceEntityResult = wit.pumpkin.plugin.world.imports.RayTraceEntityResult;
|
||||
325
src/wit/pumpkin/plugin/entity_statuses/common.d
Normal file
325
src/wit/pumpkin/plugin/entity_statuses/common.d
Normal file
@ -0,0 +1,325 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.entity_statuses.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum EntityStatus : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
armadilloPeek,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
armorstandWobble,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bodyBreak,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cancelShakeWetness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
chestBreak,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
death,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
dolphinLookingForTreasure,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
drownParticles,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
eatGrass,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
endRam,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
feetBreak,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fireworksExplode,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fishingRodReelIn,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
foxEat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fullDebugInfo,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
guardianAttackSound,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
headBreak,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
honeyJump,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
honeySlide,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
inLoveHearts,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
jump,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
kineticHit,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
legsBreak,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
loveHearts,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mainhandBreak,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
offerFlower,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
offhandBreak,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
permissionLevelAdmins,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
permissionLevelAll,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
permissionLevelGamemasters,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
permissionLevelModerators,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
permissionLevelOwners,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
poof,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
protectedFromDeath,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
ravagerRoared,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
ravagerStunned,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
reducedDebugInfo,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
saddleBreak,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
shake,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
shakeWetness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
silverfishMergeAnim,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
snifferDiggingSound,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sonicCharge,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
squidAnimSynch,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
startAttacking,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
startRam,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
stopAttacking,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
stopOfferFlower,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
swapHands,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tamingFailed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tamingSucceeded,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
teleport,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tendrilsShiver,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tntPrime,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
trustingFailed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
trustingSucceeded,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
useItemComplete,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
villagerAngry,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
villagerHappy,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
villagerSweat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
witchHatMagic,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
zombieConverting,
|
||||
}
|
||||
12
src/wit/pumpkin/plugin/entity_statuses/imports.d
Normal file
12
src/wit/pumpkin/plugin/entity_statuses/imports.d
Normal file
@ -0,0 +1,12 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.entity_statuses.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.entity_statuses.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
805
src/wit/pumpkin/plugin/entity_types/common.d
Normal file
805
src/wit/pumpkin/plugin/entity_types/common.d
Normal file
@ -0,0 +1,805 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.entity_types.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum EntityType : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
acaciaBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
acaciaChestBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
allay,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
areaEffectCloud,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
armadillo,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
armorStand,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
arrow,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
axolotl,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bambooChestRaft,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bambooRaft,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bee,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
birchBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
birchChestBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blaze,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockDisplay,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bogged,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
breeze,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
breezeWindCharge,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
camel,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
camelHusk,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
caveSpider,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cherryBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cherryChestBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
chestMinecart,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
chicken,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cod,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
commandBlockMinecart,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
copperGolem,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cow,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
creaking,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
creeper,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
darkOakBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
darkOakChestBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
dolphin,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
donkey,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
dragonFireball,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
drowned,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
egg,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
elderGuardian,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
endCrystal,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enderDragon,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enderPearl,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enderman,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
endermite,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
evoker,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
evokerFangs,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
experienceBottle,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
experienceOrb,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
eyeOfEnder,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fallingBlock,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fireball,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fireworkRocket,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fishingBobber,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fox,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
frog,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
furnaceMinecart,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
ghast,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
giant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
glowItemFrame,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
glowSquid,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
goat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
guardian,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
happyGhast,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
hoglin,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
hopperMinecart,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
horse,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
husk,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
illusioner,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
interaction,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
ironGolem,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
item,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
itemDisplay,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
itemFrame,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
jungleBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
jungleChestBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
leashKnot,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lightningBolt,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lingeringPotion,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
llama,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
llamaSpit,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
magmaCube,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mangroveBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mangroveChestBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mannequin,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
marker,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
minecart,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mooshroom,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mule,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
nautilus,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
oakBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
oakChestBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
ocelot,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
ominousItemSpawner,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
painting,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
paleOakBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
paleOakChestBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
panda,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
parched,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
parrot,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
phantom,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
pig,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
piglin,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
piglinBrute,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
pillager,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
player,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
polarBear,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
pufferfish,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
rabbit,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
ravager,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
salmon,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sheep,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
shulker,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
shulkerBullet,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
silverfish,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
skeleton,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
skeletonHorse,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
slime,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
smallFireball,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sniffer,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
snowGolem,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
snowball,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spawnerMinecart,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spectralArrow,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spider,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
splashPotion,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spruceBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spruceChestBoat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
squid,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
stray,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
strider,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sulfurCube,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tadpole,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
textDisplay,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tnt,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tntMinecart,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
traderLlama,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
trident,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tropicalFish,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
turtle,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
vex,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
villager,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
vindicator,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
wanderingTrader,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
warden,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
windCharge,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
witch,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
wither,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
witherSkeleton,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
witherSkull,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
wolf,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
zoglin,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
zombie,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
zombieHorse,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
zombieNautilus,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
zombieVillager,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
zombifiedPiglin,
|
||||
}
|
||||
12
src/wit/pumpkin/plugin/entity_types/imports.d
Normal file
12
src/wit/pumpkin/plugin/entity_types/imports.d
Normal file
@ -0,0 +1,12 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.entity_types.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.entity_types.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
6339
src/wit/pumpkin/plugin/event/common.d
Normal file
6339
src/wit/pumpkin/plugin/event/common.d
Normal file
File diff suppressed because it is too large
Load Diff
10791
src/wit/pumpkin/plugin/event/imports.d
Normal file
10791
src/wit/pumpkin/plugin/event/imports.d
Normal file
File diff suppressed because it is too large
Load Diff
54
src/wit/pumpkin/plugin/forms/common.d
Normal file
54
src/wit/pumpkin/plugin/forms/common.d
Normal file
@ -0,0 +1,54 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.forms.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.text.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum ImageType : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
url,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
path,
|
||||
}
|
||||
/++
|
||||
|
||||
+/
|
||||
struct FormImage {
|
||||
/++
|
||||
|
||||
+/
|
||||
ImageType type;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString data;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
data.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
FormImage witClone() const @nogc nothrow {
|
||||
FormImage clone = void;
|
||||
clone.type = this.type.witClone;
|
||||
clone.data = this.data.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
377
src/wit/pumpkin/plugin/forms/imports.d
Normal file
377
src/wit/pumpkin/plugin/forms/imports.d
Normal file
@ -0,0 +1,377 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.forms.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.forms.common;
|
||||
|
||||
static import wit.pumpkin.plugin.text.imports;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias TextComponent = wit.pumpkin.plugin.text.imports.TextComponent;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
struct SimpleFormButton {
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent text;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(FormImage) image;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
image.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
text.witDrop;
|
||||
}
|
||||
|
||||
SimpleFormButton witClone() const @nogc nothrow {
|
||||
SimpleFormButton clone = void;
|
||||
clone.text = this.text.witClone;
|
||||
clone.image = this.image.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
struct SimpleForm {
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent title;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent content;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitList!(SimpleFormButton) buttons;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
buttons.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
title.witDrop;
|
||||
content.witDrop;
|
||||
buttons.witDrop;
|
||||
}
|
||||
|
||||
SimpleForm witClone() const @nogc nothrow {
|
||||
SimpleForm clone = void;
|
||||
clone.title = this.title.witClone;
|
||||
clone.content = this.content.witClone;
|
||||
clone.buttons = this.buttons.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
struct ModalForm {
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent title;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent content;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent button1;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent button2;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
title.witDrop;
|
||||
content.witDrop;
|
||||
button1.witDrop;
|
||||
button2.witDrop;
|
||||
}
|
||||
|
||||
ModalForm witClone() const @nogc nothrow {
|
||||
ModalForm clone = void;
|
||||
clone.title = this.title.witClone;
|
||||
clone.content = this.content.witClone;
|
||||
clone.button1 = this.button1.witClone;
|
||||
clone.button2 = this.button2.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
struct CustomFormElement {
|
||||
mixin WitVariant!(
|
||||
TextComponent, // label
|
||||
Tuple!(TextComponent, bool), // toggle
|
||||
Tuple!(TextComponent, float, float, float, float), // slider
|
||||
Tuple!(TextComponent, WitList!(WitString), uint), // stepSlider
|
||||
Tuple!(TextComponent, WitList!(WitString), uint), // dropdown
|
||||
Tuple!(TextComponent, WitString, WitString), // input
|
||||
);
|
||||
|
||||
public:
|
||||
enum Tag : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
label,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
toggle,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
slider,
|
||||
|
||||
/++
|
||||
text, min, max, step, default
|
||||
+/
|
||||
stepSlider,
|
||||
|
||||
/++
|
||||
text, steps, default
|
||||
+/
|
||||
dropdown,
|
||||
|
||||
/++
|
||||
text, options, default
|
||||
+/
|
||||
input,
|
||||
}
|
||||
pragma(inline, true) Tag tag() const @safe @nogc nothrow pure => _tag;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias label = _create!(Tag.label);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isLabel() const => _tag == Tag.label;
|
||||
///ditto
|
||||
alias getLabel = _get!(Tag.label);
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias toggle = _create!(Tag.toggle);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isToggle() const => _tag == Tag.toggle;
|
||||
///ditto
|
||||
alias getToggle = _get!(Tag.toggle);
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias slider = _create!(Tag.slider);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isSlider() const => _tag == Tag.slider;
|
||||
///ditto
|
||||
alias getSlider = _get!(Tag.slider);
|
||||
|
||||
/++
|
||||
text, min, max, step, default
|
||||
+/
|
||||
alias stepSlider = _create!(Tag.stepSlider);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isStepSlider() const => _tag == Tag.stepSlider;
|
||||
///ditto
|
||||
alias getStepSlider = _get!(Tag.stepSlider);
|
||||
|
||||
/++
|
||||
text, steps, default
|
||||
+/
|
||||
alias dropdown = _create!(Tag.dropdown);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isDropdown() const => _tag == Tag.dropdown;
|
||||
///ditto
|
||||
alias getDropdown = _get!(Tag.dropdown);
|
||||
|
||||
/++
|
||||
text, options, default
|
||||
+/
|
||||
alias input = _create!(Tag.input);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isInput() const => _tag == Tag.input;
|
||||
///ditto
|
||||
alias getInput = _get!(Tag.input);
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
switch (_tag) with (Tag) {
|
||||
case stepSlider: _get!(Tag.stepSlider).witFree; break;
|
||||
case dropdown: _get!(Tag.dropdown).witFree; break;
|
||||
case input: _get!(Tag.input).witFree; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
switch (_tag) with (Tag) {
|
||||
case label: _get!(Tag.label).witDrop; break;
|
||||
case toggle: _get!(Tag.toggle).witDrop; break;
|
||||
case slider: _get!(Tag.slider).witDrop; break;
|
||||
case stepSlider: _get!(Tag.stepSlider).witDrop; break;
|
||||
case dropdown: _get!(Tag.dropdown).witDrop; break;
|
||||
case input: _get!(Tag.input).witDrop; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
CustomFormElement witClone() const @nogc nothrow {
|
||||
final switch (_tag) {
|
||||
case Tag.label: return _create!(Tag.label)(this._get!(Tag.label).witClone); break;
|
||||
case Tag.toggle: return _create!(Tag.toggle)(this._get!(Tag.toggle).witClone); break;
|
||||
case Tag.slider: return _create!(Tag.slider)(this._get!(Tag.slider).witClone); break;
|
||||
case Tag.stepSlider: return _create!(Tag.stepSlider)(this._get!(Tag.stepSlider).witClone); break;
|
||||
case Tag.dropdown: return _create!(Tag.dropdown)(this._get!(Tag.dropdown).witClone); break;
|
||||
case Tag.input: return _create!(Tag.input)(this._get!(Tag.input).witClone); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
struct CustomForm {
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent title;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitList!(CustomFormElement) elements;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
elements.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
title.witDrop;
|
||||
elements.witDrop;
|
||||
}
|
||||
|
||||
CustomForm witClone() const @nogc nothrow {
|
||||
CustomForm clone = void;
|
||||
clone.title = this.title.witClone;
|
||||
clone.elements = this.elements.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
struct Form {
|
||||
mixin WitVariant!(
|
||||
SimpleForm, // simple
|
||||
ModalForm, // modal
|
||||
CustomForm, // custom
|
||||
);
|
||||
|
||||
public:
|
||||
enum Tag : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
simple,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
modal,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
custom,
|
||||
}
|
||||
pragma(inline, true) Tag tag() const @safe @nogc nothrow pure => _tag;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias simple = _create!(Tag.simple);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isSimple() const => _tag == Tag.simple;
|
||||
///ditto
|
||||
alias getSimple = _get!(Tag.simple);
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias modal = _create!(Tag.modal);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isModal() const => _tag == Tag.modal;
|
||||
///ditto
|
||||
alias getModal = _get!(Tag.modal);
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias custom = _create!(Tag.custom);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isCustom() const => _tag == Tag.custom;
|
||||
///ditto
|
||||
alias getCustom = _get!(Tag.custom);
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
switch (_tag) with (Tag) {
|
||||
case simple: _get!(Tag.simple).witFree; break;
|
||||
case custom: _get!(Tag.custom).witFree; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
switch (_tag) with (Tag) {
|
||||
case simple: _get!(Tag.simple).witDrop; break;
|
||||
case modal: _get!(Tag.modal).witDrop; break;
|
||||
case custom: _get!(Tag.custom).witDrop; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
Form witClone() const @nogc nothrow {
|
||||
final switch (_tag) {
|
||||
case Tag.simple: return _create!(Tag.simple)(this._get!(Tag.simple).witClone); break;
|
||||
case Tag.modal: return _create!(Tag.modal)(this._get!(Tag.modal).witClone); break;
|
||||
case Tag.custom: return _create!(Tag.custom)(this._get!(Tag.custom).witClone); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
320
src/wit/pumpkin/plugin/game_events/common.d
Normal file
320
src/wit/pumpkin/plugin/game_events/common.d
Normal file
@ -0,0 +1,320 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.game_events.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum GameEvent : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
blockActivate,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockAttach,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockChange,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockClose,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockDeactivate,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockDestroy,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockDetach,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockOpen,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockPlace,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bounce,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
containerClose,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
containerOpen,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
drink,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
eat,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
elytraGlide,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
entityDamage,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
entityDie,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
entityDismount,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
entityInteract,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
entityMount,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
entityPlace,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
entityAction,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
equip,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
explode,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
flap,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fluidPickup,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fluidPlace,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
hitGround,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
instrumentPlay,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
itemInteractFinish,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
itemInteractStart,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
jukeboxPlay,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
jukeboxStopPlay,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lightningStrike,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
noteBlockPlay,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
primeFuse,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
projectileLand,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
projectileShoot,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sculkSensorTendrilsClicking,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
shear,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
shriek,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
splash,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
step,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
swim,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
teleport,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
unequip,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resonate1,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resonate2,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resonate3,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resonate4,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resonate5,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resonate6,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resonate7,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resonate8,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resonate9,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resonate10,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resonate11,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resonate12,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resonate13,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resonate14,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resonate15,
|
||||
}
|
||||
12
src/wit/pumpkin/plugin/game_events/imports.d
Normal file
12
src/wit/pumpkin/plugin/game_events/imports.d
Normal file
@ -0,0 +1,12 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.game_events.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.game_events.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
364
src/wit/pumpkin/plugin/game_rules/common.d
Normal file
364
src/wit/pumpkin/plugin/game_rules/common.d
Normal file
@ -0,0 +1,364 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.game_rules.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum GameRule : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
advanceTime,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
advanceWeather,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
allowEnteringNetherUsingPortals,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockDrops,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockExplosionDropDecay,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
commandBlockOutput,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
commandBlocksWork,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
drowningDamage,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
elytraMovementCheck,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enderPearlsVanishOnDeath,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
entityDrops,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fallDamage,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fireDamage,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fireSpreadRadiusAroundPlayer,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
forgiveDeadPlayers,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
freezeDamage,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
globalSoundEvents,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
immediateRespawn,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
keepInventory,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lavaSourceConversion,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
limitedCrafting,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
locatorBar,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
logAdminCommands,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
maxBlockModifications,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
maxCommandForks,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
maxCommandSequenceLength,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
maxEntityCramming,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
maxMinecartSpeed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
maxSnowAccumulationHeight,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mobDrops,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mobExplosionDropDecay,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mobGriefing,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
naturalHealthRegeneration,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
playerMovementCheck,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
playersNetherPortalCreativeDelay,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
playersNetherPortalDefaultDelay,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
playersSleepingPercentage,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
projectilesCanBreakBlocks,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
pvp,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
raids,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
randomTickSpeed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
reducedDebugInfo,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
respawnRadius,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sendCommandFeedback,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
showAdvancementMessages,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
showDeathMessages,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spawnMobs,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spawnMonsters,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spawnPatrols,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spawnPhantoms,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spawnWanderingTraders,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spawnWardens,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spawnerBlocksWork,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spectatorsGenerateChunks,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spreadVines,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tntExplodes,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tntExplosionDropDecay,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
universalAnger,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
waterSourceConversion,
|
||||
}
|
||||
/++
|
||||
|
||||
+/
|
||||
struct GameRuleValue {
|
||||
mixin WitVariant!(
|
||||
int, // int_
|
||||
bool, // bool_
|
||||
);
|
||||
|
||||
public:
|
||||
enum Tag : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
int_,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bool_,
|
||||
}
|
||||
pragma(inline, true) Tag tag() const @safe @nogc nothrow pure => _tag;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias int_ = _create!(Tag.int_);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isInt() const => _tag == Tag.int_;
|
||||
///ditto
|
||||
alias getInt = _get!(Tag.int_);
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias bool_ = _create!(Tag.bool_);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isBool() const => _tag == Tag.bool_;
|
||||
///ditto
|
||||
alias getBool = _get!(Tag.bool_);
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
GameRuleValue witClone() const @nogc nothrow {
|
||||
final switch (_tag) {
|
||||
case Tag.int_: return _create!(Tag.int_)(this._get!(Tag.int_).witClone); break;
|
||||
case Tag.bool_: return _create!(Tag.bool_)(this._get!(Tag.bool_).witClone); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
src/wit/pumpkin/plugin/game_rules/imports.d
Normal file
12
src/wit/pumpkin/plugin/game_rules/imports.d
Normal file
@ -0,0 +1,12 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.game_rules.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.game_rules.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
25
src/wit/pumpkin/plugin/gui/common.d
Normal file
25
src/wit/pumpkin/plugin/gui/common.d
Normal file
@ -0,0 +1,25 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.gui.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.common.common;
|
||||
static import wit.pumpkin.plugin.screens.common;
|
||||
static import wit.pumpkin.plugin.text.common;
|
||||
static import wit.pumpkin.plugin.item_stack.common;
|
||||
static import wit.pumpkin.plugin.inventory.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias ClickType = wit.pumpkin.plugin.common.common.ClickType;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias Screen = wit.pumpkin.plugin.screens.common.Screen;
|
||||
229
src/wit/pumpkin/plugin/gui/imports.d
Normal file
229
src/wit/pumpkin/plugin/gui/imports.d
Normal file
@ -0,0 +1,229 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.gui.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.gui.common;
|
||||
|
||||
static import wit.pumpkin.plugin.common.imports;
|
||||
static import wit.pumpkin.plugin.screens.imports;
|
||||
static import wit.pumpkin.plugin.text.imports;
|
||||
static import wit.pumpkin.plugin.item_stack.imports;
|
||||
static import wit.pumpkin.plugin.inventory.imports;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias TextComponent = wit.pumpkin.plugin.text.imports.TextComponent;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias ItemStack = wit.pumpkin.plugin.item_stack.imports.ItemStack;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias Inventory = wit.pumpkin.plugin.inventory.imports.Inventory;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
struct Gui {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
static Gui makeNew(Screen type, TextComponent title) @trusted nothrow {
|
||||
auto _ret = __import_makeNew(cast(uint)(type), title.__handle);
|
||||
auto _handle0 = Gui(_ret);
|
||||
return _handle0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/gui@0.1.0", "[constructor]gui")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__gui@0.1.0__:constructor:gui")
|
||||
static private extern(C) uint __import_makeNew(uint, uint) nothrow;
|
||||
|
||||
pragma(inline, true) void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
@wasmImport!("pumpkin:plugin/gui@0.1.0", "[resource-drop]gui")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__gui@0.1.0__:resource_drop:gui")
|
||||
static private extern(C) void __import_drop(uint) @nogc nothrow;
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true) typeof(this) witClone() const @safe @nogc nothrow { return typeof(this)(__handle); }
|
||||
// TODO: make RAII? disable copy for the own
|
||||
|
||||
Borrow borrow() => Borrow(__handle);
|
||||
alias borrow this;
|
||||
|
||||
struct Borrow {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true)
|
||||
void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
pragma(inline, true) Borrow witClone() const @safe @nogc nothrow { return Borrow(__handle); }
|
||||
|
||||
/++
|
||||
Returns the underlying inventory handle for this GUI.
|
||||
+/
|
||||
Inventory getInventory() @trusted nothrow {
|
||||
auto _ret = __import_getInventory(this.__handle);
|
||||
auto _handle0 = Inventory(_ret);
|
||||
return _handle0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/gui@0.1.0", "[method]gui.get-inventory")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__gui@0.1.0__:method:gui.get_inventory")
|
||||
static private extern(C) uint __import_getInventory(uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void setItem(uint slot, ItemStack item) @trusted nothrow {
|
||||
__import_setItem(this.__handle, slot, item.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/gui@0.1.0", "[method]gui.set-item")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__gui@0.1.0__:method:gui.set_item")
|
||||
static private extern(C) void __import_setItem(uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(ItemStack) getItem(uint slot) @trusted nothrow {
|
||||
align(4) void[8] _retArea = void;
|
||||
__import_getItem(this.__handle, slot, _retArea.ptr);
|
||||
Option!(ItemStack) _option3 = void;
|
||||
bool _isSome3 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome3) {
|
||||
auto _handle2 = ItemStack(*(cast(uint*)(_retArea.ptr + 4)));
|
||||
|
||||
_option3 = Option!(ItemStack).makeSome(_handle2);
|
||||
} else {
|
||||
_option3 = Option!(ItemStack).makeNone;
|
||||
}
|
||||
auto _flush4 = _option3;
|
||||
return _flush4;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/gui@0.1.0", "[method]gui.get-item")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__gui@0.1.0__:method:gui.get_item")
|
||||
static private extern(C) void __import_getItem(uint, uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Returns the type of this GUI.
|
||||
+/
|
||||
Screen getType() @trusted nothrow {
|
||||
auto _ret = __import_getType(this.__handle);
|
||||
return cast(wit.pumpkin.plugin.screens.imports.Screen)(_ret);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/gui@0.1.0", "[method]gui.get-type")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__gui@0.1.0__:method:gui.get_type")
|
||||
static private extern(C) uint __import_getType(uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns the title of this GUI.
|
||||
+/
|
||||
TextComponent getTitle() @trusted nothrow {
|
||||
auto _ret = __import_getTitle(this.__handle);
|
||||
auto _handle0 = TextComponent(_ret);
|
||||
return _handle0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/gui@0.1.0", "[method]gui.get-title")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__gui@0.1.0__:method:gui.get_title")
|
||||
static private extern(C) uint __import_getTitle(uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns the number of slots in this GUI.
|
||||
+/
|
||||
uint getSize() @trusted nothrow {
|
||||
auto _ret = __import_getSize(this.__handle);
|
||||
return _ret;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/gui@0.1.0", "[method]gui.get-size")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__gui@0.1.0__:method:gui.get_size")
|
||||
static private extern(C) uint __import_getSize(uint) nothrow;
|
||||
|
||||
/++
|
||||
Clears all items from the GUI.
|
||||
+/
|
||||
void clearItems() @trusted nothrow {
|
||||
__import_clearItems(this.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/gui@0.1.0", "[method]gui.clear-items")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__gui@0.1.0__:method:gui.clear_items")
|
||||
static private extern(C) void __import_clearItems(uint) nothrow;
|
||||
|
||||
/++
|
||||
Sets whether players can grab items out of the inventory.
|
||||
+/
|
||||
void setAllowGrabItems(bool allow) @trusted nothrow {
|
||||
__import_setAllowGrabItems(this.__handle, cast(uint)(allow));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/gui@0.1.0", "[method]gui.set-allow-grab-items")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__gui@0.1.0__:method:gui.set_allow_grab_items")
|
||||
static private extern(C) void __import_setAllowGrabItems(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns whether players can grab items out of the inventory.
|
||||
+/
|
||||
bool getAllowGrabItems() @trusted nothrow {
|
||||
auto _ret = __import_getAllowGrabItems(this.__handle);
|
||||
return (_ret) != 0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/gui@0.1.0", "[method]gui.get-allow-grab-items")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__gui@0.1.0__:method:gui.get_allow_grab_items")
|
||||
static private extern(C) uint __import_getAllowGrabItems(uint) nothrow;
|
||||
|
||||
/++
|
||||
Sets whether players can put items into the inventory from their own.
|
||||
+/
|
||||
void setAllowPutItems(bool allow) @trusted nothrow {
|
||||
__import_setAllowPutItems(this.__handle, cast(uint)(allow));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/gui@0.1.0", "[method]gui.set-allow-put-items")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__gui@0.1.0__:method:gui.set_allow_put_items")
|
||||
static private extern(C) void __import_setAllowPutItems(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns whether players can put items into the inventory from their own.
|
||||
+/
|
||||
bool getAllowPutItems() @trusted nothrow {
|
||||
auto _ret = __import_getAllowPutItems(this.__handle);
|
||||
return (_ret) != 0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/gui@0.1.0", "[method]gui.get-allow-put-items")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__gui@0.1.0__:method:gui.get_allow_put_items")
|
||||
static private extern(C) uint __import_getAllowPutItems(uint) nothrow;
|
||||
}
|
||||
}
|
||||
16
src/wit/pumpkin/plugin/i18n/common.d
Normal file
16
src/wit/pumpkin/plugin/i18n/common.d
Normal file
@ -0,0 +1,16 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.i18n.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.common.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias Locale = wit.pumpkin.plugin.common.common.Locale;
|
||||
53
src/wit/pumpkin/plugin/i18n/imports.d
Normal file
53
src/wit/pumpkin/plugin/i18n/imports.d
Normal file
@ -0,0 +1,53 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.i18n.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.i18n.common;
|
||||
|
||||
static import wit.pumpkin.plugin.common.imports;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
Retrieves a translated string from the host.
|
||||
|
||||
# Arguments
|
||||
* `key`: The namespaced translation key (e.g. `pumpkin:my_key`).
|
||||
* `locale`: The target locale.
|
||||
|
||||
# Returns
|
||||
The localized string, falling back to English or the key itself.
|
||||
+/
|
||||
WitString translate(in WitString key, Locale locale) @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_translate(cast(void*)(key.ptr), key.length, cast(uint)(locale), _retArea.ptr);
|
||||
auto _len0 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _ptr0 = _len0 ? cast(char*)(*(cast(void**)(_retArea.ptr + 0))) : null;
|
||||
auto _list1 = WitString(_ptr0[0.._len0]);
|
||||
auto _flush2 = _list1;
|
||||
return _flush2;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/i18n@0.1.0", "translate")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__i18n@0.1.0__translate")
|
||||
private extern(C) void __import_translate(void*, size_t, uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Loads custom translations from a JSON string.
|
||||
|
||||
# Arguments
|
||||
* `namespace`: The namespace to associate these keys with.
|
||||
* `json`: A JSON string containing a flat map of translations.
|
||||
* `locale`: The target locale for these translations.
|
||||
+/
|
||||
void loadTranslations(in WitString namespace, in WitString json, Locale locale) @trusted nothrow {
|
||||
__import_loadTranslations(cast(void*)(namespace.ptr), namespace.length, cast(void*)(json.ptr), json.length, cast(uint)(locale));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/i18n@0.1.0", "load-translations")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__i18n@0.1.0__load_translations")
|
||||
private extern(C) void __import_loadTranslations(void*, size_t, void*, size_t, uint) nothrow;
|
||||
17
src/wit/pumpkin/plugin/inventory/common.d
Normal file
17
src/wit/pumpkin/plugin/inventory/common.d
Normal file
@ -0,0 +1,17 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.inventory.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.common.common;
|
||||
static import wit.pumpkin.plugin.item_stack.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias Hand = wit.pumpkin.plugin.common.common.Hand;
|
||||
625
src/wit/pumpkin/plugin/inventory/imports.d
Normal file
625
src/wit/pumpkin/plugin/inventory/imports.d
Normal file
@ -0,0 +1,625 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.inventory.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.inventory.common;
|
||||
|
||||
static import wit.pumpkin.plugin.common.imports;
|
||||
static import wit.pumpkin.plugin.item_stack.imports;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias ItemStack = wit.pumpkin.plugin.item_stack.imports.ItemStack;
|
||||
|
||||
/++
|
||||
Common inventory resource used across GUIs, player inventories, and containers.
|
||||
+/
|
||||
struct Inventory {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
|
||||
pragma(inline, true) void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[resource-drop]inventory")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:resource_drop:inventory")
|
||||
static private extern(C) void __import_drop(uint) @nogc nothrow;
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true) typeof(this) witClone() const @safe @nogc nothrow { return typeof(this)(__handle); }
|
||||
// TODO: make RAII? disable copy for the own
|
||||
|
||||
Borrow borrow() => Borrow(__handle);
|
||||
alias borrow this;
|
||||
|
||||
struct Borrow {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true)
|
||||
void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
pragma(inline, true) Borrow witClone() const @safe @nogc nothrow { return Borrow(__handle); }
|
||||
|
||||
/++
|
||||
Returns the number of slots in this inventory.
|
||||
+/
|
||||
uint getSize() @trusted nothrow {
|
||||
auto _ret = __import_getSize(this.__handle);
|
||||
return _ret;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]inventory.get-size")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:inventory.get_size")
|
||||
static private extern(C) uint __import_getSize(uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns true if all slots in this inventory are empty.
|
||||
+/
|
||||
bool isEmpty() @trusted nothrow {
|
||||
auto _ret = __import_isEmpty(this.__handle);
|
||||
return (_ret) != 0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]inventory.is-empty")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:inventory.is_empty")
|
||||
static private extern(C) uint __import_isEmpty(uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns the item in the specified slot index, or none if empty.
|
||||
+/
|
||||
Option!(ItemStack) getItem(uint slot) @trusted nothrow {
|
||||
align(4) void[8] _retArea = void;
|
||||
__import_getItem(this.__handle, slot, _retArea.ptr);
|
||||
Option!(ItemStack) _option3 = void;
|
||||
bool _isSome3 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome3) {
|
||||
auto _handle2 = ItemStack(*(cast(uint*)(_retArea.ptr + 4)));
|
||||
|
||||
_option3 = Option!(ItemStack).makeSome(_handle2);
|
||||
} else {
|
||||
_option3 = Option!(ItemStack).makeNone;
|
||||
}
|
||||
auto _flush4 = _option3;
|
||||
return _flush4;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]inventory.get-item")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:inventory.get_item")
|
||||
static private extern(C) void __import_getItem(uint, uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Sets the item in the specified slot index.
|
||||
+/
|
||||
void setItem(uint slot, in Option!(ItemStack) item) @trusted nothrow {
|
||||
uint _option4 = void;
|
||||
uint _option5 = void;
|
||||
if (item.isSome) {
|
||||
ref _payload3 = item.unwrap();
|
||||
_option4 = 1;
|
||||
_option5 = _payload3.__handle;
|
||||
} else {
|
||||
_option4 = 0;
|
||||
_option5 = 0;
|
||||
}
|
||||
__import_setItem(this.__handle, slot, _option4, _option5);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]inventory.set-item")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:inventory.set_item")
|
||||
static private extern(C) void __import_setItem(uint, uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Removes and returns the item in the specified slot index.
|
||||
+/
|
||||
Option!(ItemStack) removeItem(uint slot) @trusted nothrow {
|
||||
align(4) void[8] _retArea = void;
|
||||
__import_removeItem(this.__handle, slot, _retArea.ptr);
|
||||
Option!(ItemStack) _option3 = void;
|
||||
bool _isSome3 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome3) {
|
||||
auto _handle2 = ItemStack(*(cast(uint*)(_retArea.ptr + 4)));
|
||||
|
||||
_option3 = Option!(ItemStack).makeSome(_handle2);
|
||||
} else {
|
||||
_option3 = Option!(ItemStack).makeNone;
|
||||
}
|
||||
auto _flush4 = _option3;
|
||||
return _flush4;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]inventory.remove-item")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:inventory.remove_item")
|
||||
static private extern(C) void __import_removeItem(uint, uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Clears all items from this inventory.
|
||||
+/
|
||||
void clear() @trusted nothrow {
|
||||
__import_clear(this.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]inventory.clear")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:inventory.clear")
|
||||
static private extern(C) void __import_clear(uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns all items in this inventory as a list of slots.
|
||||
+/
|
||||
WitList!(Option!(ItemStack)) getAllItems() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_getAllItems(this.__handle, _retArea.ptr);
|
||||
auto _listSrcPtr5 = *(cast(void**)(_retArea.ptr + 0));
|
||||
auto _listLen5 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _list5 = _listLen5 ? wit.common.mallocSlice!(Option!(ItemStack))(_listLen5) : [];
|
||||
assert(!_listLen5 || _list5.ptr);
|
||||
foreach (_elem0_idx, ref _elem0; _list5) {
|
||||
const auto _base0 = _listSrcPtr5 + _elem0_idx * 8;
|
||||
Option!(ItemStack) _option4 = void;
|
||||
bool _isSome4 = (cast(uint)(*(cast(ubyte*)(_base0 + 0)))) != 0;
|
||||
if (_isSome4) {
|
||||
auto _handle3 = ItemStack(*(cast(uint*)(_base0 + 4)));
|
||||
|
||||
_option4 = Option!(ItemStack).makeSome(_handle3);
|
||||
} else {
|
||||
_option4 = Option!(ItemStack).makeNone;
|
||||
}
|
||||
_elem0 = _option4;
|
||||
}
|
||||
if (_listLen5) wit.common.free(_listSrcPtr5);
|
||||
auto _witList6 = WitList!(Option!(ItemStack))(_list5);
|
||||
auto _flush7 = _witList6;
|
||||
return _flush7;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]inventory.get-all-items")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:inventory.get_all_items")
|
||||
static private extern(C) void __import_getAllItems(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Sets all items in this inventory from a list.
|
||||
+/
|
||||
void setAllItems(in WitList!(Option!(ItemStack)) items) @trusted nothrow {
|
||||
wit.common.DeallocateBuffer deallocate;
|
||||
auto _listSrc5 = items;
|
||||
auto _list5 = _listSrc5.length ? wit.common.malloc(_listSrc5.length * (8)) : null;
|
||||
assert(!_listSrc5.length || _list5);
|
||||
if (_listSrc5.length) deallocate ~= _list5;
|
||||
foreach (_elem0_idx, ref _elem0; _listSrc5) {
|
||||
auto _base0 = _list5 + _elem0_idx * (8);
|
||||
if (_elem0.isSome) {
|
||||
ref _payload4 = _elem0.unwrap();
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(1);
|
||||
*cast(uint*)(_base0 + 4) = cast(uint)(_payload4.__handle);
|
||||
} else {
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(0);
|
||||
}
|
||||
|
||||
}
|
||||
__import_setAllItems(this.__handle, _list5, items.length);
|
||||
deallocate.purge();
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]inventory.set-all-items")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:inventory.set_all_items")
|
||||
static private extern(C) void __import_setAllItems(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Counts the total number of items with the given ID in this inventory.
|
||||
+/
|
||||
uint countItem(in WitString itemId) @trusted nothrow {
|
||||
auto _ret = __import_countItem(this.__handle, cast(void*)(itemId.ptr), itemId.length);
|
||||
return _ret;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]inventory.count-item")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:inventory.count_item")
|
||||
static private extern(C) uint __import_countItem(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Checks if the inventory contains at least one item with the given ID.
|
||||
+/
|
||||
bool containsItem(in WitString itemId) @trusted nothrow {
|
||||
auto _ret = __import_containsItem(this.__handle, cast(void*)(itemId.ptr), itemId.length);
|
||||
return (_ret) != 0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]inventory.contains-item")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:inventory.contains_item")
|
||||
static private extern(C) uint __import_containsItem(uint, void*, size_t) nothrow;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Specialized player inventory handle providing access to main inventory, armor, offhand, and hotbar.
|
||||
+/
|
||||
struct PlayerInventory {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
|
||||
pragma(inline, true) void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[resource-drop]player-inventory")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:resource_drop:player_inventory")
|
||||
static private extern(C) void __import_drop(uint) @nogc nothrow;
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true) typeof(this) witClone() const @safe @nogc nothrow { return typeof(this)(__handle); }
|
||||
// TODO: make RAII? disable copy for the own
|
||||
|
||||
Borrow borrow() => Borrow(__handle);
|
||||
alias borrow this;
|
||||
|
||||
struct Borrow {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true)
|
||||
void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
pragma(inline, true) Borrow witClone() const @safe @nogc nothrow { return Borrow(__handle); }
|
||||
|
||||
/++
|
||||
Returns the generic 36-slot inventory handle (hotbar + main storage).
|
||||
+/
|
||||
Inventory asInventory() @trusted nothrow {
|
||||
auto _ret = __import_asInventory(this.__handle);
|
||||
auto _handle0 = Inventory(_ret);
|
||||
return _handle0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.as-inventory")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.as_inventory")
|
||||
static private extern(C) uint __import_asInventory(uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns the item currently held in the specified hand.
|
||||
+/
|
||||
Option!(ItemStack) getItemInHand(Hand hand) @trusted nothrow {
|
||||
align(4) void[8] _retArea = void;
|
||||
__import_getItemInHand(this.__handle, cast(uint)(hand), _retArea.ptr);
|
||||
Option!(ItemStack) _option3 = void;
|
||||
bool _isSome3 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome3) {
|
||||
auto _handle2 = ItemStack(*(cast(uint*)(_retArea.ptr + 4)));
|
||||
|
||||
_option3 = Option!(ItemStack).makeSome(_handle2);
|
||||
} else {
|
||||
_option3 = Option!(ItemStack).makeNone;
|
||||
}
|
||||
auto _flush4 = _option3;
|
||||
return _flush4;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.get-item-in-hand")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.get_item_in_hand")
|
||||
static private extern(C) void __import_getItemInHand(uint, uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Sets the item in the specified hand.
|
||||
+/
|
||||
void setItemInHand(Hand hand, in Option!(ItemStack) item) @trusted nothrow {
|
||||
uint _option4 = void;
|
||||
uint _option5 = void;
|
||||
if (item.isSome) {
|
||||
ref _payload3 = item.unwrap();
|
||||
_option4 = 1;
|
||||
_option5 = _payload3.__handle;
|
||||
} else {
|
||||
_option4 = 0;
|
||||
_option5 = 0;
|
||||
}
|
||||
__import_setItemInHand(this.__handle, cast(uint)(hand), _option4, _option5);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.set-item-in-hand")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.set_item_in_hand")
|
||||
static private extern(C) void __import_setItemInHand(uint, uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns the currently selected hotbar slot index (0-8).
|
||||
+/
|
||||
ubyte getSelectedSlot() @trusted nothrow {
|
||||
auto _ret = __import_getSelectedSlot(this.__handle);
|
||||
return cast(ubyte)(_ret);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.get-selected-slot")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.get_selected_slot")
|
||||
static private extern(C) uint __import_getSelectedSlot(uint) nothrow;
|
||||
|
||||
/++
|
||||
Sets the currently selected hotbar slot index (0-8).
|
||||
+/
|
||||
void setSelectedSlot(ubyte slot) @trusted nothrow {
|
||||
__import_setSelectedSlot(this.__handle, cast(uint)(slot));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.set-selected-slot")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.set_selected_slot")
|
||||
static private extern(C) void __import_setSelectedSlot(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Armor slot accessors
|
||||
+/
|
||||
Option!(ItemStack) getHelmet() @trusted nothrow {
|
||||
align(4) void[8] _retArea = void;
|
||||
__import_getHelmet(this.__handle, _retArea.ptr);
|
||||
Option!(ItemStack) _option3 = void;
|
||||
bool _isSome3 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome3) {
|
||||
auto _handle2 = ItemStack(*(cast(uint*)(_retArea.ptr + 4)));
|
||||
|
||||
_option3 = Option!(ItemStack).makeSome(_handle2);
|
||||
} else {
|
||||
_option3 = Option!(ItemStack).makeNone;
|
||||
}
|
||||
auto _flush4 = _option3;
|
||||
return _flush4;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.get-helmet")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.get_helmet")
|
||||
static private extern(C) void __import_getHelmet(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void setHelmet(in Option!(ItemStack) item) @trusted nothrow {
|
||||
uint _option4 = void;
|
||||
uint _option5 = void;
|
||||
if (item.isSome) {
|
||||
ref _payload3 = item.unwrap();
|
||||
_option4 = 1;
|
||||
_option5 = _payload3.__handle;
|
||||
} else {
|
||||
_option4 = 0;
|
||||
_option5 = 0;
|
||||
}
|
||||
__import_setHelmet(this.__handle, _option4, _option5);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.set-helmet")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.set_helmet")
|
||||
static private extern(C) void __import_setHelmet(uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(ItemStack) getChestplate() @trusted nothrow {
|
||||
align(4) void[8] _retArea = void;
|
||||
__import_getChestplate(this.__handle, _retArea.ptr);
|
||||
Option!(ItemStack) _option3 = void;
|
||||
bool _isSome3 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome3) {
|
||||
auto _handle2 = ItemStack(*(cast(uint*)(_retArea.ptr + 4)));
|
||||
|
||||
_option3 = Option!(ItemStack).makeSome(_handle2);
|
||||
} else {
|
||||
_option3 = Option!(ItemStack).makeNone;
|
||||
}
|
||||
auto _flush4 = _option3;
|
||||
return _flush4;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.get-chestplate")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.get_chestplate")
|
||||
static private extern(C) void __import_getChestplate(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void setChestplate(in Option!(ItemStack) item) @trusted nothrow {
|
||||
uint _option4 = void;
|
||||
uint _option5 = void;
|
||||
if (item.isSome) {
|
||||
ref _payload3 = item.unwrap();
|
||||
_option4 = 1;
|
||||
_option5 = _payload3.__handle;
|
||||
} else {
|
||||
_option4 = 0;
|
||||
_option5 = 0;
|
||||
}
|
||||
__import_setChestplate(this.__handle, _option4, _option5);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.set-chestplate")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.set_chestplate")
|
||||
static private extern(C) void __import_setChestplate(uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(ItemStack) getLeggings() @trusted nothrow {
|
||||
align(4) void[8] _retArea = void;
|
||||
__import_getLeggings(this.__handle, _retArea.ptr);
|
||||
Option!(ItemStack) _option3 = void;
|
||||
bool _isSome3 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome3) {
|
||||
auto _handle2 = ItemStack(*(cast(uint*)(_retArea.ptr + 4)));
|
||||
|
||||
_option3 = Option!(ItemStack).makeSome(_handle2);
|
||||
} else {
|
||||
_option3 = Option!(ItemStack).makeNone;
|
||||
}
|
||||
auto _flush4 = _option3;
|
||||
return _flush4;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.get-leggings")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.get_leggings")
|
||||
static private extern(C) void __import_getLeggings(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void setLeggings(in Option!(ItemStack) item) @trusted nothrow {
|
||||
uint _option4 = void;
|
||||
uint _option5 = void;
|
||||
if (item.isSome) {
|
||||
ref _payload3 = item.unwrap();
|
||||
_option4 = 1;
|
||||
_option5 = _payload3.__handle;
|
||||
} else {
|
||||
_option4 = 0;
|
||||
_option5 = 0;
|
||||
}
|
||||
__import_setLeggings(this.__handle, _option4, _option5);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.set-leggings")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.set_leggings")
|
||||
static private extern(C) void __import_setLeggings(uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(ItemStack) getBoots() @trusted nothrow {
|
||||
align(4) void[8] _retArea = void;
|
||||
__import_getBoots(this.__handle, _retArea.ptr);
|
||||
Option!(ItemStack) _option3 = void;
|
||||
bool _isSome3 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome3) {
|
||||
auto _handle2 = ItemStack(*(cast(uint*)(_retArea.ptr + 4)));
|
||||
|
||||
_option3 = Option!(ItemStack).makeSome(_handle2);
|
||||
} else {
|
||||
_option3 = Option!(ItemStack).makeNone;
|
||||
}
|
||||
auto _flush4 = _option3;
|
||||
return _flush4;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.get-boots")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.get_boots")
|
||||
static private extern(C) void __import_getBoots(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void setBoots(in Option!(ItemStack) item) @trusted nothrow {
|
||||
uint _option4 = void;
|
||||
uint _option5 = void;
|
||||
if (item.isSome) {
|
||||
ref _payload3 = item.unwrap();
|
||||
_option4 = 1;
|
||||
_option5 = _payload3.__handle;
|
||||
} else {
|
||||
_option4 = 0;
|
||||
_option5 = 0;
|
||||
}
|
||||
__import_setBoots(this.__handle, _option4, _option5);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.set-boots")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.set_boots")
|
||||
static private extern(C) void __import_setBoots(uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(ItemStack) getOffHand() @trusted nothrow {
|
||||
align(4) void[8] _retArea = void;
|
||||
__import_getOffHand(this.__handle, _retArea.ptr);
|
||||
Option!(ItemStack) _option3 = void;
|
||||
bool _isSome3 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome3) {
|
||||
auto _handle2 = ItemStack(*(cast(uint*)(_retArea.ptr + 4)));
|
||||
|
||||
_option3 = Option!(ItemStack).makeSome(_handle2);
|
||||
} else {
|
||||
_option3 = Option!(ItemStack).makeNone;
|
||||
}
|
||||
auto _flush4 = _option3;
|
||||
return _flush4;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.get-off-hand")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.get_off_hand")
|
||||
static private extern(C) void __import_getOffHand(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void setOffHand(in Option!(ItemStack) item) @trusted nothrow {
|
||||
uint _option4 = void;
|
||||
uint _option5 = void;
|
||||
if (item.isSome) {
|
||||
ref _payload3 = item.unwrap();
|
||||
_option4 = 1;
|
||||
_option5 = _payload3.__handle;
|
||||
} else {
|
||||
_option4 = 0;
|
||||
_option5 = 0;
|
||||
}
|
||||
__import_setOffHand(this.__handle, _option4, _option5);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.set-off-hand")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.set_off_hand")
|
||||
static private extern(C) void __import_setOffHand(uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Clears all armor slots.
|
||||
+/
|
||||
void clearArmor() @trusted nothrow {
|
||||
__import_clearArmor(this.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.clear-armor")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.clear_armor")
|
||||
static private extern(C) void __import_clearArmor(uint) nothrow;
|
||||
|
||||
/++
|
||||
Clears the 36 main inventory slots.
|
||||
+/
|
||||
void clearMain() @trusted nothrow {
|
||||
__import_clearMain(this.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.clear-main")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.clear_main")
|
||||
static private extern(C) void __import_clearMain(uint) nothrow;
|
||||
|
||||
/++
|
||||
Clears all slots (main inventory, armor, offhand).
|
||||
+/
|
||||
void clearAll() @trusted nothrow {
|
||||
__import_clearAll(this.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/inventory@0.1.0", "[method]player-inventory.clear-all")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__inventory@0.1.0__:method:player_inventory.clear_all")
|
||||
static private extern(C) void __import_clearAll(uint) nothrow;
|
||||
}
|
||||
}
|
||||
20
src/wit/pumpkin/plugin/ipc/common.d
Normal file
20
src/wit/pumpkin/plugin/ipc/common.d
Normal file
@ -0,0 +1,20 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.ipc.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias PluginId = WitString;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias IpcMessage = WitList!(ubyte);
|
||||
50
src/wit/pumpkin/plugin/ipc/imports.d
Normal file
50
src/wit/pumpkin/plugin/ipc/imports.d
Normal file
@ -0,0 +1,50 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.ipc.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.ipc.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
Sends a message to the specified plugin, synchronously receiving a response (or an error).
|
||||
+/
|
||||
Result!(Result!(IpcMessage, WitString), void) sendIpcMessage(in PluginId recipient, in IpcMessage message) @trusted nothrow {
|
||||
align(size_t.sizeof) void[(4*size_t.sizeof)] _retArea = void;
|
||||
__import_sendIpcMessage(cast(void*)(recipient.ptr), recipient.length, cast(void*)(message.ptr), message.length, _retArea.ptr);
|
||||
Result!(Result!(IpcMessage, WitString), void) _result9 = void;
|
||||
bool _isErr9 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isErr9) {
|
||||
|
||||
_result9 = Result!(Result!(IpcMessage, WitString), void).makeErr();
|
||||
} else {
|
||||
Result!(IpcMessage, WitString) _result7 = void;
|
||||
bool _isErr7 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + size_t.sizeof)))) != 0;
|
||||
if (_isErr7) {
|
||||
auto _len5 = *(cast(size_t*)(_retArea.ptr + (3*size_t.sizeof)));
|
||||
auto _ptr5 = _len5 ? cast(char*)(*(cast(void**)(_retArea.ptr + (2*size_t.sizeof)))) : null;
|
||||
auto _list6 = WitString(_ptr5[0.._len5]);
|
||||
|
||||
_result7 = Result!(IpcMessage, WitString).makeErr(_list6);
|
||||
} else {
|
||||
auto _len2 = *(cast(size_t*)(_retArea.ptr + (3*size_t.sizeof)));
|
||||
auto _ptr2 = _len2 ? cast(ubyte*)(*(cast(void**)(_retArea.ptr + (2*size_t.sizeof)))) : null;
|
||||
auto _list3 = IpcMessage(_ptr2[0.._len2]);
|
||||
|
||||
_result7 = Result!(IpcMessage, WitString).makeOk(_list3);
|
||||
}
|
||||
|
||||
_result9 = Result!(Result!(IpcMessage, WitString), void).makeOk(_result7);
|
||||
}
|
||||
auto _flush10 = _result9;
|
||||
return _flush10;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/ipc@0.1.0", "send-ipc-message")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__ipc@0.1.0__send_ipc_message")
|
||||
private extern(C) void __import_sendIpcMessage(void*, size_t, void*, size_t, void*) nothrow;
|
||||
176
src/wit/pumpkin/plugin/item_stack/common.d
Normal file
176
src/wit/pumpkin/plugin/item_stack/common.d
Normal file
@ -0,0 +1,176 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.item_stack.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.attributes.common;
|
||||
static import wit.pumpkin.plugin.common.common;
|
||||
static import wit.pumpkin.plugin.data_components.common;
|
||||
static import wit.pumpkin.plugin.text.common;
|
||||
static import wit.pumpkin.plugin.enchantments.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias Attribute = wit.pumpkin.plugin.attributes.common.Attribute;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias AttributeModifier = wit.pumpkin.plugin.attributes.common.AttributeModifier;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias DataComponent = wit.pumpkin.plugin.data_components.common.DataComponent;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias AttributeModifierSlot = wit.pumpkin.plugin.enchantments.common.AttributeModifierSlot;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias Enchantment = wit.pumpkin.plugin.enchantments.common.Enchantment;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias NbtEntry = wit.pumpkin.plugin.common.common.NbtEntry;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias NbtTree = wit.pumpkin.plugin.common.common.NbtTree;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias NbtTag = wit.pumpkin.plugin.common.common.NbtTag;
|
||||
|
||||
/++
|
||||
Represents an enchantment and its level.
|
||||
+/
|
||||
struct EnchantmentValue {
|
||||
/++
|
||||
|
||||
+/
|
||||
Enchantment enchantment;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
uint level;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
EnchantmentValue witClone() const @nogc nothrow {
|
||||
EnchantmentValue clone = void;
|
||||
clone.enchantment = this.enchantment.witClone;
|
||||
clone.level = this.level.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Represents a custom enchantment and its level on an item stack.
|
||||
+/
|
||||
struct CustomEnchantmentValue {
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString enchantmentId;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
uint level;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
enchantmentId.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
CustomEnchantmentValue witClone() const @nogc nothrow {
|
||||
CustomEnchantmentValue clone = void;
|
||||
clone.enchantmentId = this.enchantmentId.witClone;
|
||||
clone.level = this.level.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Represents an attribute modifier applied to an item stack for a specific slot.
|
||||
+/
|
||||
struct ItemAttributeModifier {
|
||||
/++
|
||||
|
||||
+/
|
||||
Attribute attribute;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
AttributeModifier modifier;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
AttributeModifierSlot slot;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
modifier.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
ItemAttributeModifier witClone() const @nogc nothrow {
|
||||
ItemAttributeModifier clone = void;
|
||||
clone.attribute = this.attribute.witClone;
|
||||
clone.modifier = this.modifier.witClone;
|
||||
clone.slot = this.slot.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Represents a data component and its serialized value.
|
||||
+/
|
||||
struct DataComponentValue {
|
||||
/++
|
||||
|
||||
+/
|
||||
DataComponent component;
|
||||
|
||||
/++
|
||||
The serialized value of the component.
|
||||
+/
|
||||
WitList!(ubyte) value;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
value.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
DataComponentValue witClone() const @nogc nothrow {
|
||||
DataComponentValue clone = void;
|
||||
clone.component = this.component.witClone;
|
||||
clone.value = this.value.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
742
src/wit/pumpkin/plugin/item_stack/imports.d
Normal file
742
src/wit/pumpkin/plugin/item_stack/imports.d
Normal file
@ -0,0 +1,742 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.item_stack.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.item_stack.common;
|
||||
|
||||
static import wit.pumpkin.plugin.attributes.imports;
|
||||
static import wit.pumpkin.plugin.common.imports;
|
||||
static import wit.pumpkin.plugin.data_components.imports;
|
||||
static import wit.pumpkin.plugin.text.imports;
|
||||
static import wit.pumpkin.plugin.enchantments.imports;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias TextComponent = wit.pumpkin.plugin.text.imports.TextComponent;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
struct ItemStack {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
static ItemStack makeNew(in WitString registryKey, ubyte count) @trusted nothrow {
|
||||
auto _ret = __import_makeNew(cast(void*)(registryKey.ptr), registryKey.length, cast(uint)(count));
|
||||
auto _handle0 = ItemStack(_ret);
|
||||
return _handle0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[constructor]item-stack")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:constructor:item_stack")
|
||||
static private extern(C) uint __import_makeNew(void*, size_t, uint) nothrow;
|
||||
|
||||
pragma(inline, true) void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[resource-drop]item-stack")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:resource_drop:item_stack")
|
||||
static private extern(C) void __import_drop(uint) @nogc nothrow;
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true) typeof(this) witClone() const @safe @nogc nothrow { return typeof(this)(__handle); }
|
||||
// TODO: make RAII? disable copy for the own
|
||||
|
||||
Borrow borrow() => Borrow(__handle);
|
||||
alias borrow this;
|
||||
|
||||
struct Borrow {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true)
|
||||
void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
pragma(inline, true) Borrow witClone() const @safe @nogc nothrow { return Borrow(__handle); }
|
||||
|
||||
/++
|
||||
Returns the unique registry key of the item (e.g., "minecraft:diamond").
|
||||
+/
|
||||
WitString getRegistryKey() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_getRegistryKey(this.__handle, _retArea.ptr);
|
||||
auto _len0 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _ptr0 = _len0 ? cast(char*)(*(cast(void**)(_retArea.ptr + 0))) : null;
|
||||
auto _list1 = WitString(_ptr0[0.._len0]);
|
||||
auto _flush2 = _list1;
|
||||
return _flush2;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.get-registry-key")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.get_registry_key")
|
||||
static private extern(C) void __import_getRegistryKey(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Returns the number of items in the stack.
|
||||
+/
|
||||
ubyte getCount() @trusted nothrow {
|
||||
auto _ret = __import_getCount(this.__handle);
|
||||
return cast(ubyte)(_ret);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.get-count")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.get_count")
|
||||
static private extern(C) uint __import_getCount(uint) nothrow;
|
||||
|
||||
/++
|
||||
Sets the number of items in the stack.
|
||||
+/
|
||||
void setCount(ubyte count) @trusted nothrow {
|
||||
__import_setCount(this.__handle, cast(uint)(count));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.set-count")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.set_count")
|
||||
static private extern(C) void __import_setCount(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns the maximum number of items that can be in this stack.
|
||||
+/
|
||||
ubyte getMaxCount() @trusted nothrow {
|
||||
auto _ret = __import_getMaxCount(this.__handle);
|
||||
return cast(ubyte)(_ret);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.get-max-count")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.get_max_count")
|
||||
static private extern(C) uint __import_getMaxCount(uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns all enchantments on this item stack.
|
||||
+/
|
||||
WitList!(EnchantmentValue) getEnchantments() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_getEnchantments(this.__handle, _retArea.ptr);
|
||||
auto _listSrcPtr2 = *(cast(void**)(_retArea.ptr + 0));
|
||||
auto _listLen2 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _list2 = _listLen2 ? wit.common.mallocSlice!(EnchantmentValue)(_listLen2) : [];
|
||||
assert(!_listLen2 || _list2.ptr);
|
||||
foreach (_elem0_idx, ref _elem0; _list2) {
|
||||
const auto _base0 = _listSrcPtr2 + _elem0_idx * 8;
|
||||
EnchantmentValue _record1 = {
|
||||
enchantment: cast(wit.pumpkin.plugin.enchantments.imports.Enchantment)(cast(uint)(*(cast(ubyte*)(_base0 + 0)))),
|
||||
level: *(cast(uint*)(_base0 + 4)),
|
||||
};
|
||||
_elem0 = _record1;
|
||||
}
|
||||
if (_listLen2) wit.common.free(_listSrcPtr2);
|
||||
auto _witList3 = WitList!(EnchantmentValue)(_list2);
|
||||
auto _flush4 = _witList3;
|
||||
return _flush4;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.get-enchantments")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.get_enchantments")
|
||||
static private extern(C) void __import_getEnchantments(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Adds an enchantment to this item stack.
|
||||
+/
|
||||
void addEnchantment(Enchantment enchantment, uint level) @trusted nothrow {
|
||||
__import_addEnchantment(this.__handle, cast(uint)(enchantment), level);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.add-enchantment")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.add_enchantment")
|
||||
static private extern(C) void __import_addEnchantment(uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Removes an enchantment from this item stack.
|
||||
+/
|
||||
void removeEnchantment(Enchantment enchantment) @trusted nothrow {
|
||||
__import_removeEnchantment(this.__handle, cast(uint)(enchantment));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.remove-enchantment")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.remove_enchantment")
|
||||
static private extern(C) void __import_removeEnchantment(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns all custom enchantments on this item stack.
|
||||
+/
|
||||
WitList!(CustomEnchantmentValue) getCustomEnchantments() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_getCustomEnchantments(this.__handle, _retArea.ptr);
|
||||
auto _listSrcPtr4 = *(cast(void**)(_retArea.ptr + 0));
|
||||
auto _listLen4 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _list4 = _listLen4 ? wit.common.mallocSlice!(CustomEnchantmentValue)(_listLen4) : [];
|
||||
assert(!_listLen4 || _list4.ptr);
|
||||
foreach (_elem0_idx, ref _elem0; _list4) {
|
||||
const auto _base0 = _listSrcPtr4 + _elem0_idx * (3*size_t.sizeof);
|
||||
auto _len1 = *(cast(size_t*)(_base0 + size_t.sizeof));
|
||||
auto _ptr1 = _len1 ? cast(char*)(*(cast(void**)(_base0 + 0))) : null;
|
||||
auto _list2 = WitString(_ptr1[0.._len1]);
|
||||
CustomEnchantmentValue _record3 = {
|
||||
enchantmentId: _list2,
|
||||
level: *(cast(uint*)(_base0 + (2*size_t.sizeof))),
|
||||
};
|
||||
_elem0 = _record3;
|
||||
}
|
||||
if (_listLen4) wit.common.free(_listSrcPtr4);
|
||||
auto _witList5 = WitList!(CustomEnchantmentValue)(_list4);
|
||||
auto _flush6 = _witList5;
|
||||
return _flush6;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.get-custom-enchantments")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.get_custom_enchantments")
|
||||
static private extern(C) void __import_getCustomEnchantments(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Adds a custom enchantment to this item stack.
|
||||
+/
|
||||
void addCustomEnchantment(in WitString enchantmentId, uint level) @trusted nothrow {
|
||||
__import_addCustomEnchantment(this.__handle, cast(void*)(enchantmentId.ptr), enchantmentId.length, level);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.add-custom-enchantment")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.add_custom_enchantment")
|
||||
static private extern(C) void __import_addCustomEnchantment(uint, void*, size_t, uint) nothrow;
|
||||
|
||||
/++
|
||||
Removes a custom enchantment from this item stack.
|
||||
+/
|
||||
void removeCustomEnchantment(in WitString enchantmentId) @trusted nothrow {
|
||||
__import_removeCustomEnchantment(this.__handle, cast(void*)(enchantmentId.ptr), enchantmentId.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.remove-custom-enchantment")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.remove_custom_enchantment")
|
||||
static private extern(C) void __import_removeCustomEnchantment(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Returns the level of a custom enchantment on this item stack, if present.
|
||||
+/
|
||||
Option!(uint) getCustomEnchantmentLevel(in WitString enchantmentId) @trusted nothrow {
|
||||
align(4) void[8] _retArea = void;
|
||||
__import_getCustomEnchantmentLevel(this.__handle, cast(void*)(enchantmentId.ptr), enchantmentId.length, _retArea.ptr);
|
||||
Option!(uint) _option2 = void;
|
||||
bool _isSome2 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome2) {
|
||||
|
||||
_option2 = Option!(uint).makeSome(*(cast(uint*)(_retArea.ptr + 4)));
|
||||
} else {
|
||||
_option2 = Option!(uint).makeNone;
|
||||
}
|
||||
auto _flush3 = _option2;
|
||||
return _flush3;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.get-custom-enchantment-level")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.get_custom_enchantment_level")
|
||||
static private extern(C) void __import_getCustomEnchantmentLevel(uint, void*, size_t, void*) nothrow;
|
||||
|
||||
/++
|
||||
Returns whether this item stack has a specific custom enchantment.
|
||||
+/
|
||||
bool hasCustomEnchantment(in WitString enchantmentId) @trusted nothrow {
|
||||
auto _ret = __import_hasCustomEnchantment(this.__handle, cast(void*)(enchantmentId.ptr), enchantmentId.length);
|
||||
return (_ret) != 0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.has-custom-enchantment")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.has_custom_enchantment")
|
||||
static private extern(C) uint __import_hasCustomEnchantment(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Returns all attribute modifiers on this item stack.
|
||||
+/
|
||||
WitList!(ItemAttributeModifier) getAttributeModifiers() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_getAttributeModifiers(this.__handle, _retArea.ptr);
|
||||
auto _listSrcPtr5 = *(cast(void**)(_retArea.ptr + 0));
|
||||
auto _listLen5 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _list5 = _listLen5 ? wit.common.mallocSlice!(ItemAttributeModifier)(_listLen5) : [];
|
||||
assert(!_listLen5 || _list5.ptr);
|
||||
foreach (_elem0_idx, ref _elem0; _list5) {
|
||||
const auto _base0 = _listSrcPtr5 + _elem0_idx * (32+2*size_t.sizeof);
|
||||
auto _len1 = *(cast(size_t*)(_base0 + (8+1*size_t.sizeof)));
|
||||
auto _ptr1 = _len1 ? cast(char*)(*(cast(void**)(_base0 + 8))) : null;
|
||||
auto _list2 = WitString(_ptr1[0.._len1]);
|
||||
wit.pumpkin.plugin.attributes.imports.AttributeModifier _record3 = {
|
||||
id: _list2,
|
||||
amount: *(cast(double*)(_base0 + (8+2*size_t.sizeof))),
|
||||
operation: cast(wit.pumpkin.plugin.attributes.imports.ModifierOperation)(cast(uint)(*(cast(ubyte*)(_base0 + (16+2*size_t.sizeof))))),
|
||||
};
|
||||
ItemAttributeModifier _record4 = {
|
||||
attribute: cast(wit.pumpkin.plugin.attributes.imports.Attribute)(cast(uint)(*(cast(ubyte*)(_base0 + 0)))),
|
||||
modifier: _record3,
|
||||
slot: cast(wit.pumpkin.plugin.enchantments.imports.AttributeModifierSlot)(cast(uint)(*(cast(ubyte*)(_base0 + (24+2*size_t.sizeof))))),
|
||||
};
|
||||
_elem0 = _record4;
|
||||
}
|
||||
if (_listLen5) wit.common.free(_listSrcPtr5);
|
||||
auto _witList6 = WitList!(ItemAttributeModifier)(_list5);
|
||||
auto _flush7 = _witList6;
|
||||
return _flush7;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.get-attribute-modifiers")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.get_attribute_modifiers")
|
||||
static private extern(C) void __import_getAttributeModifiers(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Adds an attribute modifier to this item stack.
|
||||
+/
|
||||
void addAttributeModifier(in ItemAttributeModifier modifier) @trusted nothrow {
|
||||
__import_addAttributeModifier(this.__handle, cast(uint)(modifier.attribute), cast(void*)(modifier.modifier.id.ptr), modifier.modifier.id.length, modifier.modifier.amount, cast(uint)(modifier.modifier.operation), cast(uint)(modifier.slot));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.add-attribute-modifier")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.add_attribute_modifier")
|
||||
static private extern(C) void __import_addAttributeModifier(uint, uint, void*, size_t, double, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Removes all attribute modifiers for a specific attribute from this item stack.
|
||||
+/
|
||||
void removeAttributeModifiers(Attribute attribute) @trusted nothrow {
|
||||
__import_removeAttributeModifiers(this.__handle, cast(uint)(attribute));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.remove-attribute-modifiers")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.remove_attribute_modifiers")
|
||||
static private extern(C) void __import_removeAttributeModifiers(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Clears all custom attribute modifiers from this item stack.
|
||||
+/
|
||||
void clearAttributeModifiers() @trusted nothrow {
|
||||
__import_clearAttributeModifiers(this.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.clear-attribute-modifiers")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.clear_attribute_modifiers")
|
||||
static private extern(C) void __import_clearAttributeModifiers(uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns the lore of this item stack.
|
||||
+/
|
||||
WitList!(TextComponent) getLore() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_getLore(this.__handle, _retArea.ptr);
|
||||
auto _len0 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _ptr0 = _len0 ? cast(TextComponent*)(*(cast(void**)(_retArea.ptr + 0))) : null;
|
||||
auto _list1 = WitList!(TextComponent)(_ptr0[0.._len0]);
|
||||
auto _flush2 = _list1;
|
||||
return _flush2;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.get-lore")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.get_lore")
|
||||
static private extern(C) void __import_getLore(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Sets the lore of this item stack.
|
||||
+/
|
||||
void setLore(in WitList!(TextComponent) lore) @trusted nothrow {
|
||||
__import_setLore(this.__handle, cast(void*)(lore.ptr), lore.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.set-lore")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.set_lore")
|
||||
static private extern(C) void __import_setLore(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Adds a line to the lore of this item stack.
|
||||
+/
|
||||
void addLore(TextComponent line) @trusted nothrow {
|
||||
__import_addLore(this.__handle, line.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.add-lore")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.add_lore")
|
||||
static private extern(C) void __import_addLore(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Returns the custom name of this item stack, if set.
|
||||
+/
|
||||
Option!(TextComponent) getCustomName() @trusted nothrow {
|
||||
align(4) void[8] _retArea = void;
|
||||
__import_getCustomName(this.__handle, _retArea.ptr);
|
||||
Option!(TextComponent) _option3 = void;
|
||||
bool _isSome3 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome3) {
|
||||
auto _handle2 = TextComponent(*(cast(uint*)(_retArea.ptr + 4)));
|
||||
|
||||
_option3 = Option!(TextComponent).makeSome(_handle2);
|
||||
} else {
|
||||
_option3 = Option!(TextComponent).makeNone;
|
||||
}
|
||||
auto _flush4 = _option3;
|
||||
return _flush4;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.get-custom-name")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.get_custom_name")
|
||||
static private extern(C) void __import_getCustomName(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Sets the custom name of this item stack.
|
||||
+/
|
||||
void setCustomName(in Option!(TextComponent) name) @trusted nothrow {
|
||||
uint _option4 = void;
|
||||
uint _option5 = void;
|
||||
if (name.isSome) {
|
||||
ref _payload3 = name.unwrap();
|
||||
_option4 = 1;
|
||||
_option5 = _payload3.__handle;
|
||||
} else {
|
||||
_option4 = 0;
|
||||
_option5 = 0;
|
||||
}
|
||||
__import_setCustomName(this.__handle, _option4, _option5);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.set-custom-name")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.set_custom_name")
|
||||
static private extern(C) void __import_setCustomName(uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Sets a namespaced custom data value on this item stack.
|
||||
+/
|
||||
void setCustomData(in WitString namespace, in WitString key, in NbtTree value) @trusted nothrow {
|
||||
wit.common.DeallocateBuffer deallocate;
|
||||
auto _listSrc28 = value.tags;
|
||||
auto _list28 = _listSrc28.length ? wit.common.malloc(_listSrc28.length * ((8+2*size_t.sizeof))) : null;
|
||||
assert(!_listSrc28.length || _list28);
|
||||
if (_listSrc28.length) deallocate ~= _list28;
|
||||
foreach (_elem0_idx, ref _elem0; _listSrc28) {
|
||||
auto _base0 = _list28 + _elem0_idx * ((8+2*size_t.sizeof));
|
||||
alias _Tag27 = wit.pumpkin.plugin.common.imports.NbtTag.Tag;
|
||||
final switch (_elem0.tag) {
|
||||
case _Tag27.byte_: {
|
||||
const ref byte _payload2 = _elem0.getByte();
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(0);
|
||||
*cast(ubyte*)(_base0 + 8) = cast(ubyte)(cast(uint)(_payload2));
|
||||
break;
|
||||
}
|
||||
case _Tag27.short_: {
|
||||
const ref short _payload4 = _elem0.getShort();
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(1);
|
||||
*cast(ushort*)(_base0 + 8) = cast(ushort)(cast(uint)(_payload4));
|
||||
break;
|
||||
}
|
||||
case _Tag27.int_: {
|
||||
const ref int _payload6 = _elem0.getInt();
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(2);
|
||||
*cast(uint*)(_base0 + 8) = cast(uint)(cast(uint)(_payload6));
|
||||
break;
|
||||
}
|
||||
case _Tag27.long_: {
|
||||
const ref long _payload8 = _elem0.getLong();
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(3);
|
||||
*cast(ulong*)(_base0 + 8) = cast(ulong)(cast(ulong)(_payload8));
|
||||
break;
|
||||
}
|
||||
case _Tag27.float_: {
|
||||
const ref float _payload10 = _elem0.getFloat();
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(4);
|
||||
*cast(float*)(_base0 + 8) = cast(float)(_payload10);
|
||||
break;
|
||||
}
|
||||
case _Tag27.double_: {
|
||||
const ref double _payload12 = _elem0.getDouble();
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(5);
|
||||
*cast(double*)(_base0 + 8) = cast(double)(_payload12);
|
||||
break;
|
||||
}
|
||||
case _Tag27.byteArray: {
|
||||
const ref WitList!(byte) _payload14 = _elem0.getByteArray();
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(6);
|
||||
*cast(size_t*)(_base0 + (8+1*size_t.sizeof)) = cast(size_t)(_payload14.length);
|
||||
*cast(void**)(_base0 + 8) = cast(void*)(cast(void*)(_payload14.ptr));
|
||||
break;
|
||||
}
|
||||
case _Tag27.stringTag: {
|
||||
const ref WitString _payload16 = _elem0.getStringTag();
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(7);
|
||||
*cast(size_t*)(_base0 + (8+1*size_t.sizeof)) = cast(size_t)(_payload16.length);
|
||||
*cast(void**)(_base0 + 8) = cast(void*)(cast(void*)(_payload16.ptr));
|
||||
break;
|
||||
}
|
||||
case _Tag27.listTag: {
|
||||
const ref WitList!(uint) _payload18 = _elem0.getListTag();
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(8);
|
||||
*cast(size_t*)(_base0 + (8+1*size_t.sizeof)) = cast(size_t)(_payload18.length);
|
||||
*cast(void**)(_base0 + 8) = cast(void*)(cast(void*)(_payload18.ptr));
|
||||
break;
|
||||
}
|
||||
case _Tag27.compound: {
|
||||
const ref WitList!(wit.pumpkin.plugin.common.imports.NbtEntry) _payload20 = _elem0.getCompound();
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(9);
|
||||
auto _listSrc22 = _payload20;
|
||||
auto _list22 = _listSrc22.length ? wit.common.malloc(_listSrc22.length * ((3*size_t.sizeof))) : null;
|
||||
assert(!_listSrc22.length || _list22);
|
||||
if (_listSrc22.length) deallocate ~= _list22;
|
||||
foreach (_elem21_idx, ref _elem21; _listSrc22) {
|
||||
auto _base21 = _list22 + _elem21_idx * ((3*size_t.sizeof));
|
||||
*cast(size_t*)(_base21 + size_t.sizeof) = cast(size_t)(_elem21.key.length);
|
||||
*cast(void**)(_base21 + 0) = cast(void*)(cast(void*)(_elem21.key.ptr));
|
||||
*cast(uint*)(_base21 + (2*size_t.sizeof)) = cast(uint)(_elem21.value);
|
||||
|
||||
}
|
||||
*cast(size_t*)(_base0 + (8+1*size_t.sizeof)) = cast(size_t)(_payload20.length);
|
||||
*cast(void**)(_base0 + 8) = cast(void*)(_list22);
|
||||
break;
|
||||
}
|
||||
case _Tag27.intArray: {
|
||||
const ref WitList!(int) _payload24 = _elem0.getIntArray();
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(10);
|
||||
*cast(size_t*)(_base0 + (8+1*size_t.sizeof)) = cast(size_t)(_payload24.length);
|
||||
*cast(void**)(_base0 + 8) = cast(void*)(cast(void*)(_payload24.ptr));
|
||||
break;
|
||||
}
|
||||
case _Tag27.longArray: {
|
||||
const ref WitList!(long) _payload26 = _elem0.getLongArray();
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(11);
|
||||
*cast(size_t*)(_base0 + (8+1*size_t.sizeof)) = cast(size_t)(_payload26.length);
|
||||
*cast(void**)(_base0 + 8) = cast(void*)(cast(void*)(_payload26.ptr));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
__import_setCustomData(this.__handle, cast(void*)(namespace.ptr), namespace.length, cast(void*)(key.ptr), key.length, value.root, _list28, value.tags.length);
|
||||
deallocate.purge();
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.set-custom-data")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.set_custom_data")
|
||||
static private extern(C) void __import_setCustomData(uint, void*, size_t, void*, size_t, uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Returns a namespaced custom data value from this item stack, if set.
|
||||
+/
|
||||
Option!(NbtTree) getCustomData(in WitString namespace, in WitString key) @trusted nothrow {
|
||||
align(size_t.sizeof) void[(4*size_t.sizeof)] _retArea = void;
|
||||
__import_getCustomData(this.__handle, cast(void*)(namespace.ptr), namespace.length, cast(void*)(key.ptr), key.length, _retArea.ptr);
|
||||
Option!(NbtTree) _option47 = void;
|
||||
bool _isSome47 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome47) {
|
||||
auto _listSrcPtr44 = *(cast(void**)(_retArea.ptr + (2*size_t.sizeof)));
|
||||
auto _listLen44 = *(cast(size_t*)(_retArea.ptr + (3*size_t.sizeof)));
|
||||
auto _list44 = _listLen44 ? wit.common.mallocSlice!(wit.pumpkin.plugin.common.imports.NbtTag)(_listLen44) : [];
|
||||
assert(!_listLen44 || _list44.ptr);
|
||||
foreach (_elem2_idx, ref _elem2; _list44) {
|
||||
const auto _base2 = _listSrcPtr44 + _elem2_idx * (8+2*size_t.sizeof);
|
||||
wit.pumpkin.plugin.common.imports.NbtTag _variant31 = void;
|
||||
auto _tag31 = cast(uint)(*(cast(ubyte*)(_base2 + 0)));
|
||||
alias _Tag31 = wit.pumpkin.plugin.common.imports.NbtTag.Tag;
|
||||
final switch (cast(wit.pumpkin.plugin.common.imports.NbtTag.Tag)_tag31) {
|
||||
case _Tag31.byte_: {
|
||||
auto _payload32 = cast(byte)(cast(uint)(*(cast(byte*)(_base2 + 8))));
|
||||
_variant31 = wit.pumpkin.plugin.common.imports.NbtTag.byte_(_payload32);
|
||||
break;
|
||||
}
|
||||
case _Tag31.short_: {
|
||||
auto _payload33 = cast(short)(cast(uint)(*(cast(short*)(_base2 + 8))));
|
||||
_variant31 = wit.pumpkin.plugin.common.imports.NbtTag.short_(_payload33);
|
||||
break;
|
||||
}
|
||||
case _Tag31.int_: {
|
||||
auto _payload34 = cast(int)(*(cast(uint*)(_base2 + 8)));
|
||||
_variant31 = wit.pumpkin.plugin.common.imports.NbtTag.int_(_payload34);
|
||||
break;
|
||||
}
|
||||
case _Tag31.long_: {
|
||||
auto _payload35 = cast(long)(*(cast(ulong*)(_base2 + 8)));
|
||||
_variant31 = wit.pumpkin.plugin.common.imports.NbtTag.long_(_payload35);
|
||||
break;
|
||||
}
|
||||
case _Tag31.float_: {
|
||||
auto _payload36 = *(cast(float*)(_base2 + 8));
|
||||
_variant31 = wit.pumpkin.plugin.common.imports.NbtTag.float_(_payload36);
|
||||
break;
|
||||
}
|
||||
case _Tag31.double_: {
|
||||
auto _payload37 = *(cast(double*)(_base2 + 8));
|
||||
_variant31 = wit.pumpkin.plugin.common.imports.NbtTag.double_(_payload37);
|
||||
break;
|
||||
}
|
||||
case _Tag31.byteArray: {
|
||||
auto _len10 = *(cast(size_t*)(_base2 + (8+1*size_t.sizeof)));
|
||||
auto _ptr10 = _len10 ? cast(byte*)(*(cast(void**)(_base2 + 8))) : null;
|
||||
auto _list11 = WitList!(byte)(_ptr10[0.._len10]);
|
||||
auto _payload38 = _list11;
|
||||
_variant31 = wit.pumpkin.plugin.common.imports.NbtTag.byteArray(_payload38);
|
||||
break;
|
||||
}
|
||||
case _Tag31.stringTag: {
|
||||
auto _len13 = *(cast(size_t*)(_base2 + (8+1*size_t.sizeof)));
|
||||
auto _ptr13 = _len13 ? cast(char*)(*(cast(void**)(_base2 + 8))) : null;
|
||||
auto _list14 = WitString(_ptr13[0.._len13]);
|
||||
auto _payload39 = _list14;
|
||||
_variant31 = wit.pumpkin.plugin.common.imports.NbtTag.stringTag(_payload39);
|
||||
break;
|
||||
}
|
||||
case _Tag31.listTag: {
|
||||
auto _len16 = *(cast(size_t*)(_base2 + (8+1*size_t.sizeof)));
|
||||
auto _ptr16 = _len16 ? cast(uint*)(*(cast(void**)(_base2 + 8))) : null;
|
||||
auto _list17 = WitList!(uint)(_ptr16[0.._len16]);
|
||||
auto _payload40 = _list17;
|
||||
_variant31 = wit.pumpkin.plugin.common.imports.NbtTag.listTag(_payload40);
|
||||
break;
|
||||
}
|
||||
case _Tag31.compound: {
|
||||
auto _listSrcPtr23 = *(cast(void**)(_base2 + 8));
|
||||
auto _listLen23 = *(cast(size_t*)(_base2 + (8+1*size_t.sizeof)));
|
||||
auto _list23 = _listLen23 ? wit.common.mallocSlice!(wit.pumpkin.plugin.common.imports.NbtEntry)(_listLen23) : [];
|
||||
assert(!_listLen23 || _list23.ptr);
|
||||
foreach (_elem19_idx, ref _elem19; _list23) {
|
||||
const auto _base19 = _listSrcPtr23 + _elem19_idx * (3*size_t.sizeof);
|
||||
auto _len20 = *(cast(size_t*)(_base19 + size_t.sizeof));
|
||||
auto _ptr20 = _len20 ? cast(char*)(*(cast(void**)(_base19 + 0))) : null;
|
||||
auto _list21 = WitString(_ptr20[0.._len20]);
|
||||
wit.pumpkin.plugin.common.imports.NbtEntry _record22 = {
|
||||
key: _list21,
|
||||
value: *(cast(uint*)(_base19 + (2*size_t.sizeof))),
|
||||
};
|
||||
_elem19 = _record22;
|
||||
}
|
||||
if (_listLen23) wit.common.free(_listSrcPtr23);
|
||||
auto _witList24 = WitList!(wit.pumpkin.plugin.common.imports.NbtEntry)(_list23);
|
||||
auto _payload41 = _witList24;
|
||||
_variant31 = wit.pumpkin.plugin.common.imports.NbtTag.compound(_payload41);
|
||||
break;
|
||||
}
|
||||
case _Tag31.intArray: {
|
||||
auto _len26 = *(cast(size_t*)(_base2 + (8+1*size_t.sizeof)));
|
||||
auto _ptr26 = _len26 ? cast(int*)(*(cast(void**)(_base2 + 8))) : null;
|
||||
auto _list27 = WitList!(int)(_ptr26[0.._len26]);
|
||||
auto _payload42 = _list27;
|
||||
_variant31 = wit.pumpkin.plugin.common.imports.NbtTag.intArray(_payload42);
|
||||
break;
|
||||
}
|
||||
case _Tag31.longArray: {
|
||||
auto _len29 = *(cast(size_t*)(_base2 + (8+1*size_t.sizeof)));
|
||||
auto _ptr29 = _len29 ? cast(long*)(*(cast(void**)(_base2 + 8))) : null;
|
||||
auto _list30 = WitList!(long)(_ptr29[0.._len29]);
|
||||
auto _payload43 = _list30;
|
||||
_variant31 = wit.pumpkin.plugin.common.imports.NbtTag.longArray(_payload43);
|
||||
break;
|
||||
}
|
||||
}
|
||||
_elem2 = _variant31;
|
||||
}
|
||||
if (_listLen44) wit.common.free(_listSrcPtr44);
|
||||
auto _witList45 = WitList!(wit.pumpkin.plugin.common.imports.NbtTag)(_list44);
|
||||
wit.pumpkin.plugin.common.imports.NbtTree _record46 = {
|
||||
root: *(cast(uint*)(_retArea.ptr + size_t.sizeof)),
|
||||
tags: _witList45,
|
||||
};
|
||||
|
||||
_option47 = Option!(NbtTree).makeSome(_record46);
|
||||
} else {
|
||||
_option47 = Option!(NbtTree).makeNone;
|
||||
}
|
||||
auto _flush48 = _option47;
|
||||
return _flush48;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.get-custom-data")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.get_custom_data")
|
||||
static private extern(C) void __import_getCustomData(uint, void*, size_t, void*, size_t, void*) nothrow;
|
||||
|
||||
/++
|
||||
Removes a namespaced custom data value from this item stack.
|
||||
+/
|
||||
void removeCustomData(in WitString namespace, in WitString key) @trusted nothrow {
|
||||
__import_removeCustomData(this.__handle, cast(void*)(namespace.ptr), namespace.length, cast(void*)(key.ptr), key.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.remove-custom-data")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.remove_custom_data")
|
||||
static private extern(C) void __import_removeCustomData(uint, void*, size_t, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Returns whether this item stack has a namespaced custom data value.
|
||||
+/
|
||||
bool hasCustomData(in WitString namespace, in WitString key) @trusted nothrow {
|
||||
auto _ret = __import_hasCustomData(this.__handle, cast(void*)(namespace.ptr), namespace.length, cast(void*)(key.ptr), key.length);
|
||||
return (_ret) != 0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.has-custom-data")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.has_custom_data")
|
||||
static private extern(C) uint __import_hasCustomData(uint, void*, size_t, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Returns all data components on this item stack.
|
||||
+/
|
||||
WitList!(DataComponentValue) getComponents() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_getComponents(this.__handle, _retArea.ptr);
|
||||
auto _listSrcPtr4 = *(cast(void**)(_retArea.ptr + 0));
|
||||
auto _listLen4 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _list4 = _listLen4 ? wit.common.mallocSlice!(DataComponentValue)(_listLen4) : [];
|
||||
assert(!_listLen4 || _list4.ptr);
|
||||
foreach (_elem0_idx, ref _elem0; _list4) {
|
||||
const auto _base0 = _listSrcPtr4 + _elem0_idx * (3*size_t.sizeof);
|
||||
auto _len1 = *(cast(size_t*)(_base0 + (2*size_t.sizeof)));
|
||||
auto _ptr1 = _len1 ? cast(ubyte*)(*(cast(void**)(_base0 + size_t.sizeof))) : null;
|
||||
auto _list2 = WitList!(ubyte)(_ptr1[0.._len1]);
|
||||
DataComponentValue _record3 = {
|
||||
component: cast(wit.pumpkin.plugin.data_components.imports.DataComponent)(cast(uint)(*(cast(ubyte*)(_base0 + 0)))),
|
||||
value: _list2,
|
||||
};
|
||||
_elem0 = _record3;
|
||||
}
|
||||
if (_listLen4) wit.common.free(_listSrcPtr4);
|
||||
auto _witList5 = WitList!(DataComponentValue)(_list4);
|
||||
auto _flush6 = _witList5;
|
||||
return _flush6;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.get-components")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.get_components")
|
||||
static private extern(C) void __import_getComponents(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Sets a data component on this item stack.
|
||||
+/
|
||||
void setComponent(DataComponent component, in WitList!(ubyte) value) @trusted nothrow {
|
||||
__import_setComponent(this.__handle, cast(uint)(component), cast(void*)(value.ptr), value.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.set-component")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.set_component")
|
||||
static private extern(C) void __import_setComponent(uint, uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Removes a data component from this item stack.
|
||||
+/
|
||||
void removeComponent(DataComponent component) @trusted nothrow {
|
||||
__import_removeComponent(this.__handle, cast(uint)(component));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/item-stack@0.1.0", "[method]item-stack.remove-component")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__item_stack@0.1.0__:method:item_stack.remove_component")
|
||||
static private extern(C) void __import_removeComponent(uint, uint) nothrow;
|
||||
}
|
||||
}
|
||||
202
src/wit/pumpkin/plugin/java_dialogs/common.d
Normal file
202
src/wit/pumpkin/plugin/java_dialogs/common.d
Normal file
@ -0,0 +1,202 @@
|
||||
/++
|
||||
Provides types and utilities for displaying rich dialogs to Java Edition players.
|
||||
These dialogs support various layouts, body elements (text and items),
|
||||
and interactive inputs (checkboxes, text fields, sliders).
|
||||
+/
|
||||
module wit.pumpkin.plugin.java_dialogs.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.text.common;
|
||||
static import wit.pumpkin.plugin.item_stack.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
Represents the layout and button configuration of a dialog.
|
||||
+/
|
||||
enum DialogType : ubyte {
|
||||
/++
|
||||
A simple dialog with a single "OK" button.
|
||||
+/
|
||||
notice,
|
||||
|
||||
/++
|
||||
A dialog with "Yes" and "No" buttons.
|
||||
+/
|
||||
confirmation,
|
||||
|
||||
/++
|
||||
A scrollable list of custom buttons.
|
||||
+/
|
||||
multiAction,
|
||||
|
||||
/++
|
||||
A list of buttons that open other registered dialogs.
|
||||
+/
|
||||
dialogList,
|
||||
|
||||
/++
|
||||
A dedicated menu for displaying server-related links.
|
||||
+/
|
||||
serverLinks,
|
||||
}
|
||||
/++
|
||||
Defines what happens after a dialog is closed.
|
||||
+/
|
||||
enum AfterAction : ubyte {
|
||||
/++
|
||||
Returns the player to the previous screen (e.g., keeping an inventory open).
|
||||
+/
|
||||
peek,
|
||||
|
||||
/++
|
||||
Closes all open screens.
|
||||
+/
|
||||
pop,
|
||||
}
|
||||
/++
|
||||
Represents a custom server-side action.
|
||||
+/
|
||||
struct CustomClickAction {
|
||||
/++
|
||||
A unique identifier for the action (sent back to the server).
|
||||
+/
|
||||
WitString id;
|
||||
|
||||
/++
|
||||
Optional binary data to send with the action.
|
||||
+/
|
||||
Option!(WitList!(ubyte)) payload;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
id.witFree;
|
||||
payload.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
CustomClickAction witClone() const @nogc nothrow {
|
||||
CustomClickAction clone = void;
|
||||
clone.id = this.id.witClone;
|
||||
clone.payload = this.payload.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Represents an action triggered by a button click.
|
||||
+/
|
||||
struct Action {
|
||||
mixin WitVariant!(
|
||||
WitString, // openUrl
|
||||
CustomClickAction, // customClick
|
||||
);
|
||||
|
||||
public:
|
||||
enum Tag : ubyte {
|
||||
/++
|
||||
Opens an external URL.
|
||||
+/
|
||||
openUrl,
|
||||
|
||||
/++
|
||||
Triggers a custom server-side callback with an ID and optional payload.
|
||||
+/
|
||||
customClick,
|
||||
}
|
||||
pragma(inline, true) Tag tag() const @safe @nogc nothrow pure => _tag;
|
||||
|
||||
/++
|
||||
Opens an external URL.
|
||||
+/
|
||||
alias openUrl = _create!(Tag.openUrl);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isOpenUrl() const => _tag == Tag.openUrl;
|
||||
///ditto
|
||||
alias getOpenUrl = _get!(Tag.openUrl);
|
||||
|
||||
/++
|
||||
Triggers a custom server-side callback with an ID and optional payload.
|
||||
+/
|
||||
alias customClick = _create!(Tag.customClick);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isCustomClick() const => _tag == Tag.customClick;
|
||||
///ditto
|
||||
alias getCustomClick = _get!(Tag.customClick);
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
switch (_tag) with (Tag) {
|
||||
case openUrl: _get!(Tag.openUrl).witFree; break;
|
||||
case customClick: _get!(Tag.customClick).witFree; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
Action witClone() const @nogc nothrow {
|
||||
final switch (_tag) {
|
||||
case Tag.openUrl: return _create!(Tag.openUrl)(this._get!(Tag.openUrl).witClone); break;
|
||||
case Tag.customClick: return _create!(Tag.customClick)(this._get!(Tag.customClick).witClone); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Built-in link types recognized by the Java Edition client.
|
||||
+/
|
||||
enum LinkType : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
bugReport,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
communityGuidelines,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
support,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
status,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
feedback,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
community,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
website,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
forums,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
news,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
announcements,
|
||||
}
|
||||
555
src/wit/pumpkin/plugin/java_dialogs/imports.d
Normal file
555
src/wit/pumpkin/plugin/java_dialogs/imports.d
Normal file
@ -0,0 +1,555 @@
|
||||
/++
|
||||
Provides types and utilities for displaying rich dialogs to Java Edition players.
|
||||
These dialogs support various layouts, body elements (text and items),
|
||||
and interactive inputs (checkboxes, text fields, sliders).
|
||||
+/
|
||||
module wit.pumpkin.plugin.java_dialogs.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.java_dialogs.common;
|
||||
|
||||
static import wit.pumpkin.plugin.text.imports;
|
||||
static import wit.pumpkin.plugin.item_stack.imports;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias TextComponent = wit.pumpkin.plugin.text.imports.TextComponent;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias ItemStack = wit.pumpkin.plugin.item_stack.imports.ItemStack;
|
||||
|
||||
/++
|
||||
Represents an element in the main content area of a dialog.
|
||||
+/
|
||||
struct DialogBody {
|
||||
mixin WitVariant!(
|
||||
TextComponent, // plainMessage
|
||||
ItemStack, // item
|
||||
);
|
||||
|
||||
public:
|
||||
enum Tag : ubyte {
|
||||
/++
|
||||
A simple text message.
|
||||
+/
|
||||
plainMessage,
|
||||
|
||||
/++
|
||||
A visual item display.
|
||||
+/
|
||||
item,
|
||||
}
|
||||
pragma(inline, true) Tag tag() const @safe @nogc nothrow pure => _tag;
|
||||
|
||||
/++
|
||||
A simple text message.
|
||||
+/
|
||||
alias plainMessage = _create!(Tag.plainMessage);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isPlainMessage() const => _tag == Tag.plainMessage;
|
||||
///ditto
|
||||
alias getPlainMessage = _get!(Tag.plainMessage);
|
||||
|
||||
/++
|
||||
A visual item display.
|
||||
+/
|
||||
alias item = _create!(Tag.item);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isItem() const => _tag == Tag.item;
|
||||
///ditto
|
||||
alias getItem = _get!(Tag.item);
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
switch (_tag) with (Tag) {
|
||||
case plainMessage: _get!(Tag.plainMessage).witDrop; break;
|
||||
case item: _get!(Tag.item).witDrop; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
DialogBody witClone() const @nogc nothrow {
|
||||
final switch (_tag) {
|
||||
case Tag.plainMessage: return _create!(Tag.plainMessage)(this._get!(Tag.plainMessage).witClone); break;
|
||||
case Tag.item: return _create!(Tag.item)(this._get!(Tag.item).witClone); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
A checkbox input control.
|
||||
+/
|
||||
struct DialogInputBool {
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent label;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bool defaultValue;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
label.witDrop;
|
||||
}
|
||||
|
||||
DialogInputBool witClone() const @nogc nothrow {
|
||||
DialogInputBool clone = void;
|
||||
clone.label = this.label.witClone;
|
||||
clone.defaultValue = this.defaultValue.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
A text field input control.
|
||||
+/
|
||||
struct DialogInputText {
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent label;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent placeholder;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString defaultValue;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
defaultValue.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
label.witDrop;
|
||||
placeholder.witDrop;
|
||||
}
|
||||
|
||||
DialogInputText witClone() const @nogc nothrow {
|
||||
DialogInputText clone = void;
|
||||
clone.label = this.label.witClone;
|
||||
clone.placeholder = this.placeholder.witClone;
|
||||
clone.defaultValue = this.defaultValue.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
A numerical range slider input control.
|
||||
+/
|
||||
struct DialogInputNumberRange {
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent label;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
float minValue;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
float maxValue;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
float initialValue;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
float step;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(WitString) labelFormat;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
labelFormat.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
label.witDrop;
|
||||
}
|
||||
|
||||
DialogInputNumberRange witClone() const @nogc nothrow {
|
||||
DialogInputNumberRange clone = void;
|
||||
clone.label = this.label.witClone;
|
||||
clone.minValue = this.minValue.witClone;
|
||||
clone.maxValue = this.maxValue.witClone;
|
||||
clone.initialValue = this.initialValue.witClone;
|
||||
clone.step = this.step.witClone;
|
||||
clone.labelFormat = this.labelFormat.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
A multiple-choice selection input control.
|
||||
+/
|
||||
struct DialogInputSingleOption {
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent label;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitList!(TextComponent) options;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
uint initialIndex;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
options.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
label.witDrop;
|
||||
options.witDrop;
|
||||
}
|
||||
|
||||
DialogInputSingleOption witClone() const @nogc nothrow {
|
||||
DialogInputSingleOption clone = void;
|
||||
clone.label = this.label.witClone;
|
||||
clone.options = this.options.witClone;
|
||||
clone.initialIndex = this.initialIndex.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Represents an interactive input control in a dialog.
|
||||
+/
|
||||
struct DialogInput {
|
||||
mixin WitVariant!(
|
||||
DialogInputBool, // bool_
|
||||
DialogInputText, // text
|
||||
DialogInputNumberRange, // numberRange
|
||||
DialogInputSingleOption, // singleOption
|
||||
);
|
||||
|
||||
public:
|
||||
enum Tag : ubyte {
|
||||
/++
|
||||
A checkbox for true/false states.
|
||||
+/
|
||||
bool_,
|
||||
|
||||
/++
|
||||
A simple string input field.
|
||||
+/
|
||||
text,
|
||||
|
||||
/++
|
||||
A slider for numerical input within a range.
|
||||
+/
|
||||
numberRange,
|
||||
|
||||
/++
|
||||
A multiple-choice selection button.
|
||||
+/
|
||||
singleOption,
|
||||
}
|
||||
pragma(inline, true) Tag tag() const @safe @nogc nothrow pure => _tag;
|
||||
|
||||
/++
|
||||
A checkbox for true/false states.
|
||||
+/
|
||||
alias bool_ = _create!(Tag.bool_);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isBool() const => _tag == Tag.bool_;
|
||||
///ditto
|
||||
alias getBool = _get!(Tag.bool_);
|
||||
|
||||
/++
|
||||
A simple string input field.
|
||||
+/
|
||||
alias text = _create!(Tag.text);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isText() const => _tag == Tag.text;
|
||||
///ditto
|
||||
alias getText = _get!(Tag.text);
|
||||
|
||||
/++
|
||||
A slider for numerical input within a range.
|
||||
+/
|
||||
alias numberRange = _create!(Tag.numberRange);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isNumberRange() const => _tag == Tag.numberRange;
|
||||
///ditto
|
||||
alias getNumberRange = _get!(Tag.numberRange);
|
||||
|
||||
/++
|
||||
A multiple-choice selection button.
|
||||
+/
|
||||
alias singleOption = _create!(Tag.singleOption);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isSingleOption() const => _tag == Tag.singleOption;
|
||||
///ditto
|
||||
alias getSingleOption = _get!(Tag.singleOption);
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
switch (_tag) with (Tag) {
|
||||
case text: _get!(Tag.text).witFree; break;
|
||||
case numberRange: _get!(Tag.numberRange).witFree; break;
|
||||
case singleOption: _get!(Tag.singleOption).witFree; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
switch (_tag) with (Tag) {
|
||||
case bool_: _get!(Tag.bool_).witDrop; break;
|
||||
case text: _get!(Tag.text).witDrop; break;
|
||||
case numberRange: _get!(Tag.numberRange).witDrop; break;
|
||||
case singleOption: _get!(Tag.singleOption).witDrop; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
DialogInput witClone() const @nogc nothrow {
|
||||
final switch (_tag) {
|
||||
case Tag.bool_: return _create!(Tag.bool_)(this._get!(Tag.bool_).witClone); break;
|
||||
case Tag.text: return _create!(Tag.text)(this._get!(Tag.text).witClone); break;
|
||||
case Tag.numberRange: return _create!(Tag.numberRange)(this._get!(Tag.numberRange).witClone); break;
|
||||
case Tag.singleOption: return _create!(Tag.singleOption)(this._get!(Tag.singleOption).witClone); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Represents a clickable button in a dialog.
|
||||
+/
|
||||
struct ActionButton {
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent text;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(TextComponent) tooltip;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(uint) width;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Action action;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
action.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
text.witDrop;
|
||||
tooltip.witDrop;
|
||||
}
|
||||
|
||||
ActionButton witClone() const @nogc nothrow {
|
||||
ActionButton clone = void;
|
||||
clone.text = this.text.witClone;
|
||||
clone.tooltip = this.tooltip.witClone;
|
||||
clone.width = this.width.witClone;
|
||||
clone.action = this.action.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
The label for a link, which can be a built-in type or custom text.
|
||||
+/
|
||||
struct LinkLabel {
|
||||
mixin WitVariant!(
|
||||
LinkType, // builtIn
|
||||
TextComponent, // custom
|
||||
);
|
||||
|
||||
public:
|
||||
enum Tag : ubyte {
|
||||
/++
|
||||
A built-in link type with a predefined icon/label.
|
||||
+/
|
||||
builtIn,
|
||||
|
||||
/++
|
||||
A custom text component label.
|
||||
+/
|
||||
custom,
|
||||
}
|
||||
pragma(inline, true) Tag tag() const @safe @nogc nothrow pure => _tag;
|
||||
|
||||
/++
|
||||
A built-in link type with a predefined icon/label.
|
||||
+/
|
||||
alias builtIn = _create!(Tag.builtIn);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isBuiltIn() const => _tag == Tag.builtIn;
|
||||
///ditto
|
||||
alias getBuiltIn = _get!(Tag.builtIn);
|
||||
|
||||
/++
|
||||
A custom text component label.
|
||||
+/
|
||||
alias custom = _create!(Tag.custom);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isCustom() const => _tag == Tag.custom;
|
||||
///ditto
|
||||
alias getCustom = _get!(Tag.custom);
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
switch (_tag) with (Tag) {
|
||||
case custom: _get!(Tag.custom).witDrop; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
LinkLabel witClone() const @nogc nothrow {
|
||||
final switch (_tag) {
|
||||
case Tag.builtIn: return _create!(Tag.builtIn)(this._get!(Tag.builtIn).witClone); break;
|
||||
case Tag.custom: return _create!(Tag.custom)(this._get!(Tag.custom).witClone); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Represents a link displayed in a Java Edition dialog.
|
||||
+/
|
||||
struct Link {
|
||||
/++
|
||||
The label to display for the link.
|
||||
+/
|
||||
LinkLabel label;
|
||||
|
||||
/++
|
||||
The URL the link points to.
|
||||
+/
|
||||
WitString url;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
url.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
label.witDrop;
|
||||
}
|
||||
|
||||
Link witClone() const @nogc nothrow {
|
||||
Link clone = void;
|
||||
clone.label = this.label.witClone;
|
||||
clone.url = this.url.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Represents a dialog shown to a Java Edition player.
|
||||
+/
|
||||
struct Dialog {
|
||||
/++
|
||||
The main title of the dialog.
|
||||
+/
|
||||
TextComponent title;
|
||||
|
||||
/++
|
||||
The layout type of the dialog.
|
||||
+/
|
||||
DialogType type;
|
||||
|
||||
/++
|
||||
A list of body elements to display in the main area.
|
||||
+/
|
||||
WitList!(DialogBody) body_;
|
||||
|
||||
/++
|
||||
A list of interactive input controls.
|
||||
+/
|
||||
WitList!(DialogInput) inputs;
|
||||
|
||||
/++
|
||||
A list of clickable buttons (for multi-action and other types).
|
||||
+/
|
||||
WitList!(ActionButton) buttons;
|
||||
|
||||
/++
|
||||
A list of links (primarily for server-links type).
|
||||
+/
|
||||
WitList!(Link) links;
|
||||
|
||||
/++
|
||||
What to do after the dialog is closed.
|
||||
+/
|
||||
Option!(AfterAction) afterAction;
|
||||
|
||||
/++
|
||||
Whether the player can exit the dialog using the Esc key.
|
||||
+/
|
||||
bool canCloseWithEscape;
|
||||
|
||||
/++
|
||||
The text shown on buttons that link to/open this dialog.
|
||||
+/
|
||||
Option!(TextComponent) externalTitle;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
body_.witFree;
|
||||
inputs.witFree;
|
||||
buttons.witFree;
|
||||
links.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
title.witDrop;
|
||||
body_.witDrop;
|
||||
inputs.witDrop;
|
||||
buttons.witDrop;
|
||||
links.witDrop;
|
||||
externalTitle.witDrop;
|
||||
}
|
||||
|
||||
Dialog witClone() const @nogc nothrow {
|
||||
Dialog clone = void;
|
||||
clone.title = this.title.witClone;
|
||||
clone.type = this.type.witClone;
|
||||
clone.body_ = this.body_.witClone;
|
||||
clone.inputs = this.inputs.witClone;
|
||||
clone.buttons = this.buttons.witClone;
|
||||
clone.links = this.links.witClone;
|
||||
clone.afterAction = this.afterAction.witClone;
|
||||
clone.canCloseWithEscape = this.canCloseWithEscape.witClone;
|
||||
clone.externalTitle = this.externalTitle.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
15813
src/wit/pumpkin/plugin/java_packets/common.d
Normal file
15813
src/wit/pumpkin/plugin/java_packets/common.d
Normal file
File diff suppressed because it is too large
Load Diff
13
src/wit/pumpkin/plugin/java_packets/imports.d
Normal file
13
src/wit/pumpkin/plugin/java_packets/imports.d
Normal file
@ -0,0 +1,13 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.java_packets.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.java_packets.common;
|
||||
|
||||
static import wit.pumpkin.plugin.uuid.imports;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
40
src/wit/pumpkin/plugin/logging/common.d
Normal file
40
src/wit/pumpkin/plugin/logging/common.d
Normal file
@ -0,0 +1,40 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.logging.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum Level : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
trace,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
debug_,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
info,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
warn,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
error,
|
||||
}
|
||||
34
src/wit/pumpkin/plugin/logging/imports.d
Normal file
34
src/wit/pumpkin/plugin/logging/imports.d
Normal file
@ -0,0 +1,34 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.logging.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.logging.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
log any general purpose message
|
||||
+/
|
||||
void log(Level level, in WitString message) @trusted nothrow {
|
||||
__import_log(cast(uint)(level), cast(void*)(message.ptr), message.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/logging@0.1.0", "log")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__logging@0.1.0__log")
|
||||
private extern(C) void __import_log(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
This function is meant to be used by the tracing crate.
|
||||
+/
|
||||
void logTracing(in WitList!(ubyte) event) @trusted nothrow {
|
||||
__import_logTracing(cast(void*)(event.ptr), event.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/logging@0.1.0", "log-tracing")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__logging@0.1.0__log_tracing")
|
||||
private extern(C) void __import_logTracing(void*, size_t) nothrow;
|
||||
68
src/wit/pumpkin/plugin/metadata/common.d
Normal file
68
src/wit/pumpkin/plugin/metadata/common.d
Normal file
@ -0,0 +1,68 @@
|
||||
/++
|
||||
Plugin metadata describing the plugin and its compatibility.
|
||||
+/
|
||||
module wit.pumpkin.plugin.metadata.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
struct PluginMetadata {
|
||||
/++
|
||||
Name of the plugin.
|
||||
+/
|
||||
WitString name;
|
||||
|
||||
/++
|
||||
Plugin version (semver).
|
||||
+/
|
||||
WitString version_;
|
||||
|
||||
/++
|
||||
Plugin authors.
|
||||
+/
|
||||
WitList!(WitString) authors;
|
||||
|
||||
/++
|
||||
Short description of the plugin.
|
||||
+/
|
||||
WitString description;
|
||||
|
||||
/++
|
||||
Plugin dependencies.
|
||||
+/
|
||||
WitList!(WitString) dependencies;
|
||||
|
||||
/++
|
||||
Permissions requested by the plugin.
|
||||
+/
|
||||
WitList!(WitString) permissions;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
name.witFree;
|
||||
version_.witFree;
|
||||
authors.witFree;
|
||||
description.witFree;
|
||||
dependencies.witFree;
|
||||
permissions.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
PluginMetadata witClone() const @nogc nothrow {
|
||||
PluginMetadata clone = void;
|
||||
clone.name = this.name.witClone;
|
||||
clone.version_ = this.version_.witClone;
|
||||
clone.authors = this.authors.witClone;
|
||||
clone.description = this.description.witClone;
|
||||
clone.dependencies = this.dependencies.witClone;
|
||||
clone.permissions = this.permissions.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
124
src/wit/pumpkin/plugin/metadata/exports.d
Normal file
124
src/wit/pumpkin/plugin/metadata/exports.d
Normal file
@ -0,0 +1,124 @@
|
||||
/++
|
||||
Plugin metadata describing the plugin and its compatibility.
|
||||
+/
|
||||
module wit.pumpkin.plugin.metadata.exports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.metadata.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
package(wit) template Exports(Impl...) {
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias getMetadata_Sig = PluginMetadata function();
|
||||
/// ditto
|
||||
alias getMetadata_Impl = findWitExportFunc!("pumpkin:plugin/metadata@0.1.0", "get-metadata", getMetadata_Sig, Impl);
|
||||
/// ditto
|
||||
@wasmExport!("pumpkin:plugin/metadata@0.1.0#get-metadata")
|
||||
pragma(mangle, "__wit_export_pumpkin:plugin__metadata@0.1.0::get_metadata")
|
||||
private extern(C) void* __export_getMetadata() {
|
||||
alias _retArea = _exportsRetArea;
|
||||
auto _ret = getMetadata_Impl();
|
||||
*cast(size_t*)(_retArea.ptr + size_t.sizeof) = cast(size_t)(_ret.name.length);
|
||||
*cast(void**)(_retArea.ptr + 0) = cast(void*)(cast(void*)(_ret.name.ptr));
|
||||
*cast(size_t*)(_retArea.ptr + (3*size_t.sizeof)) = cast(size_t)(_ret.version_.length);
|
||||
*cast(void**)(_retArea.ptr + (2*size_t.sizeof)) = cast(void*)(cast(void*)(_ret.version_.ptr));
|
||||
auto _listSrc1 = _ret.authors;
|
||||
auto _list1 = _listSrc1.length ? wit.common.malloc(_listSrc1.length * ((2*size_t.sizeof))) : null;
|
||||
assert(!_listSrc1.length || _list1);
|
||||
foreach (_elem0_idx, ref _elem0; _listSrc1) {
|
||||
auto _base0 = _list1 + _elem0_idx * ((2*size_t.sizeof));
|
||||
*cast(size_t*)(_base0 + size_t.sizeof) = cast(size_t)(_elem0.length);
|
||||
*cast(void**)(_base0 + 0) = cast(void*)(cast(void*)(_elem0.ptr));
|
||||
|
||||
}
|
||||
if (_listSrc1.length) wit.common.free(_listSrc1.ptr);
|
||||
*cast(size_t*)(_retArea.ptr + (5*size_t.sizeof)) = cast(size_t)(_ret.authors.length);
|
||||
*cast(void**)(_retArea.ptr + (4*size_t.sizeof)) = cast(void*)(_list1);
|
||||
*cast(size_t*)(_retArea.ptr + (7*size_t.sizeof)) = cast(size_t)(_ret.description.length);
|
||||
*cast(void**)(_retArea.ptr + (6*size_t.sizeof)) = cast(void*)(cast(void*)(_ret.description.ptr));
|
||||
auto _listSrc3 = _ret.dependencies;
|
||||
auto _list3 = _listSrc3.length ? wit.common.malloc(_listSrc3.length * ((2*size_t.sizeof))) : null;
|
||||
assert(!_listSrc3.length || _list3);
|
||||
foreach (_elem2_idx, ref _elem2; _listSrc3) {
|
||||
auto _base2 = _list3 + _elem2_idx * ((2*size_t.sizeof));
|
||||
*cast(size_t*)(_base2 + size_t.sizeof) = cast(size_t)(_elem2.length);
|
||||
*cast(void**)(_base2 + 0) = cast(void*)(cast(void*)(_elem2.ptr));
|
||||
|
||||
}
|
||||
if (_listSrc3.length) wit.common.free(_listSrc3.ptr);
|
||||
*cast(size_t*)(_retArea.ptr + (9*size_t.sizeof)) = cast(size_t)(_ret.dependencies.length);
|
||||
*cast(void**)(_retArea.ptr + (8*size_t.sizeof)) = cast(void*)(_list3);
|
||||
auto _listSrc5 = _ret.permissions;
|
||||
auto _list5 = _listSrc5.length ? wit.common.malloc(_listSrc5.length * ((2*size_t.sizeof))) : null;
|
||||
assert(!_listSrc5.length || _list5);
|
||||
foreach (_elem4_idx, ref _elem4; _listSrc5) {
|
||||
auto _base4 = _list5 + _elem4_idx * ((2*size_t.sizeof));
|
||||
*cast(size_t*)(_base4 + size_t.sizeof) = cast(size_t)(_elem4.length);
|
||||
*cast(void**)(_base4 + 0) = cast(void*)(cast(void*)(_elem4.ptr));
|
||||
|
||||
}
|
||||
if (_listSrc5.length) wit.common.free(_listSrc5.ptr);
|
||||
*cast(size_t*)(_retArea.ptr + (11*size_t.sizeof)) = cast(size_t)(_ret.permissions.length);
|
||||
*cast(void**)(_retArea.ptr + (10*size_t.sizeof)) = cast(void*)(_list5);
|
||||
return _retArea.ptr;
|
||||
}
|
||||
@wasmExport!("cabi_post_pumpkin:plugin/metadata@0.1.0#get-metadata")
|
||||
pragma(mangle, "__wit_cabi_post_pumpkin:plugin__metadata@0.1.0::get_metadata")
|
||||
private extern(C) void __cabi_post_getMetadata(void* arg0) {
|
||||
if (*(cast(size_t*)(arg0 + size_t.sizeof)) > 0) {
|
||||
free(*(cast(void**)(arg0 + 0)));
|
||||
}
|
||||
if (*(cast(size_t*)(arg0 + (3*size_t.sizeof))) > 0) {
|
||||
free(*(cast(void**)(arg0 + (2*size_t.sizeof))));
|
||||
}
|
||||
auto _listSrcPtr1 = *(cast(void**)(arg0 + (4*size_t.sizeof)));
|
||||
auto _listLen1 = *(cast(size_t*)(arg0 + (5*size_t.sizeof)));
|
||||
foreach (_elem0_idx; 0.._listLen1) {
|
||||
const auto _base0 = _listSrcPtr1 + _elem0_idx * (2*size_t.sizeof);
|
||||
if (*(cast(size_t*)(_base0 + size_t.sizeof)) > 0) {
|
||||
free(*(cast(void**)(_base0 + 0)));
|
||||
}
|
||||
|
||||
}
|
||||
if (*(cast(size_t*)(arg0 + (5*size_t.sizeof))) > 0) {
|
||||
free(*(cast(void**)(arg0 + (4*size_t.sizeof))));
|
||||
}
|
||||
if (*(cast(size_t*)(arg0 + (7*size_t.sizeof))) > 0) {
|
||||
free(*(cast(void**)(arg0 + (6*size_t.sizeof))));
|
||||
}
|
||||
auto _listSrcPtr3 = *(cast(void**)(arg0 + (8*size_t.sizeof)));
|
||||
auto _listLen3 = *(cast(size_t*)(arg0 + (9*size_t.sizeof)));
|
||||
foreach (_elem2_idx; 0.._listLen3) {
|
||||
const auto _base2 = _listSrcPtr3 + _elem2_idx * (2*size_t.sizeof);
|
||||
if (*(cast(size_t*)(_base2 + size_t.sizeof)) > 0) {
|
||||
free(*(cast(void**)(_base2 + 0)));
|
||||
}
|
||||
|
||||
}
|
||||
if (*(cast(size_t*)(arg0 + (9*size_t.sizeof))) > 0) {
|
||||
free(*(cast(void**)(arg0 + (8*size_t.sizeof))));
|
||||
}
|
||||
auto _listSrcPtr5 = *(cast(void**)(arg0 + (10*size_t.sizeof)));
|
||||
auto _listLen5 = *(cast(size_t*)(arg0 + (11*size_t.sizeof)));
|
||||
foreach (_elem4_idx; 0.._listLen5) {
|
||||
const auto _base4 = _listSrcPtr5 + _elem4_idx * (2*size_t.sizeof);
|
||||
if (*(cast(size_t*)(_base4 + size_t.sizeof)) > 0) {
|
||||
free(*(cast(void**)(_base4 + 0)));
|
||||
}
|
||||
|
||||
}
|
||||
if (*(cast(size_t*)(arg0 + (11*size_t.sizeof))) > 0) {
|
||||
free(*(cast(void**)(arg0 + (10*size_t.sizeof))));
|
||||
}
|
||||
}
|
||||
|
||||
align(size_t.sizeof) private void[(12*size_t.sizeof)] _exportsRetArea;
|
||||
}
|
||||
|
||||
640
src/wit/pumpkin/plugin/particles/common.d
Normal file
640
src/wit/pumpkin/plugin/particles/common.d
Normal file
@ -0,0 +1,640 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.particles.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum Particle : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
angryVillager,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
block,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockMarker,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bubble,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sulfurBubbles,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
noxiousGas,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
noxiousGasCloud,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
geyser,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
geyserBase,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
geyserPoof,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
geyserPlume,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cloud,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
copperFireFlame,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
crit,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
damageIndicator,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
dragonBreath,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
drippingLava,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fallingLava,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
landingLava,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
drippingWater,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fallingWater,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
dust,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
dustColorTransition,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
effect,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
elderGuardian,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enchantedHit,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enchant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
endRod,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
entityEffect,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
explosionEmitter,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
explosion,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
gust,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
smallGust,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
gustEmitterLarge,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
gustEmitterSmall,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sonicBoom,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fallingDust,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
firework,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fishing,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
flame,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
infested,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cherryLeaves,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
paleOakLeaves,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tintedLeaves,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sculkSoul,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sculkCharge,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sculkChargePop,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
soulFireFlame,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
soul,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
flash,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
happyVillager,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
composter,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
heart,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
instantEffect,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
item,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
vibration,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
trail,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
pauseMobGrowth,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resetMobGrowth,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
itemSlime,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
itemCobweb,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
itemSnowball,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
largeSmoke,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lava,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mycelium,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
note,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
poof,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
portal,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
rain,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
smoke,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
whiteSmoke,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sneeze,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
spit,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
squidInk,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sweepAttack,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
totemOfUndying,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
underwater,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
splash,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
witch,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bubblePop,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
currentDown,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bubbleColumnUp,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
nautilus,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
dolphin,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
campfireCosySmoke,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
campfireSignalSmoke,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
drippingHoney,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fallingHoney,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
landingHoney,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fallingNectar,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fallingSporeBlossom,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
ash,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
crimsonSpore,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
warpedSpore,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sporeBlossomAir,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
drippingObsidianTear,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fallingObsidianTear,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
landingObsidianTear,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
reversePortal,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
whiteAsh,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
smallFlame,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
snowflake,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
drippingDripstoneLava,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fallingDripstoneLava,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
drippingDripstoneWater,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fallingDripstoneWater,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
glowSquidInk,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
glow,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
waxOn,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
waxOff,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
electricSpark,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
scrape,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
shriek,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
eggCrack,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
dustPlume,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
trialSpawnerDetection,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
trialSpawnerDetectionOminous,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
vaultConnection,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
dustPillar,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
ominousSpawning,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
raidOmen,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
trialOmen,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blockCrumble,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
firefly,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sulfurCubeGoo,
|
||||
}
|
||||
12
src/wit/pumpkin/plugin/particles/imports.d
Normal file
12
src/wit/pumpkin/plugin/particles/imports.d
Normal file
@ -0,0 +1,12 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.particles.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.particles.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
186
src/wit/pumpkin/plugin/permission/common.d
Normal file
186
src/wit/pumpkin/plugin/permission/common.d
Normal file
@ -0,0 +1,186 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.permission.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
Represents the player's permission level
|
||||
|
||||
Permission levels determine the player's access to commands and server operations.
|
||||
Each numeric level corresponds to a specific role:
|
||||
- `Zero`: `normal`: Player can use basic commands.
|
||||
- `One`: `moderator`: Player can bypass spawn protection.
|
||||
- `Two`: `gamemaster`: Player or executor can use more commands and player can use command blocks.
|
||||
- `Three`: `admin`: Player or executor can use commands related to multiplayer management.
|
||||
- `Four`: `owner`: Player or executor can use all of the commands, including commands related to server management.
|
||||
+/
|
||||
enum PermissionLevel : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
zero,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
one,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
two,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
three,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
four,
|
||||
}
|
||||
/++
|
||||
Describes the default behavior for permissions
|
||||
+/
|
||||
struct PermissionDefault {
|
||||
mixin WitVariant!(
|
||||
void, // deny
|
||||
void, // allow
|
||||
PermissionLevel, // op
|
||||
);
|
||||
|
||||
public:
|
||||
enum Tag : ubyte {
|
||||
/++
|
||||
Permission is not granted by default
|
||||
+/
|
||||
deny,
|
||||
|
||||
/++
|
||||
Permission is granted by default
|
||||
+/
|
||||
allow,
|
||||
|
||||
/++
|
||||
Permission is granted by default to operators
|
||||
+/
|
||||
op,
|
||||
}
|
||||
pragma(inline, true) Tag tag() const @safe @nogc nothrow pure => _tag;
|
||||
|
||||
/++
|
||||
Permission is not granted by default
|
||||
+/
|
||||
alias deny = _create!(Tag.deny);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isDeny() const => _tag == Tag.deny;
|
||||
|
||||
/++
|
||||
Permission is granted by default
|
||||
+/
|
||||
alias allow = _create!(Tag.allow);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isAllow() const => _tag == Tag.allow;
|
||||
|
||||
/++
|
||||
Permission is granted by default to operators
|
||||
+/
|
||||
alias op = _create!(Tag.op);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isOp() const => _tag == Tag.op;
|
||||
///ditto
|
||||
alias getOp = _get!(Tag.op);
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
PermissionDefault witClone() const @nogc nothrow {
|
||||
final switch (_tag) {
|
||||
case Tag.deny: return _create!(Tag.deny); break;
|
||||
case Tag.allow: return _create!(Tag.allow); break;
|
||||
case Tag.op: return _create!(Tag.op)(this._get!(Tag.op).witClone); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
A child permission entry
|
||||
+/
|
||||
struct PermissionChild {
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString node;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bool value;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
node.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
PermissionChild witClone() const @nogc nothrow {
|
||||
PermissionChild clone = void;
|
||||
clone.node = this.node.witClone;
|
||||
clone.value = this.value.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Defines a permission node in the system
|
||||
+/
|
||||
struct Permission {
|
||||
/++
|
||||
The full node name (e.g., "minecraft:command.gamemode")
|
||||
+/
|
||||
WitString node;
|
||||
|
||||
/++
|
||||
Description of what this permission does
|
||||
+/
|
||||
WitString description;
|
||||
|
||||
/++
|
||||
The default value of this permission
|
||||
+/
|
||||
PermissionDefault default_;
|
||||
|
||||
/++
|
||||
Children nodes that are affected by this permission
|
||||
+/
|
||||
WitList!(PermissionChild) children;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
node.witFree;
|
||||
description.witFree;
|
||||
children.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
Permission witClone() const @nogc nothrow {
|
||||
Permission clone = void;
|
||||
clone.node = this.node.witClone;
|
||||
clone.description = this.description.witClone;
|
||||
clone.default_ = this.default_.witClone;
|
||||
clone.children = this.children.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
12
src/wit/pumpkin/plugin/permission/imports.d
Normal file
12
src/wit/pumpkin/plugin/permission/imports.d
Normal file
@ -0,0 +1,12 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.permission.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.permission.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
2813
src/wit/pumpkin/plugin/player/common.d
Normal file
2813
src/wit/pumpkin/plugin/player/common.d
Normal file
File diff suppressed because it is too large
Load Diff
8216
src/wit/pumpkin/plugin/player/imports.d
Normal file
8216
src/wit/pumpkin/plugin/player/imports.d
Normal file
File diff suppressed because it is too large
Load Diff
37353
src/wit/pumpkin/plugin/plugin/package.d
Normal file
37353
src/wit/pumpkin/plugin/plugin/package.d
Normal file
File diff suppressed because it is too large
Load Diff
245
src/wit/pumpkin/plugin/potions/common.d
Normal file
245
src/wit/pumpkin/plugin/potions/common.d
Normal file
@ -0,0 +1,245 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.potions.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum PotionType : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
water,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mundane,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
thick,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
awkward,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
nightVision,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
longNightVision,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
invisibility,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
longInvisibility,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
leaping,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
longLeaping,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
strongLeaping,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fireResistance,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
longFireResistance,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
swiftness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
longSwiftness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
strongSwiftness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
slowness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
longSlowness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
strongSlowness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
turtleMaster,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
longTurtleMaster,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
strongTurtleMaster,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
waterBreathing,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
longWaterBreathing,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
healing,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
strongHealing,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
harming,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
strongHarming,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
poison,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
longPoison,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
strongPoison,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
regeneration,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
longRegeneration,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
strongRegeneration,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
strength,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
longStrength,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
strongStrength,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
weakness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
longWeakness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
luck,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
slowFalling,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
longSlowFalling,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
windCharged,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
weaving,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
oozing,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
infested,
|
||||
}
|
||||
12
src/wit/pumpkin/plugin/potions/imports.d
Normal file
12
src/wit/pumpkin/plugin/potions/imports.d
Normal file
@ -0,0 +1,12 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.potions.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.potions.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
147
src/wit/pumpkin/plugin/recipe/common.d
Normal file
147
src/wit/pumpkin/plugin/recipe/common.d
Normal file
@ -0,0 +1,147 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.recipe.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.item_stack.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
Recipe category for the recipe book.
|
||||
+/
|
||||
enum RecipeCategory : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
building,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
redstone,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
equipment,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
misc,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
food,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blocks,
|
||||
}
|
||||
/++
|
||||
Represents an ingredient in a recipe.
|
||||
+/
|
||||
struct Ingredient {
|
||||
mixin WitVariant!(
|
||||
WitString, // item
|
||||
WitString, // tag
|
||||
WitList!(WitString), // oneOf
|
||||
);
|
||||
|
||||
public:
|
||||
enum Tag : ubyte {
|
||||
/++
|
||||
A specific item (e.g. "minecraft:diamond").
|
||||
+/
|
||||
item,
|
||||
|
||||
/++
|
||||
A tag group of items (e.g., "minecraft:logs").
|
||||
+/
|
||||
tag,
|
||||
|
||||
/++
|
||||
One of multiple specific items.
|
||||
+/
|
||||
oneOf,
|
||||
}
|
||||
pragma(inline, true) Tag tag() const @safe @nogc nothrow pure => _tag;
|
||||
|
||||
/++
|
||||
A specific item (e.g. "minecraft:diamond").
|
||||
+/
|
||||
alias item = _create!(Tag.item);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isItem() const => _tag == Tag.item;
|
||||
///ditto
|
||||
alias getItem = _get!(Tag.item);
|
||||
|
||||
/++
|
||||
A tag group of items (e.g., "minecraft:logs").
|
||||
+/
|
||||
alias tag = _create!(Tag.tag);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isTag() const => _tag == Tag.tag;
|
||||
///ditto
|
||||
alias getTag = _get!(Tag.tag);
|
||||
|
||||
/++
|
||||
One of multiple specific items.
|
||||
+/
|
||||
alias oneOf = _create!(Tag.oneOf);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isOneOf() const => _tag == Tag.oneOf;
|
||||
///ditto
|
||||
alias getOneOf = _get!(Tag.oneOf);
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
switch (_tag) with (Tag) {
|
||||
case item: _get!(Tag.item).witFree; break;
|
||||
case tag: _get!(Tag.tag).witFree; break;
|
||||
case oneOf: _get!(Tag.oneOf).witFree; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
Ingredient witClone() const @nogc nothrow {
|
||||
final switch (_tag) {
|
||||
case Tag.item: return _create!(Tag.item)(this._get!(Tag.item).witClone); break;
|
||||
case Tag.tag: return _create!(Tag.tag)(this._get!(Tag.tag).witClone); break;
|
||||
case Tag.oneOf: return _create!(Tag.oneOf)(this._get!(Tag.oneOf).witClone); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Types of cooking stations.
|
||||
+/
|
||||
enum CookingType : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
smelting,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blasting,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
smoking,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
campfire,
|
||||
}
|
||||
466
src/wit/pumpkin/plugin/recipe/imports.d
Normal file
466
src/wit/pumpkin/plugin/recipe/imports.d
Normal file
@ -0,0 +1,466 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.recipe.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.recipe.common;
|
||||
|
||||
static import wit.pumpkin.plugin.item_stack.imports;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias ItemStack = wit.pumpkin.plugin.item_stack.imports.ItemStack;
|
||||
|
||||
/++
|
||||
Represents a shaped crafting recipe.
|
||||
+/
|
||||
struct ShapedRecipe {
|
||||
/++
|
||||
The pattern of the recipe (e.g., ["# #", " s ", "# #"]).
|
||||
+/
|
||||
WitList!(WitString) pattern;
|
||||
|
||||
/++
|
||||
Mapping of characters in the pattern to ingredients.
|
||||
+/
|
||||
WitList!(Tuple!(WitString, Ingredient)) key;
|
||||
|
||||
/++
|
||||
The resulting item stack.
|
||||
+/
|
||||
ItemStack output;
|
||||
|
||||
/++
|
||||
The recipe group (optional).
|
||||
+/
|
||||
Option!(WitString) group;
|
||||
|
||||
/++
|
||||
The recipe category in the recipe book.
|
||||
+/
|
||||
Option!(RecipeCategory) category;
|
||||
|
||||
/++
|
||||
Whether to show a toast notification when the recipe is unlocked.
|
||||
+/
|
||||
Option!(bool) showNotification;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
pattern.witFree;
|
||||
key.witFree;
|
||||
group.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
output.witDrop;
|
||||
}
|
||||
|
||||
ShapedRecipe witClone() const @nogc nothrow {
|
||||
ShapedRecipe clone = void;
|
||||
clone.pattern = this.pattern.witClone;
|
||||
clone.key = this.key.witClone;
|
||||
clone.output = this.output.witClone;
|
||||
clone.group = this.group.witClone;
|
||||
clone.category = this.category.witClone;
|
||||
clone.showNotification = this.showNotification.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Represents a shapeless crafting recipe.
|
||||
+/
|
||||
struct ShapelessRecipe {
|
||||
/++
|
||||
The list of ingredients required.
|
||||
+/
|
||||
WitList!(Ingredient) ingredients;
|
||||
|
||||
/++
|
||||
The resulting item stack.
|
||||
+/
|
||||
ItemStack output;
|
||||
|
||||
/++
|
||||
The recipe group (optional).
|
||||
+/
|
||||
Option!(WitString) group;
|
||||
|
||||
/++
|
||||
The recipe category in the recipe book.
|
||||
+/
|
||||
Option!(RecipeCategory) category;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
ingredients.witFree;
|
||||
group.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
output.witDrop;
|
||||
}
|
||||
|
||||
ShapelessRecipe witClone() const @nogc nothrow {
|
||||
ShapelessRecipe clone = void;
|
||||
clone.ingredients = this.ingredients.witClone;
|
||||
clone.output = this.output.witClone;
|
||||
clone.group = this.group.witClone;
|
||||
clone.category = this.category.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Represents a cooking recipe (Smelting, Blasting, Smoking, Campfire).
|
||||
+/
|
||||
struct CookingRecipe {
|
||||
/++
|
||||
The ingredient to cook.
|
||||
+/
|
||||
Ingredient ingredient;
|
||||
|
||||
/++
|
||||
The resulting item stack.
|
||||
+/
|
||||
ItemStack output;
|
||||
|
||||
/++
|
||||
Experience points awarded.
|
||||
+/
|
||||
float experience;
|
||||
|
||||
/++
|
||||
Cooking time in ticks.
|
||||
+/
|
||||
uint cookingTime;
|
||||
|
||||
/++
|
||||
The recipe group (optional).
|
||||
+/
|
||||
Option!(WitString) group;
|
||||
|
||||
/++
|
||||
The recipe category in the recipe book.
|
||||
+/
|
||||
Option!(RecipeCategory) category;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
ingredient.witFree;
|
||||
group.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
output.witDrop;
|
||||
}
|
||||
|
||||
CookingRecipe witClone() const @nogc nothrow {
|
||||
CookingRecipe clone = void;
|
||||
clone.ingredient = this.ingredient.witClone;
|
||||
clone.output = this.output.witClone;
|
||||
clone.experience = this.experience.witClone;
|
||||
clone.cookingTime = this.cookingTime.witClone;
|
||||
clone.group = this.group.witClone;
|
||||
clone.category = this.category.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Common interface for registering recipes.
|
||||
+/
|
||||
struct RecipeManager {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
|
||||
pragma(inline, true) void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
@wasmImport!("pumpkin:plugin/recipe@0.1.0", "[resource-drop]recipe-manager")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__recipe@0.1.0__:resource_drop:recipe_manager")
|
||||
static private extern(C) void __import_drop(uint) @nogc nothrow;
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true) typeof(this) witClone() const @safe @nogc nothrow { return typeof(this)(__handle); }
|
||||
// TODO: make RAII? disable copy for the own
|
||||
|
||||
Borrow borrow() => Borrow(__handle);
|
||||
alias borrow this;
|
||||
|
||||
struct Borrow {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true)
|
||||
void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
pragma(inline, true) Borrow witClone() const @safe @nogc nothrow { return Borrow(__handle); }
|
||||
|
||||
/++
|
||||
Registers a shaped crafting recipe.
|
||||
+/
|
||||
void registerShaped(in WitString id, in ShapedRecipe recipe) @trusted nothrow {
|
||||
wit.common.DeallocateBuffer deallocate;
|
||||
auto _listSrc1 = recipe.pattern;
|
||||
auto _list1 = _listSrc1.length ? wit.common.malloc(_listSrc1.length * ((2*size_t.sizeof))) : null;
|
||||
assert(!_listSrc1.length || _list1);
|
||||
if (_listSrc1.length) deallocate ~= _list1;
|
||||
foreach (_elem0_idx, ref _elem0; _listSrc1) {
|
||||
auto _base0 = _list1 + _elem0_idx * ((2*size_t.sizeof));
|
||||
*cast(size_t*)(_base0 + size_t.sizeof) = cast(size_t)(_elem0.length);
|
||||
*cast(void**)(_base0 + 0) = cast(void*)(cast(void*)(_elem0.ptr));
|
||||
|
||||
}
|
||||
auto _listSrc12 = recipe.key;
|
||||
auto _list12 = _listSrc12.length ? wit.common.malloc(_listSrc12.length * ((5*size_t.sizeof))) : null;
|
||||
assert(!_listSrc12.length || _list12);
|
||||
if (_listSrc12.length) deallocate ~= _list12;
|
||||
foreach (_elem2_idx, ref _elem2; _listSrc12) {
|
||||
auto _base2 = _list12 + _elem2_idx * ((5*size_t.sizeof));
|
||||
*cast(size_t*)(_base2 + size_t.sizeof) = cast(size_t)(_elem2[0].length);
|
||||
*cast(void**)(_base2 + 0) = cast(void*)(cast(void*)(_elem2[0].ptr));
|
||||
alias _Tag11 = Ingredient.Tag;
|
||||
final switch (_elem2[1].tag) {
|
||||
case _Tag11.item: {
|
||||
const ref WitString _payload4 = _elem2[1].getItem();
|
||||
*cast(ubyte*)(_base2 + (2*size_t.sizeof)) = cast(ubyte)(0);
|
||||
*cast(size_t*)(_base2 + (4*size_t.sizeof)) = cast(size_t)(_payload4.length);
|
||||
*cast(void**)(_base2 + (3*size_t.sizeof)) = cast(void*)(cast(void*)(_payload4.ptr));
|
||||
break;
|
||||
}
|
||||
case _Tag11.tag: {
|
||||
const ref WitString _payload6 = _elem2[1].getTag();
|
||||
*cast(ubyte*)(_base2 + (2*size_t.sizeof)) = cast(ubyte)(1);
|
||||
*cast(size_t*)(_base2 + (4*size_t.sizeof)) = cast(size_t)(_payload6.length);
|
||||
*cast(void**)(_base2 + (3*size_t.sizeof)) = cast(void*)(cast(void*)(_payload6.ptr));
|
||||
break;
|
||||
}
|
||||
case _Tag11.oneOf: {
|
||||
const ref WitList!(WitString) _payload8 = _elem2[1].getOneOf();
|
||||
*cast(ubyte*)(_base2 + (2*size_t.sizeof)) = cast(ubyte)(2);
|
||||
auto _listSrc10 = _payload8;
|
||||
auto _list10 = _listSrc10.length ? wit.common.malloc(_listSrc10.length * ((2*size_t.sizeof))) : null;
|
||||
assert(!_listSrc10.length || _list10);
|
||||
if (_listSrc10.length) deallocate ~= _list10;
|
||||
foreach (_elem9_idx, ref _elem9; _listSrc10) {
|
||||
auto _base9 = _list10 + _elem9_idx * ((2*size_t.sizeof));
|
||||
*cast(size_t*)(_base9 + size_t.sizeof) = cast(size_t)(_elem9.length);
|
||||
*cast(void**)(_base9 + 0) = cast(void*)(cast(void*)(_elem9.ptr));
|
||||
|
||||
}
|
||||
*cast(size_t*)(_base2 + (4*size_t.sizeof)) = cast(size_t)(_payload8.length);
|
||||
*cast(void**)(_base2 + (3*size_t.sizeof)) = cast(void*)(_list10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
uint _option17 = void;
|
||||
void* _option18 = void;
|
||||
size_t _option19 = void;
|
||||
if (recipe.group.isSome) {
|
||||
ref _payload16 = recipe.group.unwrap();
|
||||
_option17 = 1;
|
||||
_option18 = cast(void*)(_payload16.ptr);
|
||||
_option19 = _payload16.length;
|
||||
} else {
|
||||
_option17 = 0;
|
||||
_option18 = null;
|
||||
_option19 = 0;
|
||||
}
|
||||
uint _option24 = void;
|
||||
uint _option25 = void;
|
||||
if (recipe.category.isSome) {
|
||||
ref _payload23 = recipe.category.unwrap();
|
||||
_option24 = 1;
|
||||
_option25 = cast(uint)(_payload23);
|
||||
} else {
|
||||
_option24 = 0;
|
||||
_option25 = 0;
|
||||
}
|
||||
uint _option30 = void;
|
||||
uint _option31 = void;
|
||||
if (recipe.showNotification.isSome) {
|
||||
ref _payload29 = recipe.showNotification.unwrap();
|
||||
_option30 = 1;
|
||||
_option31 = cast(uint)(_payload29);
|
||||
} else {
|
||||
_option30 = 0;
|
||||
_option31 = 0;
|
||||
}
|
||||
__import_registerShaped(this.__handle, cast(void*)(id.ptr), id.length, _list1, recipe.pattern.length, _list12, recipe.key.length, recipe.output.__handle, _option17, _option18, _option19, _option24, _option25, _option30, _option31);
|
||||
deallocate.purge();
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/recipe@0.1.0", "[method]recipe-manager.register-shaped")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__recipe@0.1.0__:method:recipe_manager.register_shaped")
|
||||
static private extern(C) void __import_registerShaped(uint, void*, size_t, void*, size_t, void*, size_t, uint, uint, void*, size_t, uint, uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Registers a shapeless crafting recipe.
|
||||
+/
|
||||
void registerShapeless(in WitString id, in ShapelessRecipe recipe) @trusted nothrow {
|
||||
wit.common.DeallocateBuffer deallocate;
|
||||
auto _listSrc10 = recipe.ingredients;
|
||||
auto _list10 = _listSrc10.length ? wit.common.malloc(_listSrc10.length * ((3*size_t.sizeof))) : null;
|
||||
assert(!_listSrc10.length || _list10);
|
||||
if (_listSrc10.length) deallocate ~= _list10;
|
||||
foreach (_elem0_idx, ref _elem0; _listSrc10) {
|
||||
auto _base0 = _list10 + _elem0_idx * ((3*size_t.sizeof));
|
||||
alias _Tag9 = Ingredient.Tag;
|
||||
final switch (_elem0.tag) {
|
||||
case _Tag9.item: {
|
||||
const ref WitString _payload2 = _elem0.getItem();
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(0);
|
||||
*cast(size_t*)(_base0 + (2*size_t.sizeof)) = cast(size_t)(_payload2.length);
|
||||
*cast(void**)(_base0 + size_t.sizeof) = cast(void*)(cast(void*)(_payload2.ptr));
|
||||
break;
|
||||
}
|
||||
case _Tag9.tag: {
|
||||
const ref WitString _payload4 = _elem0.getTag();
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(1);
|
||||
*cast(size_t*)(_base0 + (2*size_t.sizeof)) = cast(size_t)(_payload4.length);
|
||||
*cast(void**)(_base0 + size_t.sizeof) = cast(void*)(cast(void*)(_payload4.ptr));
|
||||
break;
|
||||
}
|
||||
case _Tag9.oneOf: {
|
||||
const ref WitList!(WitString) _payload6 = _elem0.getOneOf();
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(2);
|
||||
auto _listSrc8 = _payload6;
|
||||
auto _list8 = _listSrc8.length ? wit.common.malloc(_listSrc8.length * ((2*size_t.sizeof))) : null;
|
||||
assert(!_listSrc8.length || _list8);
|
||||
if (_listSrc8.length) deallocate ~= _list8;
|
||||
foreach (_elem7_idx, ref _elem7; _listSrc8) {
|
||||
auto _base7 = _list8 + _elem7_idx * ((2*size_t.sizeof));
|
||||
*cast(size_t*)(_base7 + size_t.sizeof) = cast(size_t)(_elem7.length);
|
||||
*cast(void**)(_base7 + 0) = cast(void*)(cast(void*)(_elem7.ptr));
|
||||
|
||||
}
|
||||
*cast(size_t*)(_base0 + (2*size_t.sizeof)) = cast(size_t)(_payload6.length);
|
||||
*cast(void**)(_base0 + size_t.sizeof) = cast(void*)(_list8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
uint _option15 = void;
|
||||
void* _option16 = void;
|
||||
size_t _option17 = void;
|
||||
if (recipe.group.isSome) {
|
||||
ref _payload14 = recipe.group.unwrap();
|
||||
_option15 = 1;
|
||||
_option16 = cast(void*)(_payload14.ptr);
|
||||
_option17 = _payload14.length;
|
||||
} else {
|
||||
_option15 = 0;
|
||||
_option16 = null;
|
||||
_option17 = 0;
|
||||
}
|
||||
uint _option22 = void;
|
||||
uint _option23 = void;
|
||||
if (recipe.category.isSome) {
|
||||
ref _payload21 = recipe.category.unwrap();
|
||||
_option22 = 1;
|
||||
_option23 = cast(uint)(_payload21);
|
||||
} else {
|
||||
_option22 = 0;
|
||||
_option23 = 0;
|
||||
}
|
||||
__import_registerShapeless(this.__handle, cast(void*)(id.ptr), id.length, _list10, recipe.ingredients.length, recipe.output.__handle, _option15, _option16, _option17, _option22, _option23);
|
||||
deallocate.purge();
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/recipe@0.1.0", "[method]recipe-manager.register-shapeless")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__recipe@0.1.0__:method:recipe_manager.register_shapeless")
|
||||
static private extern(C) void __import_registerShapeless(uint, void*, size_t, void*, size_t, uint, uint, void*, size_t, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Registers a cooking recipe.
|
||||
+/
|
||||
void registerCooking(in WitString id, CookingType stationType, in CookingRecipe recipe) @trusted nothrow {
|
||||
wit.common.DeallocateBuffer deallocate;
|
||||
uint _variantPart8 = void;
|
||||
void* _variantPart9 = void;
|
||||
size_t _variantPart10 = void;
|
||||
alias _Tag11 = Ingredient.Tag;
|
||||
final switch (recipe.ingredient.tag) {
|
||||
case _Tag11.item: {
|
||||
const ref WitString _payload1 = recipe.ingredient.getItem();
|
||||
_variantPart8 = 0;
|
||||
_variantPart9 = cast(void*)(_payload1.ptr);
|
||||
_variantPart10 = _payload1.length;
|
||||
break;
|
||||
}
|
||||
case _Tag11.tag: {
|
||||
const ref WitString _payload3 = recipe.ingredient.getTag();
|
||||
_variantPart8 = 1;
|
||||
_variantPart9 = cast(void*)(_payload3.ptr);
|
||||
_variantPart10 = _payload3.length;
|
||||
break;
|
||||
}
|
||||
case _Tag11.oneOf: {
|
||||
const ref WitList!(WitString) _payload5 = recipe.ingredient.getOneOf();
|
||||
auto _listSrc7 = _payload5;
|
||||
auto _list7 = _listSrc7.length ? wit.common.malloc(_listSrc7.length * ((2*size_t.sizeof))) : null;
|
||||
assert(!_listSrc7.length || _list7);
|
||||
if (_listSrc7.length) deallocate ~= _list7;
|
||||
foreach (_elem6_idx, ref _elem6; _listSrc7) {
|
||||
auto _base6 = _list7 + _elem6_idx * ((2*size_t.sizeof));
|
||||
*cast(size_t*)(_base6 + size_t.sizeof) = cast(size_t)(_elem6.length);
|
||||
*cast(void**)(_base6 + 0) = cast(void*)(cast(void*)(_elem6.ptr));
|
||||
|
||||
}
|
||||
_variantPart8 = 2;
|
||||
_variantPart9 = _list7;
|
||||
_variantPart10 = _payload5.length;
|
||||
break;
|
||||
}
|
||||
}
|
||||
uint _option16 = void;
|
||||
void* _option17 = void;
|
||||
size_t _option18 = void;
|
||||
if (recipe.group.isSome) {
|
||||
ref _payload15 = recipe.group.unwrap();
|
||||
_option16 = 1;
|
||||
_option17 = cast(void*)(_payload15.ptr);
|
||||
_option18 = _payload15.length;
|
||||
} else {
|
||||
_option16 = 0;
|
||||
_option17 = null;
|
||||
_option18 = 0;
|
||||
}
|
||||
uint _option23 = void;
|
||||
uint _option24 = void;
|
||||
if (recipe.category.isSome) {
|
||||
ref _payload22 = recipe.category.unwrap();
|
||||
_option23 = 1;
|
||||
_option24 = cast(uint)(_payload22);
|
||||
} else {
|
||||
_option23 = 0;
|
||||
_option24 = 0;
|
||||
}
|
||||
__import_registerCooking(this.__handle, cast(void*)(id.ptr), id.length, cast(uint)(stationType), _variantPart8, _variantPart9, _variantPart10, recipe.output.__handle, recipe.experience, recipe.cookingTime, _option16, _option17, _option18, _option23, _option24);
|
||||
deallocate.purge();
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/recipe@0.1.0", "[method]recipe-manager.register-cooking")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__recipe@0.1.0__:method:recipe_manager.register_cooking")
|
||||
static private extern(C) void __import_registerCooking(uint, void*, size_t, uint, uint, void*, size_t, uint, float, uint, uint, void*, size_t, uint, uint) nothrow;
|
||||
}
|
||||
}
|
||||
10
src/wit/pumpkin/plugin/scheduler/common.d
Normal file
10
src/wit/pumpkin/plugin/scheduler/common.d
Normal file
@ -0,0 +1,10 @@
|
||||
/++
|
||||
Provides functionality to schedule tasks to be executed later on the server.
|
||||
+/
|
||||
module wit.pumpkin.plugin.scheduler.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
60
src/wit/pumpkin/plugin/scheduler/imports.d
Normal file
60
src/wit/pumpkin/plugin/scheduler/imports.d
Normal file
@ -0,0 +1,60 @@
|
||||
/++
|
||||
Provides functionality to schedule tasks to be executed later on the server.
|
||||
+/
|
||||
module wit.pumpkin.plugin.scheduler.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.scheduler.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
Schedules a task to be executed once after the specified number of ticks.
|
||||
|
||||
* `handler-id`: The unique ID of the handler to call when the task executes.
|
||||
* `delay-ticks`: The number of game ticks to wait before execution (20 ticks = 1 second).
|
||||
|
||||
Returns a unique task ID that can be used to cancel the task.
|
||||
+/
|
||||
uint scheduleDelayedTask(uint handlerId, ulong delayTicks) @trusted nothrow {
|
||||
auto _ret = __import_scheduleDelayedTask(handlerId, delayTicks);
|
||||
return _ret;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scheduler@0.1.0", "schedule-delayed-task")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scheduler@0.1.0__schedule_delayed_task")
|
||||
private extern(C) uint __import_scheduleDelayedTask(uint, ulong) nothrow;
|
||||
|
||||
/++
|
||||
Schedules a task to be executed repeatedly.
|
||||
|
||||
* `handler-id`: The unique ID of the handler to call when the task executes.
|
||||
* `delay-ticks`: The number of game ticks to wait before the first execution.
|
||||
* `period-ticks`: The number of game ticks between subsequent executions.
|
||||
|
||||
Returns a unique task ID that can be used to cancel the task.
|
||||
+/
|
||||
uint scheduleRepeatingTask(uint handlerId, ulong delayTicks, ulong periodTicks) @trusted nothrow {
|
||||
auto _ret = __import_scheduleRepeatingTask(handlerId, delayTicks, periodTicks);
|
||||
return _ret;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scheduler@0.1.0", "schedule-repeating-task")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scheduler@0.1.0__schedule_repeating_task")
|
||||
private extern(C) uint __import_scheduleRepeatingTask(uint, ulong, ulong) nothrow;
|
||||
|
||||
/++
|
||||
Cancels a scheduled task if it hasn't finished yet.
|
||||
|
||||
* `task-id`: The ID of the task to cancel.
|
||||
+/
|
||||
void cancelTask(uint taskId) @trusted nothrow {
|
||||
__import_cancelTask(taskId);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scheduler@0.1.0", "cancel-task")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scheduler@0.1.0__cancel_task")
|
||||
private extern(C) void __import_cancelTask(uint) nothrow;
|
||||
212
src/wit/pumpkin/plugin/scoreboard/common.d
Normal file
212
src/wit/pumpkin/plugin/scoreboard/common.d
Normal file
@ -0,0 +1,212 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.scoreboard.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.common.common;
|
||||
static import wit.pumpkin.plugin.text.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias NamedColor = wit.pumpkin.plugin.common.common.NamedColor;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum RenderType : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
integer,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
hearts,
|
||||
}
|
||||
/++
|
||||
|
||||
+/
|
||||
enum DisplaySlot : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
playerList,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebar,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
belowName,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebarTeamBlack,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebarTeamDarkBlue,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebarTeamDarkGreen,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebarTeamDarkAqua,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebarTeamDarkRed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebarTeamDarkPurple,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebarTeamGold,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebarTeamGray,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebarTeamDarkGray,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebarTeamBlue,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebarTeamGreen,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebarTeamAqua,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebarTeamRed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebarTeamLightPurple,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebarTeamYellow,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebarTeamWhite,
|
||||
}
|
||||
/++
|
||||
|
||||
+/
|
||||
enum NametagVisibility : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
always,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
never,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
hideForOtherTeams,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
hideForOwnTeam,
|
||||
}
|
||||
/++
|
||||
|
||||
+/
|
||||
enum CollisionRule : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
always,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
never,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
pushOtherTeams,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
pushOwnTeam,
|
||||
}
|
||||
/++
|
||||
|
||||
+/
|
||||
enum BedrockSortOrder : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
ascending,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
descending,
|
||||
}
|
||||
/++
|
||||
|
||||
+/
|
||||
enum BedrockDisplaySlot : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
playerList,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sidebar,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
belowName,
|
||||
}
|
||||
696
src/wit/pumpkin/plugin/scoreboard/imports.d
Normal file
696
src/wit/pumpkin/plugin/scoreboard/imports.d
Normal file
@ -0,0 +1,696 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.scoreboard.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.scoreboard.common;
|
||||
|
||||
static import wit.pumpkin.plugin.common.imports;
|
||||
static import wit.pumpkin.plugin.text.imports;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias TextComponent = wit.pumpkin.plugin.text.imports.TextComponent;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
struct NumberFormat {
|
||||
mixin WitVariant!(
|
||||
void, // blank
|
||||
TextComponent, // fixed
|
||||
);
|
||||
|
||||
public:
|
||||
enum Tag : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
blank,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fixed,
|
||||
}
|
||||
pragma(inline, true) Tag tag() const @safe @nogc nothrow pure => _tag;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias blank = _create!(Tag.blank);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isBlank() const => _tag == Tag.blank;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias fixed = _create!(Tag.fixed);
|
||||
/// ditto
|
||||
pragma(inline, true) bool isFixed() const => _tag == Tag.fixed;
|
||||
///ditto
|
||||
alias getFixed = _get!(Tag.fixed);
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
switch (_tag) with (Tag) {
|
||||
case fixed: _get!(Tag.fixed).witDrop; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
NumberFormat witClone() const @nogc nothrow {
|
||||
final switch (_tag) {
|
||||
case Tag.blank: return _create!(Tag.blank); break;
|
||||
case Tag.fixed: return _create!(Tag.fixed)(this._get!(Tag.fixed).witClone); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
struct TeamSettings {
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent displayName;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bool friendlyFire;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bool seeFriendlyInvisibles;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
NametagVisibility nametagVisibility;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
CollisionRule collisionRule;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
NamedColor color;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent prefix;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
TextComponent suffix;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
displayName.witDrop;
|
||||
prefix.witDrop;
|
||||
suffix.witDrop;
|
||||
}
|
||||
|
||||
TeamSettings witClone() const @nogc nothrow {
|
||||
TeamSettings clone = void;
|
||||
clone.displayName = this.displayName.witClone;
|
||||
clone.friendlyFire = this.friendlyFire.witClone;
|
||||
clone.seeFriendlyInvisibles = this.seeFriendlyInvisibles.witClone;
|
||||
clone.nametagVisibility = this.nametagVisibility.witClone;
|
||||
clone.collisionRule = this.collisionRule.witClone;
|
||||
clone.color = this.color.witClone;
|
||||
clone.prefix = this.prefix.witClone;
|
||||
clone.suffix = this.suffix.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
struct Scoreboard {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
|
||||
pragma(inline, true) void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[resource-drop]scoreboard")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:resource_drop:scoreboard")
|
||||
static private extern(C) void __import_drop(uint) @nogc nothrow;
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true) typeof(this) witClone() const @safe @nogc nothrow { return typeof(this)(__handle); }
|
||||
// TODO: make RAII? disable copy for the own
|
||||
|
||||
Borrow borrow() => Borrow(__handle);
|
||||
alias borrow this;
|
||||
|
||||
struct Borrow {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true)
|
||||
void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
pragma(inline, true) Borrow witClone() const @safe @nogc nothrow { return Borrow(__handle); }
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void addObjective(in WitString name, TextComponent displayName, RenderType renderType, in Option!(NumberFormat) numberFormat) @trusted nothrow {
|
||||
uint _option11 = void;
|
||||
uint _option12 = void;
|
||||
uint _option13 = void;
|
||||
if (numberFormat.isSome) {
|
||||
ref _payload3 = numberFormat.unwrap();
|
||||
uint _variantPart8 = void;
|
||||
uint _variantPart9 = void;
|
||||
alias _Tag10 = NumberFormat.Tag;
|
||||
final switch (_payload3.tag) {
|
||||
case _Tag10.blank: {
|
||||
_variantPart8 = 0;
|
||||
_variantPart9 = 0;
|
||||
break;
|
||||
}
|
||||
case _Tag10.fixed: {
|
||||
const ref TextComponent _payload7 = _payload3.getFixed();
|
||||
_variantPart8 = 1;
|
||||
_variantPart9 = _payload7.__handle;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_option11 = 1;
|
||||
_option12 = _variantPart8;
|
||||
_option13 = _variantPart9;
|
||||
} else {
|
||||
_option11 = 0;
|
||||
_option12 = 0;
|
||||
_option13 = 0;
|
||||
}
|
||||
__import_addObjective(this.__handle, cast(void*)(name.ptr), name.length, displayName.__handle, cast(uint)(renderType), _option11, _option12, _option13);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.add-objective")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.add_objective")
|
||||
static private extern(C) void __import_addObjective(uint, void*, size_t, uint, uint, uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void updateObjective(in WitString name, TextComponent displayName, RenderType renderType, in Option!(NumberFormat) numberFormat) @trusted nothrow {
|
||||
uint _option11 = void;
|
||||
uint _option12 = void;
|
||||
uint _option13 = void;
|
||||
if (numberFormat.isSome) {
|
||||
ref _payload3 = numberFormat.unwrap();
|
||||
uint _variantPart8 = void;
|
||||
uint _variantPart9 = void;
|
||||
alias _Tag10 = NumberFormat.Tag;
|
||||
final switch (_payload3.tag) {
|
||||
case _Tag10.blank: {
|
||||
_variantPart8 = 0;
|
||||
_variantPart9 = 0;
|
||||
break;
|
||||
}
|
||||
case _Tag10.fixed: {
|
||||
const ref TextComponent _payload7 = _payload3.getFixed();
|
||||
_variantPart8 = 1;
|
||||
_variantPart9 = _payload7.__handle;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_option11 = 1;
|
||||
_option12 = _variantPart8;
|
||||
_option13 = _variantPart9;
|
||||
} else {
|
||||
_option11 = 0;
|
||||
_option12 = 0;
|
||||
_option13 = 0;
|
||||
}
|
||||
__import_updateObjective(this.__handle, cast(void*)(name.ptr), name.length, displayName.__handle, cast(uint)(renderType), _option11, _option12, _option13);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.update-objective")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.update_objective")
|
||||
static private extern(C) void __import_updateObjective(uint, void*, size_t, uint, uint, uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void removeObjective(in WitString name) @trusted nothrow {
|
||||
__import_removeObjective(this.__handle, cast(void*)(name.ptr), name.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.remove-objective")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.remove_objective")
|
||||
static private extern(C) void __import_removeObjective(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void setDisplaySlot(DisplaySlot slot, in WitString objectiveName) @trusted nothrow {
|
||||
__import_setDisplaySlot(this.__handle, cast(uint)(slot), cast(void*)(objectiveName.ptr), objectiveName.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.set-display-slot")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.set_display_slot")
|
||||
static private extern(C) void __import_setDisplaySlot(uint, uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void clearDisplaySlot(DisplaySlot slot) @trusted nothrow {
|
||||
__import_clearDisplaySlot(this.__handle, cast(uint)(slot));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.clear-display-slot")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.clear_display_slot")
|
||||
static private extern(C) void __import_clearDisplaySlot(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void updateScore(in WitString entityName, in WitString objectiveName, int value, in Option!(NumberFormat) numberFormat) @trusted nothrow {
|
||||
uint _option11 = void;
|
||||
uint _option12 = void;
|
||||
uint _option13 = void;
|
||||
if (numberFormat.isSome) {
|
||||
ref _payload3 = numberFormat.unwrap();
|
||||
uint _variantPart8 = void;
|
||||
uint _variantPart9 = void;
|
||||
alias _Tag10 = NumberFormat.Tag;
|
||||
final switch (_payload3.tag) {
|
||||
case _Tag10.blank: {
|
||||
_variantPart8 = 0;
|
||||
_variantPart9 = 0;
|
||||
break;
|
||||
}
|
||||
case _Tag10.fixed: {
|
||||
const ref TextComponent _payload7 = _payload3.getFixed();
|
||||
_variantPart8 = 1;
|
||||
_variantPart9 = _payload7.__handle;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_option11 = 1;
|
||||
_option12 = _variantPart8;
|
||||
_option13 = _variantPart9;
|
||||
} else {
|
||||
_option11 = 0;
|
||||
_option12 = 0;
|
||||
_option13 = 0;
|
||||
}
|
||||
__import_updateScore(this.__handle, cast(void*)(entityName.ptr), entityName.length, cast(void*)(objectiveName.ptr), objectiveName.length, cast(uint)(value), _option11, _option12, _option13);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.update-score")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.update_score")
|
||||
static private extern(C) void __import_updateScore(uint, void*, size_t, void*, size_t, uint, uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
int addScore(in WitString entityName, in WitString objectiveName, int delta) @trusted nothrow {
|
||||
auto _ret = __import_addScore(this.__handle, cast(void*)(entityName.ptr), entityName.length, cast(void*)(objectiveName.ptr), objectiveName.length, cast(uint)(delta));
|
||||
return cast(int)(_ret);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.add-score")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.add_score")
|
||||
static private extern(C) uint __import_addScore(uint, void*, size_t, void*, size_t, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void removeScore(in WitString entityName, in WitString objectiveName) @trusted nothrow {
|
||||
__import_removeScore(this.__handle, cast(void*)(entityName.ptr), entityName.length, cast(void*)(objectiveName.ptr), objectiveName.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.remove-score")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.remove_score")
|
||||
static private extern(C) void __import_removeScore(uint, void*, size_t, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void resetEntityScores(in WitString entityName) @trusted nothrow {
|
||||
__import_resetEntityScores(this.__handle, cast(void*)(entityName.ptr), entityName.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.reset-entity-scores")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.reset_entity_scores")
|
||||
static private extern(C) void __import_resetEntityScores(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void createTeam(in WitString name, in TeamSettings settings) @trusted nothrow {
|
||||
__import_createTeam(this.__handle, cast(void*)(name.ptr), name.length, settings.displayName.__handle, cast(uint)(settings.friendlyFire), cast(uint)(settings.seeFriendlyInvisibles), cast(uint)(settings.nametagVisibility), cast(uint)(settings.collisionRule), cast(uint)(settings.color), settings.prefix.__handle, settings.suffix.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.create-team")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.create_team")
|
||||
static private extern(C) void __import_createTeam(uint, void*, size_t, uint, uint, uint, uint, uint, uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void removeTeam(in WitString name) @trusted nothrow {
|
||||
__import_removeTeam(this.__handle, cast(void*)(name.ptr), name.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.remove-team")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.remove_team")
|
||||
static private extern(C) void __import_removeTeam(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void updateTeam(in WitString name, in TeamSettings settings) @trusted nothrow {
|
||||
__import_updateTeam(this.__handle, cast(void*)(name.ptr), name.length, settings.displayName.__handle, cast(uint)(settings.friendlyFire), cast(uint)(settings.seeFriendlyInvisibles), cast(uint)(settings.nametagVisibility), cast(uint)(settings.collisionRule), cast(uint)(settings.color), settings.prefix.__handle, settings.suffix.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.update-team")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.update_team")
|
||||
static private extern(C) void __import_updateTeam(uint, void*, size_t, uint, uint, uint, uint, uint, uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void addPlayerToTeam(in WitString teamName, in WitString playerName) @trusted nothrow {
|
||||
__import_addPlayerToTeam(this.__handle, cast(void*)(teamName.ptr), teamName.length, cast(void*)(playerName.ptr), playerName.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.add-player-to-team")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.add_player_to_team")
|
||||
static private extern(C) void __import_addPlayerToTeam(uint, void*, size_t, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void removePlayerFromTeam(in WitString teamName, in WitString playerName) @trusted nothrow {
|
||||
__import_removePlayerFromTeam(this.__handle, cast(void*)(teamName.ptr), teamName.length, cast(void*)(playerName.ptr), playerName.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.remove-player-from-team")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.remove_player_from_team")
|
||||
static private extern(C) void __import_removePlayerFromTeam(uint, void*, size_t, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void clearTeamPlayers(in WitString teamName) @trusted nothrow {
|
||||
__import_clearTeamPlayers(this.__handle, cast(void*)(teamName.ptr), teamName.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.clear-team-players")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.clear_team_players")
|
||||
static private extern(C) void __import_clearTeamPlayers(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitList!(WitString) getTeams() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_getTeams(this.__handle, _retArea.ptr);
|
||||
auto _listSrcPtr3 = *(cast(void**)(_retArea.ptr + 0));
|
||||
auto _listLen3 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _list3 = _listLen3 ? wit.common.mallocSlice!(WitString)(_listLen3) : [];
|
||||
assert(!_listLen3 || _list3.ptr);
|
||||
foreach (_elem0_idx, ref _elem0; _list3) {
|
||||
const auto _base0 = _listSrcPtr3 + _elem0_idx * (2*size_t.sizeof);
|
||||
auto _len1 = *(cast(size_t*)(_base0 + size_t.sizeof));
|
||||
auto _ptr1 = _len1 ? cast(char*)(*(cast(void**)(_base0 + 0))) : null;
|
||||
auto _list2 = WitString(_ptr1[0.._len1]);
|
||||
_elem0 = _list2;
|
||||
}
|
||||
if (_listLen3) wit.common.free(_listSrcPtr3);
|
||||
auto _witList4 = WitList!(WitString)(_list3);
|
||||
auto _flush5 = _witList4;
|
||||
return _flush5;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.get-teams")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.get_teams")
|
||||
static private extern(C) void __import_getTeams(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(TeamSettings) getTeam(in WitString name) @trusted nothrow {
|
||||
align(4) void[24] _retArea = void;
|
||||
__import_getTeam(this.__handle, cast(void*)(name.ptr), name.length, _retArea.ptr);
|
||||
Option!(TeamSettings) _option6 = void;
|
||||
bool _isSome6 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome6) {
|
||||
auto _handle2 = TextComponent(*(cast(uint*)(_retArea.ptr + 4)));
|
||||
auto _handle3 = TextComponent(*(cast(uint*)(_retArea.ptr + 16)));
|
||||
auto _handle4 = TextComponent(*(cast(uint*)(_retArea.ptr + 20)));
|
||||
TeamSettings _record5 = {
|
||||
displayName: _handle2,
|
||||
friendlyFire: (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 8)))) != 0,
|
||||
seeFriendlyInvisibles: (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 9)))) != 0,
|
||||
nametagVisibility: cast(NametagVisibility)(cast(uint)(*(cast(ubyte*)(_retArea.ptr + 10)))),
|
||||
collisionRule: cast(CollisionRule)(cast(uint)(*(cast(ubyte*)(_retArea.ptr + 11)))),
|
||||
color: cast(wit.pumpkin.plugin.common.imports.NamedColor)(cast(uint)(*(cast(ubyte*)(_retArea.ptr + 12)))),
|
||||
prefix: _handle3,
|
||||
suffix: _handle4,
|
||||
};
|
||||
|
||||
_option6 = Option!(TeamSettings).makeSome(_record5);
|
||||
} else {
|
||||
_option6 = Option!(TeamSettings).makeNone;
|
||||
}
|
||||
auto _flush7 = _option6;
|
||||
return _flush7;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.get-team")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.get_team")
|
||||
static private extern(C) void __import_getTeam(uint, void*, size_t, void*) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitList!(WitString) getTeamPlayers(in WitString teamName) @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_getTeamPlayers(this.__handle, cast(void*)(teamName.ptr), teamName.length, _retArea.ptr);
|
||||
auto _listSrcPtr3 = *(cast(void**)(_retArea.ptr + 0));
|
||||
auto _listLen3 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _list3 = _listLen3 ? wit.common.mallocSlice!(WitString)(_listLen3) : [];
|
||||
assert(!_listLen3 || _list3.ptr);
|
||||
foreach (_elem0_idx, ref _elem0; _list3) {
|
||||
const auto _base0 = _listSrcPtr3 + _elem0_idx * (2*size_t.sizeof);
|
||||
auto _len1 = *(cast(size_t*)(_base0 + size_t.sizeof));
|
||||
auto _ptr1 = _len1 ? cast(char*)(*(cast(void**)(_base0 + 0))) : null;
|
||||
auto _list2 = WitString(_ptr1[0.._len1]);
|
||||
_elem0 = _list2;
|
||||
}
|
||||
if (_listLen3) wit.common.free(_listSrcPtr3);
|
||||
auto _witList4 = WitList!(WitString)(_list3);
|
||||
auto _flush5 = _witList4;
|
||||
return _flush5;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.get-team-players")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.get_team_players")
|
||||
static private extern(C) void __import_getTeamPlayers(uint, void*, size_t, void*) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(WitString) getPlayerTeam(in WitString playerName) @trusted nothrow {
|
||||
align(size_t.sizeof) void[(3*size_t.sizeof)] _retArea = void;
|
||||
__import_getPlayerTeam(this.__handle, cast(void*)(playerName.ptr), playerName.length, _retArea.ptr);
|
||||
Option!(WitString) _option4 = void;
|
||||
bool _isSome4 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome4) {
|
||||
auto _len2 = *(cast(size_t*)(_retArea.ptr + (2*size_t.sizeof)));
|
||||
auto _ptr2 = _len2 ? cast(char*)(*(cast(void**)(_retArea.ptr + size_t.sizeof))) : null;
|
||||
auto _list3 = WitString(_ptr2[0.._len2]);
|
||||
|
||||
_option4 = Option!(WitString).makeSome(_list3);
|
||||
} else {
|
||||
_option4 = Option!(WitString).makeNone;
|
||||
}
|
||||
auto _flush5 = _option4;
|
||||
return _flush5;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]scoreboard.get-player-team")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:scoreboard.get_player_team")
|
||||
static private extern(C) void __import_getPlayerTeam(uint, void*, size_t, void*) nothrow;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
struct BedrockScoreboard {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
|
||||
pragma(inline, true) void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[resource-drop]bedrock-scoreboard")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:resource_drop:bedrock_scoreboard")
|
||||
static private extern(C) void __import_drop(uint) @nogc nothrow;
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true) typeof(this) witClone() const @safe @nogc nothrow { return typeof(this)(__handle); }
|
||||
// TODO: make RAII? disable copy for the own
|
||||
|
||||
Borrow borrow() => Borrow(__handle);
|
||||
alias borrow this;
|
||||
|
||||
struct Borrow {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true)
|
||||
void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
pragma(inline, true) Borrow witClone() const @safe @nogc nothrow { return Borrow(__handle); }
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void addObjective(in WitString name, in WitString displayName, BedrockSortOrder sortOrder) @trusted nothrow {
|
||||
__import_addObjective(this.__handle, cast(void*)(name.ptr), name.length, cast(void*)(displayName.ptr), displayName.length, cast(uint)(sortOrder));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]bedrock-scoreboard.add-objective")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:bedrock_scoreboard.add_objective")
|
||||
static private extern(C) void __import_addObjective(uint, void*, size_t, void*, size_t, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void updateObjective(in WitString name, in WitString displayName, BedrockSortOrder sortOrder) @trusted nothrow {
|
||||
__import_updateObjective(this.__handle, cast(void*)(name.ptr), name.length, cast(void*)(displayName.ptr), displayName.length, cast(uint)(sortOrder));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]bedrock-scoreboard.update-objective")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:bedrock_scoreboard.update_objective")
|
||||
static private extern(C) void __import_updateObjective(uint, void*, size_t, void*, size_t, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void removeObjective(in WitString name) @trusted nothrow {
|
||||
__import_removeObjective(this.__handle, cast(void*)(name.ptr), name.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]bedrock-scoreboard.remove-objective")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:bedrock_scoreboard.remove_objective")
|
||||
static private extern(C) void __import_removeObjective(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void setDisplaySlot(BedrockDisplaySlot slot, in WitString objectiveName) @trusted nothrow {
|
||||
__import_setDisplaySlot(this.__handle, cast(uint)(slot), cast(void*)(objectiveName.ptr), objectiveName.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]bedrock-scoreboard.set-display-slot")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:bedrock_scoreboard.set_display_slot")
|
||||
static private extern(C) void __import_setDisplaySlot(uint, uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void clearDisplaySlot(BedrockDisplaySlot slot) @trusted nothrow {
|
||||
__import_clearDisplaySlot(this.__handle, cast(uint)(slot));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]bedrock-scoreboard.clear-display-slot")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:bedrock_scoreboard.clear_display_slot")
|
||||
static private extern(C) void __import_clearDisplaySlot(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void updateScore(in WitString entityName, in WitString objectiveName, int value) @trusted nothrow {
|
||||
__import_updateScore(this.__handle, cast(void*)(entityName.ptr), entityName.length, cast(void*)(objectiveName.ptr), objectiveName.length, cast(uint)(value));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]bedrock-scoreboard.update-score")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:bedrock_scoreboard.update_score")
|
||||
static private extern(C) void __import_updateScore(uint, void*, size_t, void*, size_t, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
int addScore(in WitString entityName, in WitString objectiveName, int delta) @trusted nothrow {
|
||||
auto _ret = __import_addScore(this.__handle, cast(void*)(entityName.ptr), entityName.length, cast(void*)(objectiveName.ptr), objectiveName.length, cast(uint)(delta));
|
||||
return cast(int)(_ret);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]bedrock-scoreboard.add-score")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:bedrock_scoreboard.add_score")
|
||||
static private extern(C) uint __import_addScore(uint, void*, size_t, void*, size_t, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void removeScore(in WitString entityName, in WitString objectiveName) @trusted nothrow {
|
||||
__import_removeScore(this.__handle, cast(void*)(entityName.ptr), entityName.length, cast(void*)(objectiveName.ptr), objectiveName.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]bedrock-scoreboard.remove-score")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:bedrock_scoreboard.remove_score")
|
||||
static private extern(C) void __import_removeScore(uint, void*, size_t, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void resetEntityScores(in WitString entityName) @trusted nothrow {
|
||||
__import_resetEntityScores(this.__handle, cast(void*)(entityName.ptr), entityName.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/scoreboard@0.1.0", "[method]bedrock-scoreboard.reset-entity-scores")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__scoreboard@0.1.0__:method:bedrock_scoreboard.reset_entity_scores")
|
||||
static private extern(C) void __import_resetEntityScores(uint, void*, size_t) nothrow;
|
||||
}
|
||||
}
|
||||
140
src/wit/pumpkin/plugin/screens/common.d
Normal file
140
src/wit/pumpkin/plugin/screens/common.d
Normal file
@ -0,0 +1,140 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.screens.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum Screen : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
generic9x1,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
generic9x2,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
generic9x3,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
generic9x4,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
generic9x5,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
generic9x6,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
generic3x3,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
crafter3x3,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
anvil,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
beacon,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blastFurnace,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
brewingStand,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
crafting,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enchantment,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
furnace,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
grindstone,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
hopper,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
lectern,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
loom,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
merchant,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
shulkerBox,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
smithing,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
smoker,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cartographyTable,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
stonecutter,
|
||||
}
|
||||
12
src/wit/pumpkin/plugin/screens/imports.d
Normal file
12
src/wit/pumpkin/plugin/screens/imports.d
Normal file
@ -0,0 +1,12 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.screens.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.screens.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
321
src/wit/pumpkin/plugin/server/common.d
Normal file
321
src/wit/pumpkin/plugin/server/common.d
Normal file
@ -0,0 +1,321 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.server.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.common.common;
|
||||
static import wit.pumpkin.plugin.datapack.common;
|
||||
static import wit.pumpkin.plugin.permission.common;
|
||||
static import wit.pumpkin.plugin.text.common;
|
||||
static import wit.pumpkin.plugin.advancement.common;
|
||||
static import wit.pumpkin.plugin.enchantments.common;
|
||||
static import wit.pumpkin.plugin.recipe.common;
|
||||
static import wit.pumpkin.plugin.uuid.common;
|
||||
static import wit.pumpkin.plugin.world.common;
|
||||
static import wit.pumpkin.plugin.player.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias KnownServerLink = wit.pumpkin.plugin.player.common.KnownServerLink;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias GameMode = wit.pumpkin.plugin.common.common.GameMode;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias Uuid = wit.pumpkin.plugin.uuid.common.Uuid;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias PermissionLevel = wit.pumpkin.plugin.permission.common.PermissionLevel;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias DatapackInfo = wit.pumpkin.plugin.datapack.common.DatapackInfo;
|
||||
|
||||
/++
|
||||
Represents an operator entry in the ops configuration.
|
||||
+/
|
||||
struct OpEntry {
|
||||
/++
|
||||
|
||||
+/
|
||||
Uuid uuid;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString name;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
PermissionLevel level;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bool bypassesPlayerLimit;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
name.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
OpEntry witClone() const @nogc nothrow {
|
||||
OpEntry clone = void;
|
||||
clone.uuid = this.uuid.witClone;
|
||||
clone.name = this.name.witClone;
|
||||
clone.level = this.level.witClone;
|
||||
clone.bypassesPlayerLimit = this.bypassesPlayerLimit.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Represents a banned player entry in the ban list.
|
||||
+/
|
||||
struct BannedPlayerEntry {
|
||||
/++
|
||||
|
||||
+/
|
||||
Uuid uuid;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString name;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString created;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString source;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(WitString) expires;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString reason;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
name.witFree;
|
||||
created.witFree;
|
||||
source.witFree;
|
||||
expires.witFree;
|
||||
reason.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
BannedPlayerEntry witClone() const @nogc nothrow {
|
||||
BannedPlayerEntry clone = void;
|
||||
clone.uuid = this.uuid.witClone;
|
||||
clone.name = this.name.witClone;
|
||||
clone.created = this.created.witClone;
|
||||
clone.source = this.source.witClone;
|
||||
clone.expires = this.expires.witClone;
|
||||
clone.reason = this.reason.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Represents a banned IP entry in the IP ban list.
|
||||
+/
|
||||
struct BannedIpEntry {
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString ip;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString created;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString source;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(WitString) expires;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString reason;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
ip.witFree;
|
||||
created.witFree;
|
||||
source.witFree;
|
||||
expires.witFree;
|
||||
reason.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
BannedIpEntry witClone() const @nogc nothrow {
|
||||
BannedIpEntry clone = void;
|
||||
clone.ip = this.ip.witClone;
|
||||
clone.created = this.created.witClone;
|
||||
clone.source = this.source.witClone;
|
||||
clone.expires = this.expires.witClone;
|
||||
clone.reason = this.reason.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Represents a player entry in the server whitelist.
|
||||
+/
|
||||
struct WhitelistEntry {
|
||||
/++
|
||||
|
||||
+/
|
||||
Uuid uuid;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString name;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
name.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
WhitelistEntry witClone() const @nogc nothrow {
|
||||
WhitelistEntry clone = void;
|
||||
clone.uuid = this.uuid.witClone;
|
||||
clone.name = this.name.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
/++
|
||||
Represents the difficulty setting of a Minecraft server.
|
||||
+/
|
||||
enum Difficulty : ubyte {
|
||||
/++
|
||||
Hostile mobs do not spawn. Players regain health automatically.
|
||||
+/
|
||||
peaceful,
|
||||
|
||||
/++
|
||||
Hostile mobs deal less damage.
|
||||
+/
|
||||
easy,
|
||||
|
||||
/++
|
||||
Standard Minecraft difficulty.
|
||||
+/
|
||||
normal,
|
||||
|
||||
/++
|
||||
Hostile mobs deal more damage.
|
||||
+/
|
||||
hard,
|
||||
}
|
||||
/++
|
||||
Represents the three main Minecraft dimensions.
|
||||
+/
|
||||
enum Dimension : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
overworld,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
nether,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
end,
|
||||
}
|
||||
/++
|
||||
|
||||
+/
|
||||
struct SysInfo {
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(uint) cpuCount;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(ulong) totalMemory;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(ulong) usedMemory;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(WitString) osName;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
Option!(WitString) osVersion;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString pumpkinVersion;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
osName.witFree;
|
||||
osVersion.witFree;
|
||||
pumpkinVersion.witFree;
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
SysInfo witClone() const @nogc nothrow {
|
||||
SysInfo clone = void;
|
||||
clone.cpuCount = this.cpuCount.witClone;
|
||||
clone.totalMemory = this.totalMemory.witClone;
|
||||
clone.usedMemory = this.usedMemory.witClone;
|
||||
clone.osName = this.osName.witClone;
|
||||
clone.osVersion = this.osVersion.witClone;
|
||||
clone.pumpkinVersion = this.pumpkinVersion.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
1748
src/wit/pumpkin/plugin/server/imports.d
Normal file
1748
src/wit/pumpkin/plugin/server/imports.d
Normal file
File diff suppressed because it is too large
Load Diff
9914
src/wit/pumpkin/plugin/sounds/common.d
Normal file
9914
src/wit/pumpkin/plugin/sounds/common.d
Normal file
File diff suppressed because it is too large
Load Diff
12
src/wit/pumpkin/plugin/sounds/imports.d
Normal file
12
src/wit/pumpkin/plugin/sounds/imports.d
Normal file
@ -0,0 +1,12 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.sounds.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.sounds.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
449
src/wit/pumpkin/plugin/statistics/common.d
Normal file
449
src/wit/pumpkin/plugin/statistics/common.d
Normal file
@ -0,0 +1,449 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.statistics.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum StatisticCategory : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
mined,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
crafted,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
used,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
broken,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
pickedUp,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
dropped,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
killed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
killedBy,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
custom,
|
||||
}
|
||||
/++
|
||||
|
||||
+/
|
||||
enum CustomStatistic : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
leaveGame,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
playTime,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
totalWorldTime,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
timeSinceDeath,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
timeSinceRest,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sneakTime,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
walkOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
crouchOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sprintOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
walkOnWaterOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fallOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
climbOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
flyOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
walkUnderWaterOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
minecartOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
boatOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
pigOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
happyGhastOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
horseOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
aviateOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
swimOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
striderOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
nautilusOneCm,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
jump,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
drop,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
damageDealt,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
damageDealtAbsorbed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
damageDealtResisted,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
damageTaken,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
damageBlockedByShield,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
damageAbsorbed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
damageResisted,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
deaths,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
mobKills,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
animalsBred,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
playerKills,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fishCaught,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
talkedToVillager,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tradedWithVillager,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
eatCakeSlice,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fillCauldron,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
useCauldron,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cleanArmor,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cleanBanner,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
cleanShulkerBox,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
interactWithBrewingstand,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
interactWithBeacon,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
inspectDropper,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
inspectHopper,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
inspectDispenser,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
playNoteblock,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
tuneNoteblock,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
potFlower,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
triggerTrappedChest,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
openEnderchest,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enchantItem,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
playRecord,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
interactWithFurnace,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
interactWithCraftingTable,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
openChest,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
sleepInBed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
openShulkerBox,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
openBarrel,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
interactWithBlastFurnace,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
interactWithSmoker,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
interactWithLectern,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
interactWithCampfire,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
interactWithCartographyTable,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
interactWithLoom,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
interactWithStonecutter,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bellRing,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
raidTrigger,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
raidWin,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
interactWithAnvil,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
interactWithGrindstone,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
targetHit,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
interactWithSmithingTable,
|
||||
}
|
||||
12
src/wit/pumpkin/plugin/statistics/imports.d
Normal file
12
src/wit/pumpkin/plugin/statistics/imports.d
Normal file
@ -0,0 +1,12 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.statistics.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.statistics.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
261
src/wit/pumpkin/plugin/status_effect/common.d
Normal file
261
src/wit/pumpkin/plugin/status_effect/common.d
Normal file
@ -0,0 +1,261 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.status_effect.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
enum StatusEffectType : ubyte {
|
||||
/++
|
||||
|
||||
+/
|
||||
speed,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
slowness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
haste,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
miningFatigue,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
strength,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
instantHealth,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
instantDamage,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
jumpBoost,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
nausea,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
regeneration,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
resistance,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
fireResistance,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
waterBreathing,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
invisibility,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
blindness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
nightVision,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
hunger,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
weakness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
poison,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
wither,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
healthBoost,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
absorption,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
saturation,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
glowing,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
levitation,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
luck,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
unluck,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
slowFalling,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
conduitPower,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
dolphinsGrace,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
badOmen,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
heroOfTheVillage,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
darkness,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
trialOmen,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
raidOmen,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
windCharged,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
weaving,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
oozing,
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
infested,
|
||||
}
|
||||
/++
|
||||
|
||||
+/
|
||||
struct StatusEffectInstance {
|
||||
/++
|
||||
|
||||
+/
|
||||
StatusEffectType effectType;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
uint duration;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
ubyte amplifier;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bool ambient;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bool showParticles;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
bool showIcon;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
StatusEffectInstance witClone() const @nogc nothrow {
|
||||
StatusEffectInstance clone = void;
|
||||
clone.effectType = this.effectType.witClone;
|
||||
clone.duration = this.duration.witClone;
|
||||
clone.amplifier = this.amplifier.witClone;
|
||||
clone.ambient = this.ambient.witClone;
|
||||
clone.showParticles = this.showParticles.witClone;
|
||||
clone.showIcon = this.showIcon.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
12
src/wit/pumpkin/plugin/status_effect/imports.d
Normal file
12
src/wit/pumpkin/plugin/status_effect/imports.d
Normal file
@ -0,0 +1,12 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.status_effect.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.status_effect.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
26
src/wit/pumpkin/plugin/text/common.d
Normal file
26
src/wit/pumpkin/plugin/text/common.d
Normal file
@ -0,0 +1,26 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.text.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
static import wit.pumpkin.plugin.common.common;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias NamedColor = wit.pumpkin.plugin.common.common.NamedColor;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias RgbColor = wit.pumpkin.plugin.common.common.RgbColor;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
alias ArgbColor = wit.pumpkin.plugin.common.common.ArgbColor;
|
||||
553
src/wit/pumpkin/plugin/text/imports.d
Normal file
553
src/wit/pumpkin/plugin/text/imports.d
Normal file
@ -0,0 +1,553 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.text.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.text.common;
|
||||
|
||||
static import wit.pumpkin.plugin.common.imports;
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
struct TextComponent {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
|
||||
/++
|
||||
Creates a plain text component.
|
||||
+/
|
||||
static TextComponent text(in WitString plain) @trusted nothrow {
|
||||
auto _ret = __import_text(cast(void*)(plain.ptr), plain.length);
|
||||
auto _handle0 = TextComponent(_ret);
|
||||
return _handle0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.text")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.text")
|
||||
static private extern(C) uint __import_text(void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Creates a translation component.
|
||||
+/
|
||||
static TextComponent translate(in WitString key, in WitList!(TextComponent) with_) @trusted nothrow {
|
||||
auto _ret = __import_translate(cast(void*)(key.ptr), key.length, cast(void*)(with_.ptr), with_.length);
|
||||
auto _handle0 = TextComponent(_ret);
|
||||
return _handle0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.translate")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.translate")
|
||||
static private extern(C) uint __import_translate(void*, size_t, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Creates a translation component with a Bedrock-specific fallback key.
|
||||
+/
|
||||
static TextComponent translateCross(in WitString javaKey, in WitString bedrockKey, in WitList!(TextComponent) with_) @trusted nothrow {
|
||||
auto _ret = __import_translateCross(cast(void*)(javaKey.ptr), javaKey.length, cast(void*)(bedrockKey.ptr), bedrockKey.length, cast(void*)(with_.ptr), with_.length);
|
||||
auto _handle0 = TextComponent(_ret);
|
||||
return _handle0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.translate-cross")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.translate_cross")
|
||||
static private extern(C) uint __import_translateCross(void*, size_t, void*, size_t, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Creates an entity names / selector text component.
|
||||
+/
|
||||
static TextComponent entityNames(in WitString selector, in Option!(WitString) separator) @trusted nothrow {
|
||||
uint _option4 = void;
|
||||
void* _option5 = void;
|
||||
size_t _option6 = void;
|
||||
if (separator.isSome) {
|
||||
ref _payload3 = separator.unwrap();
|
||||
_option4 = 1;
|
||||
_option5 = cast(void*)(_payload3.ptr);
|
||||
_option6 = _payload3.length;
|
||||
} else {
|
||||
_option4 = 0;
|
||||
_option5 = null;
|
||||
_option6 = 0;
|
||||
}
|
||||
auto _ret = __import_entityNames(cast(void*)(selector.ptr), selector.length, _option4, _option5, _option6);
|
||||
auto _handle7 = TextComponent(_ret);
|
||||
return _handle7;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.entity-names")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.entity_names")
|
||||
static private extern(C) uint __import_entityNames(void*, size_t, uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Creates a keybind text component (e.g., "key.jump").
|
||||
+/
|
||||
static TextComponent keybind(in WitString keybind) @trusted nothrow {
|
||||
auto _ret = __import_keybind(cast(void*)(keybind.ptr), keybind.length);
|
||||
auto _handle0 = TextComponent(_ret);
|
||||
return _handle0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.keybind")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.keybind")
|
||||
static private extern(C) uint __import_keybind(void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Creates a custom translation component.
|
||||
+/
|
||||
static TextComponent custom(in WitString namespace, in WitString key, in WitString locale, in WitList!(TextComponent) with_) @trusted nothrow {
|
||||
auto _ret = __import_custom(cast(void*)(namespace.ptr), namespace.length, cast(void*)(key.ptr), key.length, cast(void*)(locale.ptr), locale.length, cast(void*)(with_.ptr), with_.length);
|
||||
auto _handle0 = TextComponent(_ret);
|
||||
return _handle0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.custom")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.custom")
|
||||
static private extern(C) uint __import_custom(void*, size_t, void*, size_t, void*, size_t, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Parses a legacy Minecraft formatted string (using section signs '§' by default) into a text component.
|
||||
+/
|
||||
static TextComponent fromLegacyString(in WitString input) @trusted nothrow {
|
||||
auto _ret = __import_fromLegacyString(cast(void*)(input.ptr), input.length);
|
||||
auto _handle0 = TextComponent(_ret);
|
||||
return _handle0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.from-legacy-string")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.from_legacy_string")
|
||||
static private extern(C) uint __import_fromLegacyString(void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Parses a legacy formatted string using a custom color code symbol (e.g. '&' or '§').
|
||||
+/
|
||||
static TextComponent fromLegacyStringWithCode(in WitString input, dchar codeSymbol) @trusted nothrow {
|
||||
auto _ret = __import_fromLegacyStringWithCode(cast(void*)(input.ptr), input.length, cast(uint)(codeSymbol));
|
||||
auto _handle0 = TextComponent(_ret);
|
||||
return _handle0;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.from-legacy-string-with-code")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.from_legacy_string_with_code")
|
||||
static private extern(C) uint __import_fromLegacyStringWithCode(void*, size_t, uint) nothrow;
|
||||
|
||||
/++
|
||||
Parses a standard Minecraft JSON text component.
|
||||
+/
|
||||
static Result!(TextComponent, WitString) fromJson(in WitString json) @trusted nothrow {
|
||||
align(size_t.sizeof) void[(3*size_t.sizeof)] _retArea = void;
|
||||
__import_fromJson(cast(void*)(json.ptr), json.length, _retArea.ptr);
|
||||
Result!(TextComponent, WitString) _result5 = void;
|
||||
bool _isErr5 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isErr5) {
|
||||
auto _len3 = *(cast(size_t*)(_retArea.ptr + (2*size_t.sizeof)));
|
||||
auto _ptr3 = _len3 ? cast(char*)(*(cast(void**)(_retArea.ptr + size_t.sizeof))) : null;
|
||||
auto _list4 = WitString(_ptr3[0.._len3]);
|
||||
|
||||
_result5 = Result!(TextComponent, WitString).makeErr(_list4);
|
||||
} else {
|
||||
auto _handle1 = TextComponent(*(cast(uint*)(_retArea.ptr + size_t.sizeof)));
|
||||
|
||||
_result5 = Result!(TextComponent, WitString).makeOk(_handle1);
|
||||
}
|
||||
auto _flush6 = _result5;
|
||||
return _flush6;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[static]text-component.from-json")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:static:text_component.from_json")
|
||||
static private extern(C) void __import_fromJson(void*, size_t, void*) nothrow;
|
||||
|
||||
pragma(inline, true) void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[resource-drop]text-component")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:resource_drop:text_component")
|
||||
static private extern(C) void __import_drop(uint) @nogc nothrow;
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true) typeof(this) witClone() const @safe @nogc nothrow { return typeof(this)(__handle); }
|
||||
// TODO: make RAII? disable copy for the own
|
||||
|
||||
Borrow borrow() => Borrow(__handle);
|
||||
alias borrow this;
|
||||
|
||||
struct Borrow {
|
||||
package(wit) uint __handle = 0;
|
||||
|
||||
pragma(inline, true)
|
||||
package(wit) this(uint handle) @safe @nogc nothrow {
|
||||
__handle = handle;
|
||||
}
|
||||
|
||||
pragma(inline, true) void witFree() @safe @nogc nothrow {}
|
||||
pragma(inline, true)
|
||||
void witDrop() @trusted @nogc nothrow {
|
||||
if (!__handle) return; __import_drop(__handle); __handle = 0;
|
||||
}
|
||||
pragma(inline, true) Borrow witClone() const @safe @nogc nothrow { return Borrow(__handle); }
|
||||
|
||||
/++
|
||||
Serializes the text component to JSON format.
|
||||
+/
|
||||
WitString toJson() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_toJson(this.__handle, _retArea.ptr);
|
||||
auto _len0 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _ptr0 = _len0 ? cast(char*)(*(cast(void**)(_retArea.ptr + 0))) : null;
|
||||
auto _list1 = WitString(_ptr0[0.._len0]);
|
||||
auto _flush2 = _list1;
|
||||
return _flush2;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.to-json")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.to_json")
|
||||
static private extern(C) void __import_toJson(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void addChild(TextComponent child) @trusted nothrow {
|
||||
__import_addChild(this.__handle, child.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.add-child")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.add_child")
|
||||
static private extern(C) void __import_addChild(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void addText(in WitString text) @trusted nothrow {
|
||||
__import_addText(this.__handle, cast(void*)(text.ptr), text.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.add-text")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.add_text")
|
||||
static private extern(C) void __import_addText(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString getText() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_getText(this.__handle, _retArea.ptr);
|
||||
auto _len0 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _ptr0 = _len0 ? cast(char*)(*(cast(void**)(_retArea.ptr + 0))) : null;
|
||||
auto _list1 = WitString(_ptr0[0.._len0]);
|
||||
auto _flush2 = _list1;
|
||||
return _flush2;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.get-text")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.get_text")
|
||||
static private extern(C) void __import_getText(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitList!(ubyte) encode() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_encode(this.__handle, _retArea.ptr);
|
||||
auto _len0 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _ptr0 = _len0 ? cast(ubyte*)(*(cast(void**)(_retArea.ptr + 0))) : null;
|
||||
auto _list1 = WitList!(ubyte)(_ptr0[0.._len0]);
|
||||
auto _flush2 = _list1;
|
||||
return _flush2;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.encode")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.encode")
|
||||
static private extern(C) void __import_encode(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
WitString toPrettyConsole() @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_toPrettyConsole(this.__handle, _retArea.ptr);
|
||||
auto _len0 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _ptr0 = _len0 ? cast(char*)(*(cast(void**)(_retArea.ptr + 0))) : null;
|
||||
auto _list1 = WitString(_ptr0[0.._len0]);
|
||||
auto _flush2 = _list1;
|
||||
return _flush2;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.to-pretty-console")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.to_pretty_console")
|
||||
static private extern(C) void __import_toPrettyConsole(uint, void*) nothrow;
|
||||
|
||||
/++
|
||||
Style
|
||||
+/
|
||||
void colorNamed(NamedColor color) @trusted nothrow {
|
||||
__import_colorNamed(this.__handle, cast(uint)(color));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.color-named")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.color_named")
|
||||
static private extern(C) void __import_colorNamed(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void colorRgb(in RgbColor color) @trusted nothrow {
|
||||
__import_colorRgb(this.__handle, cast(uint)(color.r), cast(uint)(color.g), cast(uint)(color.b));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.color-rgb")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.color_rgb")
|
||||
static private extern(C) void __import_colorRgb(uint, uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void gradientNamed(in WitList!(NamedColor) colors) @trusted nothrow {
|
||||
wit.common.DeallocateBuffer deallocate;
|
||||
auto _listSrc1 = colors;
|
||||
auto _list1 = _listSrc1.length ? wit.common.malloc(_listSrc1.length * (1)) : null;
|
||||
assert(!_listSrc1.length || _list1);
|
||||
if (_listSrc1.length) deallocate ~= _list1;
|
||||
foreach (_elem0_idx, ref _elem0; _listSrc1) {
|
||||
auto _base0 = _list1 + _elem0_idx * (1);
|
||||
*cast(ubyte*)(_base0 + 0) = cast(ubyte)(cast(uint)(_elem0));
|
||||
|
||||
}
|
||||
__import_gradientNamed(this.__handle, _list1, colors.length);
|
||||
deallocate.purge();
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.gradient-named")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.gradient_named")
|
||||
static private extern(C) void __import_gradientNamed(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void gradient(in WitList!(RgbColor) colors) @trusted nothrow {
|
||||
__import_gradient(this.__handle, cast(void*)(colors.ptr), colors.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.gradient")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.gradient")
|
||||
static private extern(C) void __import_gradient(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void rainbow() @trusted nothrow {
|
||||
__import_rainbow(this.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.rainbow")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.rainbow")
|
||||
static private extern(C) void __import_rainbow(uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void bold(bool value) @trusted nothrow {
|
||||
__import_bold(this.__handle, cast(uint)(value));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.bold")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.bold")
|
||||
static private extern(C) void __import_bold(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void italic(bool value) @trusted nothrow {
|
||||
__import_italic(this.__handle, cast(uint)(value));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.italic")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.italic")
|
||||
static private extern(C) void __import_italic(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void underlined(bool value) @trusted nothrow {
|
||||
__import_underlined(this.__handle, cast(uint)(value));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.underlined")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.underlined")
|
||||
static private extern(C) void __import_underlined(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void strikethrough(bool value) @trusted nothrow {
|
||||
__import_strikethrough(this.__handle, cast(uint)(value));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.strikethrough")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.strikethrough")
|
||||
static private extern(C) void __import_strikethrough(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void obfuscated(bool value) @trusted nothrow {
|
||||
__import_obfuscated(this.__handle, cast(uint)(value));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.obfuscated")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.obfuscated")
|
||||
static private extern(C) void __import_obfuscated(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Text inserted into chat when shift-clicked
|
||||
+/
|
||||
void insertion(in WitString text) @trusted nothrow {
|
||||
__import_insertion(this.__handle, cast(void*)(text.ptr), text.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.insertion")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.insertion")
|
||||
static private extern(C) void __import_insertion(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void font(in WitString font) @trusted nothrow {
|
||||
__import_font(this.__handle, cast(void*)(font.ptr), font.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.font")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.font")
|
||||
static private extern(C) void __import_font(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void shadowColor(in ArgbColor color) @trusted nothrow {
|
||||
__import_shadowColor(this.__handle, cast(uint)(color.a), cast(uint)(color.r), cast(uint)(color.g), cast(uint)(color.b));
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.shadow-color")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.shadow_color")
|
||||
static private extern(C) void __import_shadowColor(uint, uint, uint, uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Click events
|
||||
+/
|
||||
void clickOpenUrl(in WitString url) @trusted nothrow {
|
||||
__import_clickOpenUrl(this.__handle, cast(void*)(url.ptr), url.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.click-open-url")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.click_open_url")
|
||||
static private extern(C) void __import_clickOpenUrl(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void clickOpenFile(in WitString path) @trusted nothrow {
|
||||
__import_clickOpenFile(this.__handle, cast(void*)(path.ptr), path.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.click-open-file")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.click_open_file")
|
||||
static private extern(C) void __import_clickOpenFile(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void clickRunCommand(in WitString command) @trusted nothrow {
|
||||
__import_clickRunCommand(this.__handle, cast(void*)(command.ptr), command.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.click-run-command")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.click_run_command")
|
||||
static private extern(C) void __import_clickRunCommand(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void clickSuggestCommand(in WitString command) @trusted nothrow {
|
||||
__import_clickSuggestCommand(this.__handle, cast(void*)(command.ptr), command.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.click-suggest-command")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.click_suggest_command")
|
||||
static private extern(C) void __import_clickSuggestCommand(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void clickChangePage(uint page) @trusted nothrow {
|
||||
__import_clickChangePage(this.__handle, page);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.click-change-page")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.click_change_page")
|
||||
static private extern(C) void __import_clickChangePage(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void clickCopyToClipboard(in WitString text) @trusted nothrow {
|
||||
__import_clickCopyToClipboard(this.__handle, cast(void*)(text.ptr), text.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.click-copy-to-clipboard")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.click_copy_to_clipboard")
|
||||
static private extern(C) void __import_clickCopyToClipboard(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
Hover events
|
||||
+/
|
||||
void hoverShowText(TextComponent text) @trusted nothrow {
|
||||
__import_hoverShowText(this.__handle, text.__handle);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.hover-show-text")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.hover_show_text")
|
||||
static private extern(C) void __import_hoverShowText(uint, uint) nothrow;
|
||||
|
||||
/++
|
||||
Item data as SNBT string
|
||||
+/
|
||||
void hoverShowItem(in WitString item) @trusted nothrow {
|
||||
__import_hoverShowItem(this.__handle, cast(void*)(item.ptr), item.length);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.hover-show-item")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.hover_show_item")
|
||||
static private extern(C) void __import_hoverShowItem(uint, void*, size_t) nothrow;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
void hoverShowEntity(in WitString entityType, in WitString id, in Option!(TextComponent) name) @trusted nothrow {
|
||||
uint _option4 = void;
|
||||
uint _option5 = void;
|
||||
if (name.isSome) {
|
||||
ref _payload3 = name.unwrap();
|
||||
_option4 = 1;
|
||||
_option5 = _payload3.__handle;
|
||||
} else {
|
||||
_option4 = 0;
|
||||
_option5 = 0;
|
||||
}
|
||||
__import_hoverShowEntity(this.__handle, cast(void*)(entityType.ptr), entityType.length, cast(void*)(id.ptr), id.length, _option4, _option5);
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/text@0.1.0", "[method]text-component.hover-show-entity")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__text@0.1.0__:method:text_component.hover_show_entity")
|
||||
static private extern(C) void __import_hoverShowEntity(uint, void*, size_t, void*, size_t, uint, uint) nothrow;
|
||||
}
|
||||
}
|
||||
38
src/wit/pumpkin/plugin/uuid/common.d
Normal file
38
src/wit/pumpkin/plugin/uuid/common.d
Normal file
@ -0,0 +1,38 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.uuid.common;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
A 128-bit UUID represented as two 64-bit integers.
|
||||
+/
|
||||
struct Uuid {
|
||||
/++
|
||||
|
||||
+/
|
||||
ulong high;
|
||||
|
||||
/++
|
||||
|
||||
+/
|
||||
ulong low;
|
||||
|
||||
void witFree() @nogc nothrow {
|
||||
}
|
||||
|
||||
void witDrop() @nogc nothrow {
|
||||
}
|
||||
|
||||
Uuid witClone() const @nogc nothrow {
|
||||
Uuid clone = void;
|
||||
clone.high = this.high.witClone;
|
||||
clone.low = this.low.witClone;
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
73
src/wit/pumpkin/plugin/uuid/imports.d
Normal file
73
src/wit/pumpkin/plugin/uuid/imports.d
Normal file
@ -0,0 +1,73 @@
|
||||
/++
|
||||
|
||||
+/
|
||||
module wit.pumpkin.plugin.uuid.imports;
|
||||
|
||||
|
||||
import wit.common;
|
||||
|
||||
public import wit.pumpkin.plugin.uuid.common;
|
||||
|
||||
|
||||
package (wit) void __wit_bindgen_component_type_force_link() pure @nogc nothrow => imported!"wit.pumpkin.plugin.plugin".__wit_bindgen_component_type_force_link();
|
||||
|
||||
/++
|
||||
Generates a new random v4 UUID.
|
||||
+/
|
||||
Uuid generate() @trusted nothrow {
|
||||
align(8) void[16] _retArea = void;
|
||||
__import_generate(_retArea.ptr);
|
||||
Uuid _record0 = {
|
||||
high: *(cast(ulong*)(_retArea.ptr + 0)),
|
||||
low: *(cast(ulong*)(_retArea.ptr + 8)),
|
||||
};
|
||||
auto _flush1 = _record0;
|
||||
return _flush1;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/uuid@0.1.0", "generate")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__uuid@0.1.0__generate")
|
||||
private extern(C) void __import_generate(void*) nothrow;
|
||||
|
||||
/++
|
||||
Parses a UUID from a string. Returns none if the string is not a valid UUID.
|
||||
+/
|
||||
Option!(Uuid) parse(in WitString s) @trusted nothrow {
|
||||
align(8) void[24] _retArea = void;
|
||||
__import_parse(cast(void*)(s.ptr), s.length, _retArea.ptr);
|
||||
Option!(Uuid) _option3 = void;
|
||||
bool _isSome3 = (cast(uint)(*(cast(ubyte*)(_retArea.ptr + 0)))) != 0;
|
||||
if (_isSome3) {
|
||||
Uuid _record2 = {
|
||||
high: *(cast(ulong*)(_retArea.ptr + 8)),
|
||||
low: *(cast(ulong*)(_retArea.ptr + 16)),
|
||||
};
|
||||
|
||||
_option3 = Option!(Uuid).makeSome(_record2);
|
||||
} else {
|
||||
_option3 = Option!(Uuid).makeNone;
|
||||
}
|
||||
auto _flush4 = _option3;
|
||||
return _flush4;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/uuid@0.1.0", "parse")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__uuid@0.1.0__parse")
|
||||
private extern(C) void __import_parse(void*, size_t, void*) nothrow;
|
||||
|
||||
/++
|
||||
Converts a UUID to its standard string representation.
|
||||
+/
|
||||
WitString toString(in Uuid id) @trusted nothrow {
|
||||
align(size_t.sizeof) void[(2*size_t.sizeof)] _retArea = void;
|
||||
__import_toString(id.high, id.low, _retArea.ptr);
|
||||
auto _len0 = *(cast(size_t*)(_retArea.ptr + size_t.sizeof));
|
||||
auto _ptr0 = _len0 ? cast(char*)(*(cast(void**)(_retArea.ptr + 0))) : null;
|
||||
auto _list1 = WitString(_ptr0[0.._len0]);
|
||||
auto _flush2 = _list1;
|
||||
return _flush2;
|
||||
}
|
||||
/// ditto
|
||||
@wasmImport!("pumpkin:plugin/uuid@0.1.0", "to-string")
|
||||
pragma(mangle, "__wit_import_pumpkin:plugin__uuid@0.1.0__to_string")
|
||||
private extern(C) void __import_toString(ulong, ulong, void*) nothrow;
|
||||
2084
src/wit/pumpkin/plugin/world/common.d
Normal file
2084
src/wit/pumpkin/plugin/world/common.d
Normal file
File diff suppressed because it is too large
Load Diff
6627
src/wit/pumpkin/plugin/world/imports.d
Normal file
6627
src/wit/pumpkin/plugin/world/imports.d
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user