230 lines
7.6 KiB
D
230 lines
7.6 KiB
D
/++
|
|
|
|
+/
|
|
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;
|
|
}
|
|
}
|