#[repr(C)]pub struct YogApi {Show 55 fields
pub abi_version: u32,
pub size: u32,
pub ctx: *mut c_void,
pub server: *const YogServer,
pub on_block_break: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogBlockBreakEvent, u8) -> bool),
pub on_chat: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogChatEvent, u8) -> bool),
pub on_player_join: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogPlayerEvent, u8) -> bool),
pub on_player_leave: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogPlayerEvent, u8) -> bool),
pub on_use_item: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogUseItemEvent, u8) -> bool),
pub on_use_block: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogUseBlockEvent, u8) -> bool),
pub on_attack_entity: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogAttackEntityEvent, u8) -> bool),
pub on_entity_damage: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogEntityDamageEvent, u8) -> bool),
pub on_entity_death: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogEntityDeathEvent, u8) -> bool),
pub on_entity_spawn: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogEntitySpawnEvent, u8) -> bool),
pub on_player_place_block: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogPlaceBlockEvent, u8) -> bool),
pub on_player_death: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogPlayerDeathEvent, u8) -> bool),
pub on_player_respawn: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogPlayerRespawnEvent, u8) -> bool),
pub on_advancement: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogAdvancementEvent, u8) -> bool),
pub on_entity_interact: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogEntityInteractEvent, u8) -> bool),
pub on_item_craft: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogCraftEvent, u8) -> bool),
pub on_explosion: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogExplosionEvent, u8) -> bool),
pub on_item_pickup: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogItemPickupEvent, u8) -> bool),
pub on_player_move: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogPlayerMoveEvent, u8) -> bool),
pub on_container_open: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogContainerOpenEvent, u8) -> bool),
pub on_container_close: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogContainerCloseEvent, u8) -> bool),
pub on_projectile_hit: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogProjectileHitEvent, u8) -> bool),
pub on_server_tick: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer)),
pub on_server_started: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer)),
pub on_server_stopping: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer)),
pub on_packet: unsafe extern "C" fn(*mut c_void, YogStr, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogPacketEvent)),
pub on_client_packet: unsafe extern "C" fn(*mut c_void, YogStr, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogPacketEvent)),
pub register_command: unsafe extern "C" fn(*mut c_void, YogStr, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogCommandEvent, *mut u8, u32, *mut u32)),
pub register_typed_command: unsafe extern "C" fn(*mut c_void, YogStr, YogStr, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogCommandEvent, *mut u8, u32, *mut u32)),
pub register_recipe_json: unsafe extern "C" fn(*mut c_void, YogStr, YogStr, YogStr),
pub register_item: unsafe extern "C" fn(*mut c_void, *const YogItemDef),
pub register_block: unsafe extern "C" fn(*mut c_void, *const YogBlockDef),
pub schedule_once: unsafe extern "C" fn(*mut c_void, u64, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer)),
pub schedule_repeating: unsafe extern "C" fn(*mut c_void, u64, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer)),
pub on_client_tick: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void)),
pub on_hud_render: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogGfxApi)),
pub on_key_press: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogKeyPressEvent) -> bool),
pub on_screen_open: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, YogStr) -> bool),
pub on_screen_close: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, YogStr) -> bool),
pub on_world_render: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogGfxApi)),
pub register_startup_grant: unsafe extern "C" fn(*mut c_void, *const YogStartupGrantDef),
pub register_book: unsafe extern "C" fn(*mut c_void, YogStr, YogStr),
pub register_ui: unsafe extern "C" fn(*mut c_void, YogStr, YogStr, *mut c_void, unsafe extern "C" fn(*mut c_void, YogStr, YogStr)),
pub on_ui_render: unsafe extern "C" fn(*mut c_void, YogStr, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogGfxApi)),
pub register_menu_entry: unsafe extern "C" fn(*mut c_void, YogStr, YogStr),
pub mods_list: unsafe extern "C" fn(*mut c_void) -> YogOwnedStr,
pub free_str: unsafe extern "C" fn(*mut u8, u32),
pub ui_open: unsafe extern "C" fn(*mut c_void, YogStr, bool, bool),
pub register_inventory: unsafe extern "C" fn(*mut c_void, *const YogInventoryDef),
pub interop_export: unsafe extern "C" fn(*mut c_void, YogStr, YogStr, *const c_void),
pub interop_import: unsafe extern "C" fn(*mut c_void, YogStr, YogStr) -> *const c_void,
}Expand description
Stable C ABI — re-exported so mods don’t need a direct yog-abi dependency.
Passed to yog_mod_register. Call the function pointers here to register
handlers, commands, content, and schedulers.
When mods compiled against ABI N load on a runtime with ABI M > N:
fields beyond size are not present in the mod’s view — check size before
accessing fields added in later minor versions.
Fields§
§abi_version: u32§size: u32sizeof(YogApi) at the runtime’s build time.
ctx: *mut c_voidOpaque pointer to runtime handler storage.
server: *const YogServerStable server action table — pass to handlers.
on_block_break: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogBlockBreakEvent, u8) -> bool)§on_chat: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogChatEvent, u8) -> bool)§on_player_join: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogPlayerEvent, u8) -> bool)§on_player_leave: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogPlayerEvent, u8) -> bool)§on_use_item: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogUseItemEvent, u8) -> bool)§on_use_block: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogUseBlockEvent, u8) -> bool)§on_attack_entity: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogAttackEntityEvent, u8) -> bool)§on_entity_damage: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogEntityDamageEvent, u8) -> bool)§on_entity_death: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogEntityDeathEvent, u8) -> bool)§on_entity_spawn: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogEntitySpawnEvent, u8) -> bool)§on_player_place_block: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogPlaceBlockEvent, u8) -> bool)§on_player_death: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogPlayerDeathEvent, u8) -> bool)§on_player_respawn: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogPlayerRespawnEvent, u8) -> bool)§on_advancement: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogAdvancementEvent, u8) -> bool)§on_entity_interact: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogEntityInteractEvent, u8) -> bool)§on_item_craft: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogCraftEvent, u8) -> bool)§on_explosion: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogExplosionEvent, u8) -> bool)§on_item_pickup: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogItemPickupEvent, u8) -> bool)§on_player_move: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogPlayerMoveEvent, u8) -> bool)§on_container_open: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogContainerOpenEvent, u8) -> bool)§on_container_close: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogContainerCloseEvent, u8) -> bool)§on_projectile_hit: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogProjectileHitEvent, u8) -> bool)§on_server_tick: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer))§on_server_started: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer))§on_server_stopping: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer))§on_packet: unsafe extern "C" fn(*mut c_void, YogStr, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogPacketEvent))§on_client_packet: unsafe extern "C" fn(*mut c_void, YogStr, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogPacketEvent))§register_command: unsafe extern "C" fn(*mut c_void, YogStr, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogCommandEvent, *mut u8, u32, *mut u32))§register_typed_command: unsafe extern "C" fn(*mut c_void, YogStr, YogStr, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer, *const YogCommandEvent, *mut u8, u32, *mut u32))§register_recipe_json: unsafe extern "C" fn(*mut c_void, YogStr, YogStr, YogStr)Register a recipe by supplying Minecraft JSON (data/ format).
namespace + name form the file path: data/{ns}/recipes/{name}.json.
register_item: unsafe extern "C" fn(*mut c_void, *const YogItemDef)§register_block: unsafe extern "C" fn(*mut c_void, *const YogBlockDef)§schedule_once: unsafe extern "C" fn(*mut c_void, u64, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer))§schedule_repeating: unsafe extern "C" fn(*mut c_void, u64, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogServer))§on_client_tick: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void))§on_hud_render: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogGfxApi))§on_key_press: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogKeyPressEvent) -> bool)§on_screen_open: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, YogStr) -> bool)§on_screen_close: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, YogStr) -> bool)§on_world_render: unsafe extern "C" fn(*mut c_void, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogGfxApi))Register a handler that fires after world geometry is rendered.
gfx.view_proj and gfx.camera_pos are filled; use them to project
custom 3D geometry into clip space.
register_startup_grant: unsafe extern "C" fn(*mut c_void, *const YogStartupGrantDef)§register_book: unsafe extern "C" fn(*mut c_void, YogStr, YogStr)§register_ui: unsafe extern "C" fn(*mut c_void, YogStr, YogStr, *mut c_void, unsafe extern "C" fn(*mut c_void, YogStr, YogStr))Register a UI tree. ui_id is the unique identifier (e.g. “mymod:menu”).
layout_json is the serialized layout tree.
handler is called when an interactive element is clicked/keyed.
on_ui_render: unsafe extern "C" fn(*mut c_void, YogStr, *mut c_void, unsafe extern "C" fn(*mut c_void, *const YogGfxApi))Register a render callback that fires during YogUIScreen.render() for a
specific UI id — i.e. AFTER the screen darkening, unlike on_hud_render.
Reuses YogHudRenderFn (fn(ud, gfx)); gfx.screen_w/h are set.
Clicks are forwarded as "click:X:Y" events to the register_ui handler
so mods can do their own hit-testing with their stored layout.
Register a button/link that the host renders on vanilla screens
(TitleScreen on Fabric, ModListScreen on Forge/NeoForge).
label is the human-readable button text (e.g. “Yog Mods”).
ui_id is the Yog UI to open when clicked (e.g. “yog:modlist”).
mods_list: unsafe extern "C" fn(*mut c_void) -> YogOwnedStrAll installed mods as TSV, one per line:
source \t id \t name \t version \t authors \t description
where source is yog (a .yog mod) or platform (a loader mod, e.g.
a Fabric/Forge jar). Tabs and newlines inside fields become spaces.
Callable at any time after registration (also client-side).
free_str: unsafe extern "C" fn(*mut u8, u32)Free a YogOwnedStr returned by an api-table call (same allocator as
YogServer::free_str).
ui_open: unsafe extern "C" fn(*mut c_void, YogStr, bool, bool)Open the Yog UI registered as ui_id on the client (schedules onto the
render thread). Client-side only; a no-op on dedicated servers.
modal blocks game input; pause pauses a singleplayer game.
register_inventory: unsafe extern "C" fn(*mut c_void, *const YogInventoryDef)Register a real Container/Menu inventory screen — see yog_inventory.
interop_export: unsafe extern "C" fn(*mut c_void, YogStr, YogStr, *const c_void)Export a function pointer under symbol for the calling mod (mod_id).
Other mods can import it via interop_import.
interop_import: unsafe extern "C" fn(*mut c_void, YogStr, YogStr) -> *const c_voidImport a function pointer exported by mod_id under symbol.
Returns null if the symbol is not (yet) registered.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for YogApi
impl RefUnwindSafe for YogApi
impl Unpin for YogApi
impl UnsafeUnpin for YogApi
impl UnwindSafe for YogApi
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.