### Registering a Dynamic Registry Setup Callback Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/event/registry/DynamicRegistrySetupCallback.html This example demonstrates how to register a callback to the DynamicRegistrySetupCallback.EVENT. The callback is triggered before a dynamic registry is loaded, and it receives a DynamicRegistryView to interact with. ```APIDOC ## Registering a Callback ### Description This code snippet shows how to register a listener to the `DynamicRegistrySetupCallback.EVENT`. This event fires before dynamic registries are loaded, providing an opportunity to set up listeners for registry entry additions. ### Method `DynamicRegistrySetupCallback.EVENT.register(callback)` ### Parameters * `callback` (DynamicRegistrySetupCallback) - The callback function to be executed when the event is triggered. ### Example ```java DynamicRegistrySetupCallback.EVENT.register(registryView -> { registryView.registerEntryAdded(RegistryKeys.BIOME, (rawId, id, object) -> { // Your custom logic here }); }); ``` ### See Also * `DynamicRegistryView` * `ServerDynamicRegistryType` ``` -------------------------------- ### Example Client-Side Command Registration Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/command/v2/ClientCommandManager.html An example demonstrating how to register a client-side command using ClientCommandRegistrationCallback. ```APIDOC ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> { dispatcher.register( ClientCommandManager.literal("hello").executes(context -> { context.getSource().sendFeedback(Text.literal("Hello, world!")); return 0; }) ); }); ``` -------------------------------- ### Registering a Start Tick Event Listener Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/event/lifecycle/v1/ClientTickEvents.StartTick.html This example demonstrates how to register a listener for the client's start tick event using a lambda expression. ```APIDOC ## Registering a Start Tick Event Listener ### Description This code snippet shows how to register a callback function that will be executed at the beginning of each client tick. ### Method Signature ```java ClientTickEvents.StartTick.register(callback) ``` ### Parameters * **callback** (`ClientTickEvents.StartTick`) - Required - The callback function to execute on start tick. ### Example Usage ```java ClientTickEvents.StartTick.register(client -> { // Code to execute at the start of each client tick System.out.println("Client tick started!"); }); ``` ``` -------------------------------- ### Server Login Start Event Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Callback for the start of a server login, including query start. ```APIDOC ## onLoginStart(ServerLoginNetworkHandler, MinecraftServer, LoginPacketSender, ServerLoginNetworking.LoginSynchronizer) ### Description Callback for the start of a server login, including query start. ### Method Signature `onLoginStart(ServerLoginNetworkHandler, MinecraftServer, LoginPacketSender, ServerLoginNetworking.LoginSynchronizer)` ### Interface `net.fabricmc.fabric.api.networking.v1.ServerLoginConnectionEvents.QueryStart` ``` -------------------------------- ### Example Usage Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/transfer/v1/fluid/base/EmptyItemFluidStorage.html An example demonstrating how to register an EmptyItemFluidStorage for a bucket using Fabric API's combinedItemApiProvider. ```APIDOC ```java FluidStorage.combinedItemApiProvider(Items.BUCKET) .register(context -> { return new EmptyItemFluidStorage( context, Items.WATER_BUCKET, Fluids.WATER, FluidConstants.BUCKET ); }); ``` ``` -------------------------------- ### ServerLifecycleEvents.ServerStarting Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Callback for when the server is starting. ```APIDOC ## onServerStarting ### Description Callback for when the server is starting. ### Method Signature onServerStarting(MinecraftServer) ``` -------------------------------- ### Client Login Start Event Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Callback for the start of a client login. ```APIDOC ## onLoginStart(ClientLoginNetworkHandler, MinecraftClient) ### Description Callback for the start of a client login. ### Method Signature `onLoginStart(ClientLoginNetworkHandler, MinecraftClient)` ### Interface `net.fabricmc.fabric.api.client.networking.v1.ClientLoginConnectionEvents.Init` ``` -------------------------------- ### Registering a Server World Tick Callback Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/event/lifecycle/v1/ServerTickEvents.StartWorldTick.html This example demonstrates how to register a listener for the start of a server world tick using a lambda expression. ```APIDOC ## Interface: ServerTickEvents.StartWorldTick This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference. ### Method * `void onStartTick(ServerWorld world)` * Called at the beginning of each server world tick. ### Example Usage ```java ServerTickEvents.StartWorldTick.EVENT.register(world -> { // Your code here to execute at the start of each world tick System.out.println("World tick started for world: " + world.getName()); }); ``` ### Parameters * `world` (ServerWorld) - The server world instance that is about to tick. ``` -------------------------------- ### Client Started Event Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/event/lifecycle/v1/ClientLifecycleEvents.html This event is invoked when the Minecraft client has successfully started and is about to begin its first tick. It's a suitable point for initialization tasks that require the client environment to be ready, such as rendering setup or resource loading. This event fires while the splash screen is still visible. ```APIDOC ## CLIENT_STARTED Event ### Description Called when Minecraft has started and it's client about to tick for the first time. This occurs while the splash screen is displayed. ### Event `static final Event CLIENT_STARTED` ``` -------------------------------- ### Client Login Query Start Event Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Callback for when the client starts a login query. ```APIDOC ## onLoginQueryStart(ClientLoginNetworkHandler, MinecraftClient) ### Description Callback for when the client starts a login query. ### Method Signature `onLoginQueryStart(ClientLoginNetworkHandler, MinecraftClient)` ### Interface `net.fabricmc.fabric.api.client.networking.v1.ClientLoginConnectionEvents.QueryStart` ``` -------------------------------- ### ClientConfigurationConnectionEvents.Start Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Callback for when the client configuration connection starts. ```APIDOC ## onConfigurationStart ### Description Callback for when the client configuration connection starts. ### Method Signature `onConfigurationStart(ClientConfigurationNetworkHandler handler, MinecraftClient client)` ``` -------------------------------- ### Obtaining a FakePlayer Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/entity/FakePlayer.html Demonstrates the recommended ways to get an instance of a FakePlayer. It's advised to use the static get methods provided by the FakePlayer class. ```APIDOC ## Obtaining a FakePlayer The easiest way to obtain a fake player is with `get(ServerWorld)` or `get(ServerWorld, GameProfile)`. ### Example Usage ```java // Obtain a fake player with default settings FakePlayer fakePlayer = FakePlayer.get(serverWorld); // Obtain a fake player with a custom GameProfile GameProfile customProfile = new GameProfile(UUID.randomUUID(), "CustomFakePlayer"); FakePlayer customFakePlayer = FakePlayer.get(serverWorld, customProfile); ``` ``` -------------------------------- ### ClientLoginConnectionEvents.QueryStart Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4+1.21.8/index-all.html Callback for when the client login query starts. ```APIDOC ## onLoginQueryStart ClientLoginNetworkHandler MinecraftClient ### Description Callback for when the client login query starts. ### Method `onLoginQueryStart` ### Parameters - **ClientLoginNetworkHandler** (ClientLoginNetworkHandler) - Description not provided - **MinecraftClient** (MinecraftClient) - Description not provided ``` -------------------------------- ### ServerLoginConnectionEvents.QueryStart Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4+1.21.8/index-all.html Callback for when the server login query starts. ```APIDOC ## onLoginStart ServerLoginNetworkHandler MinecraftServer LoginPacketSender ServerLoginNetworking.LoginSynchronizer ### Description Callback for when the server login query starts. ### Method `onLoginStart` ### Parameters - **ServerLoginNetworkHandler** (ServerLoginNetworkHandler) - Description not provided - **MinecraftServer** (MinecraftServer) - Description not provided - **LoginPacketSender** (LoginPacketSender) - Description not provided - **ServerLoginNetworking.LoginSynchronizer** (ServerLoginNetworking.LoginSynchronizer) - Description not provided ``` -------------------------------- ### Server Started Event Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/event/lifecycle/v1/ServerLifecycleEvents.html Called when a Minecraft server has started and is about to tick for the first time. At this stage, all worlds are live. ```APIDOC ## SERVER_STARTED ### Description Called when a Minecraft server has started and is about to tick for the first time. At this stage, all worlds are live. ### Event Type Event ``` -------------------------------- ### ServerLifecycleEvents.ServerStarted Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Callback for when the server has started. ```APIDOC ## onServerStarted ### Description Callback for when the server has started. ### Method Signature onServerStarted(MinecraftServer) ``` -------------------------------- ### Server Starting Event Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/event/lifecycle/v1/ServerLifecycleEvents.html Called when a Minecraft server is starting. This event fires before the player manager and any worlds are loaded. ```APIDOC ## SERVER_STARTING ### Description Called when a Minecraft server is starting. This occurs before the `player manager` and any worlds are loaded. ### Event Type Event ``` -------------------------------- ### Usage Example: Querying FluidContainer API Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/lookup/v1/block/BlockApiLookup.html This example demonstrates how to define a custom API interface (FluidContainer) and then use a static BlockApiLookup instance (MyApi.FLUID_CONTAINER) to find instances of that API from a given world position and context. ```APIDOC ## Usage Example: Querying FluidContainer API Let us pretend we have the following interface that we would like to attach to some blocks depending on the direction. ```java public interface FluidContainer { boolean containsFluids(); // return true if not empty } ``` Let us first create a static `BlockApiLookup` instance that will manage the registration and the query. ```java public final class MyApi { public static final BlockApiLookup FLUID_CONTAINER = BlockApiLookup.get(Identifier.of("mymod", "fluid_container"), FluidContainer.class, Direction.class); } ``` Using that, we can query instances of `FluidContainer`: ```java FluidContainer container = MyApi.FLUID_CONTAINER.find(world, pos, direction); if (container != null) { // Do something with the container if (container.containsFluids()) { System.out.println("It contains fluids!"); } } ``` ``` -------------------------------- ### ClientLifecycleEvents.ClientStarted Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Callback for when the client has started. ```APIDOC ## onClientStarted ### Description Callback for when the client has started. ### Method Signature `onClientStarted(MinecraftClient client)` ``` -------------------------------- ### WorldRenderEvents.AfterSetup Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Called after the world rendering setup is complete. ```APIDOC ## afterSetup WorldRenderContext ### Description Called after the world rendering setup is complete. ### Method Method in interface net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents.AfterSetup ### Parameters - **context** (WorldRenderContext) - Description ``` -------------------------------- ### WorldRenderEvents.AfterSetup Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4+1.21.8/index-all.html Called after the world rendering setup is complete. ```APIDOC ## afterSetup ### Description Called after the world rendering setup is complete. ### Method Method in interface net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents.AfterSetup ### Parameters - **context** (WorldRenderContext) - Description ``` -------------------------------- ### ClientLoginConnectionEvents.QUERY_START Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html An event for when the client has started receiving login queries. ```APIDOC ## Static variable QUERY_START An event for when the client has started receiving login queries. Static variable in class `net.fabricmc.fabric.api.client.networking.v1.ClientLoginConnectionEvents`. ``` -------------------------------- ### onConfigurationStart Method Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/networking/v1/ClientConfigurationConnectionEvents.Start.html This method is called when the client configuration connection starts. It receives the network handler and the Minecraft client instance. ```APIDOC ## Method: onConfigurationStart ### Description Callback invoked when the client configuration connection starts. ### Signature `void onConfigurationStart(ClientConfigurationNetworkHandler handler, MinecraftClient client)` ### Parameters * **handler** (`ClientConfigurationNetworkHandler`) - The network handler for the client configuration connection. * **client** (`MinecraftClient`) - The Minecraft client instance. ### Usage This is a functional interface, so it can be implemented using a lambda expression or a method reference. **Example (Lambda Expression):** ```java ClientConfigurationConnectionEvents.Start.onConfigurationStart(handler -> { // Your code here }); ``` **Example (Method Reference):** ```java // Assuming 'myHandler' is a method that accepts ClientConfigurationNetworkHandler and MinecraftClient ClientConfigurationConnectionEvents.Start.onConfigurationStart(this::myHandler); ``` ``` -------------------------------- ### createServer (with properties) Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/gametest/v1/world/TestWorldBuilder.html Creates and starts a dedicated server with the configured world settings and custom server properties. The server requires EULA acceptance to run. ```APIDOC ## `createServer` Method (with properties) TestDedicatedServerContext createServer(Properties serverProperties) Creates and starts a dedicated server with the configured world settings and some custom server properties. The dedicated server will only run if the EULA has been accepted in `eula.txt`. See `TestDedicatedServerContext` for details. ### Parameters - `serverProperties` (Properties) - The custom server properties to be written to the `server.properties` file. ### Returns - The dedicated server context of the server that was created. ``` -------------------------------- ### createServer (default) Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/gametest/v1/world/TestWorldBuilder.html Creates and starts a dedicated server with the configured world settings. The server will only run if the EULA has been accepted. ```APIDOC ## `createServer` Method (default) default TestDedicatedServerContext createServer() Creates and starts a dedicated server with the configured world settings. The dedicated server will only run if the EULA has been accepted in `eula.txt`. See `TestDedicatedServerContext` for details. ### Returns - The dedicated server context of the server that was created ``` -------------------------------- ### WorldRenderEvents.AfterSetup Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/rendering/v1/package-tree.html Event triggered after the rendering setup is complete. ```APIDOC ## Interface: WorldRenderEvents.AfterSetup ### Description Event that is called after the initial rendering setup for the world has been completed. ### Methods * `onAfterSetup(WorldRenderContext context)`: Called after rendering setup. Useful for tasks that depend on the rendering pipeline being ready. ``` -------------------------------- ### onStart Method Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/rendering/v1/WorldRenderEvents.Start.html This method is called at the start of the world rendering process. It receives a WorldRenderContext object containing information about the current rendering state. ```APIDOC ## Method: onStart ### Description Called at the beginning of the world rendering process. ### Signature `void onStart(WorldRenderContext context)` ### Parameters * `context` (WorldRenderContext) - The context object for world rendering. ``` -------------------------------- ### onLoginQueryStart Method Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/networking/v1/ClientLoginConnectionEvents.QueryStart.html This method is called when the client login query begins. It receives the network handler and the Minecraft client instance. ```APIDOC ## Method: onLoginQueryStart ### Description Callback invoked when a client login query starts. ### Signature `void onLoginQueryStart(ClientLoginNetworkHandler handler, MinecraftClient client)` ### Parameters * **handler** (`ClientLoginNetworkHandler`) - The network handler for the client login connection. * **client** (`MinecraftClient`) - The Minecraft client instance. ### Functional Interface This is a functional interface, suitable for lambda expressions or method references. ``` -------------------------------- ### Get Recipe Remainder with Damage Increment Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/item/v1/FabricItem.html Returns a leftover item stack after the original stack is consumed in a recipe. This example shows how to return a more damaged version of the item if it's not at max damage. ```java if (stack.getDamage() < stack.getMaxDamage() - 1) { ItemStack moreDamaged = stack.copy(); moreDamaged.setDamage(stack.getDamage() + 1); return moreDamaged; } return ItemStack.EMPTY; ``` -------------------------------- ### onLoginStart Method Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/networking/v1/ServerLoginConnectionEvents.QueryStart.html This method is called when a client starts a query during the login process. It provides handlers for network communication, the server instance, packet sending, and synchronization. ```APIDOC ## Method: onLoginStart ### Description Called when a client initiates a query during the login process. ### Signature `void onLoginStart(ServerLoginNetworkHandler handler, MinecraftServer server, LoginPacketSender sender, ServerLoginNetworking.LoginSynchronizer synchronizer)` ### Parameters * **handler** (ServerLoginNetworkHandler) - The network handler for the login connection. * **server** (MinecraftServer) - The Minecraft server instance. * **sender** (LoginPacketSender) - An object used to send login packets. * **synchronizer** (ServerLoginNetworking.LoginSynchronizer) - An object to synchronize login states. ``` -------------------------------- ### Get Attached Data or Get from Supplier Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/attachment/v1/AttachmentTarget.html Retrieves data associated with an AttachmentType, or gets it from a provided Supplier if it doesn't exist. ```java default A getAttachedOrGet(AttachmentType type, Supplier defaultValue) ``` -------------------------------- ### TestWorldBuilder Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4+1.21.8/index-all.html Methods for creating and starting a dedicated server for testing. ```APIDOC ## createServer() ### Description Creates and starts a dedicated server with the configured world settings. ### Method Method in interface net.fabricmc.fabric.api.client.gametest.v1.world.TestWorldBuilder ## createServer(Properties) ### Description Creates and starts a dedicated server with the configured world settings and some custom server properties. ### Method Method in interface net.fabricmc.fabric.api.client.gametest.v1.world.TestWorldBuilder ### Parameters - **properties** (Properties) - Description not provided ``` -------------------------------- ### onServerStarting Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/event/lifecycle/v1/ServerLifecycleEvents.ServerStarting.html This method is called when the server is starting. It receives the MinecraftServer instance as an argument. ```APIDOC ## Method: onServerStarting ### Description Called when the server is starting. ### Signature `void onServerStarting(MinecraftServer server)` ### Parameters * **server** (MinecraftServer) - The server instance that is starting. ``` -------------------------------- ### Transaction Example Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/transfer/v1/transaction/Transaction.html An example demonstrating the usage of nested transactions with try-with-resources blocks. ```APIDOC ```java try (Transaction outerTransaction = Transaction.openOuter()) { // (A) some transaction operations try (Transaction nestedTransaction = outerTransaction.openNested()) { // (B) more operations nestedTransaction.commit(); // Validate the changes that happened in this transaction. // This is a nested transaction, so changes will only be applied if the outer // transaction is committed too. } // (C) even more operations outerTransaction.commit(); // This is an outer transaction: changes (A), (B) and (C) are applied. } // If we hadn't committed the outerTransaction, all changes (A), (B) and (C) would have been reverted. ``` ``` -------------------------------- ### Creating a Simple Registry Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/event/registry/FabricRegistryBuilder.html This example demonstrates how to create a simple registry for String objects with a specific registry key and add a SYNCED attribute. ```APIDOC ## createSimple(RegistryKey> registryKey) ### Description Creates a new `FabricRegistryBuilder` using a `SimpleRegistry`. The registry has the `RegistryAttribute.MODDED` attribute by default. ### Method Signature `static FabricRegistryBuilder> createSimple(RegistryKey> registryKey)` ### Example Usage ```java RegistryKey> registryKey = RegistryKey.ofRegistry(Identifier.of("modid", "registry_name")); Registry registry = FabricRegistryBuilder.createSimple(registryKey) .attribute(RegistryAttribute.SYNCED) .buildAndRegister(); ``` ``` -------------------------------- ### Example Usage Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/screenhandler/v1/ExtendedScreenHandlerType.html Demonstrates how to define custom data, create and register an ExtendedScreenHandlerType, and open it. ```APIDOC ## Example ```java // Data class public record OvenData(String label) { public static final PacketCodec PACKET_CODEC = PacketCodec.tuple( PacketCodecs.STRING, OvenData::label, OvenData::new ); } // Creating and registering the type public static final ExtendedScreenHandlerType OVEN = new ExtendedScreenHandlerType((syncId, inventory, data) -> new OvenScreenHandler(syncId, data), OvenData.PACKET_CODEC); Registry.register(Registry.SCREEN_HANDLER, Identifier.of("my_mod", "oven"), OVEN); // Note: remember to also register the screen using vanilla's HandledScreens! // Screen handler class public class OvenScreenHandler extends ScreenHandler { public OvenScreenHandler(int syncId, OvenData data) { super(MyScreenHandlers.OVEN, syncId); // Use data.label() here } } // Opening the extended screen handler // This part would typically be in a server-side context // var factory = new ExtendedScreenHandlerFactory() { ... }; // player.openHandlerScreen(factory); // only works on ServerPlayerEntity instances ``` ``` -------------------------------- ### Getting the Display Name of a Fluid Variant Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/transfer/v1/fluid/FluidVariantAttributes.html Gets the appropriate display name for a given fluid variant. ```APIDOC ## getName ### Description Return the name that should be used for the passed fluid variant. ### Method `public static Text getName(FluidVariant variant)` ### Parameters * `variant` - The `FluidVariant` to get the name for. ``` -------------------------------- ### Get Received Channels (ServerPlayerEntity) Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/networking/v1/ServerPlayNetworking.html Gets all channel identifiers that the server can receive packets on for a given player. ```APIDOC ## getReceived ### Description Gets all the channel names that the server can receive packets on. ### Method Signature ```java public static Set getReceived(ServerPlayerEntity player) ``` ### Parameters * `player` (ServerPlayerEntity) - the player ### Returns * `Set` - All the channel names that the server can receive packets on ``` -------------------------------- ### Building and Registering the Registry Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/event/registry/FabricRegistryBuilder.html Explains how to finalize the registry creation and register it with the game. ```APIDOC ## buildAndRegister() ### Description Applies the configured attributes to the registry and registers it. ### Method Signature `R buildAndRegister()` ### Example Usage ```java RegistryKey> registryKey = RegistryKey.ofRegistry(Identifier.of("modid", "my_registry")); Registry registry = FabricRegistryBuilder.createSimple(registryKey) .attribute(RegistryAttribute.SYNCED) .buildAndRegister(); ``` ``` -------------------------------- ### Get Received Channels (ServerPlayNetworkHandler) Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/networking/v1/ServerPlayNetworking.html Gets all channel identifiers that the server can receive packets on for a given network handler. ```APIDOC ## getReceived ### Description Gets all the channel names that the server can receive packets on. ### Method Signature ```java public static Set getReceived(ServerPlayNetworkHandler handler) ``` ### Parameters * `handler` (ServerPlayNetworkHandler) - the network handler ### Returns * `Set` - All the channel names that the server can receive packets on ``` -------------------------------- ### EntityApiLookup Usage Example Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/lookup/v1/entity/EntityApiLookup.html Demonstrates how to create, query, and register APIs using EntityApiLookup. ```APIDOC ## Usage Example Let's pretend that we have the following interface that we want to attach to entities. ```java public interface Leveled { int getLevel(); } ``` We need to create the EntityApiLookup. We don't need any context so we use `Void`. ```java public class MyApi { public static final EntityApiLookup LEVELED_ENTITY = EntityApiLookup.get(Identifier.of("mymod", "leveled_entity"), Leveled.class, Void.class); } ``` Now we can query instances of `Leveled`. ```java Leveled leveled = MyApi.LEVELED_ENTITY.find(entity, null); if (leveled != null) { // Do something with the API. System.out.println("Entity " + entity.getEntityName() + " is level " + leveled.getLevel()); } ``` For query to return useful result, we must expose the API. ```java // If the entity directly implements the interface, registerSelf can be used. public class LeveledPigEntity extends PigEntity implements Leveled { ... } MyApi.LEVELED_ENTITY.registerSelf(LEVELED_PIG_ENTITY_TYPE); // Otherwise, registerForType can be used. MyApi.LEVELED_ENTITY.registerForType((zombieEntity, ignored) -> { // Return a Leveled instance for your entity here, or null if there's none. // The context is Void in this case, so it can be ignored. }, EntityType.ZOMBIE); // Generic fallback, to interface with anything, for example if we want to all other entity level defaults to 1. MyApi.LEVELED_ENTITY.registerFallback((entity, ignored) -> { // Return something if available, or null otherwise. }); ``` ``` -------------------------------- ### afterSetup Method Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/rendering/v1/WorldRenderEvents.AfterSetup.html This method is called after the world rendering setup is complete. It is part of the WorldRenderEvents.AfterSetup functional interface. ```APIDOC ## afterSetup ### Description This method is invoked after the world rendering setup has been completed. It is intended for event listeners that need to perform actions at this specific stage of the rendering pipeline. ### Method Signature `void afterSetup(WorldRenderContext context)` ### Parameters * **context** (WorldRenderContext) - The context object providing information about the current world rendering state. ``` -------------------------------- ### Getting a FluidRenderHandler Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/render/fluid/v1/FluidRenderHandlerRegistry.html Retrieve the registered FluidRenderHandler for a given fluid. This can be used to get the default handler or an overridden one. ```APIDOC ## get(Fluid fluid) ### Description Gets a `FluidRenderHandler` for a given Fluid. This method supports both vanilla and Fabric fluids and returns the default handler if no override is present. ### Parameters - **fluid** (Fluid) - The Fluid for which to get the handler. ### Returns - `FluidRenderHandler` - The registered handler for the fluid, or null if none is found. ``` ```APIDOC ## getOverride(Fluid fluid) ### Description Gets a `FluidRenderHandler` for a given Fluid, specifically returning an overridden handler if one exists. If no custom handler is registered, this method will return null. ### Parameters - **fluid** (Fluid) - The Fluid for which to get the override handler. ### Returns - `FluidRenderHandler` - The registered override handler for the fluid, or null if none is found. ``` -------------------------------- ### Usage Example Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/lookup/v1/item/ItemApiLookup.html Demonstrates how to create and use an ItemApiLookup instance to find API implementations for item stacks. ```APIDOC ## Usage Example ### Creating an ItemApiLookup Instance ```java public final class MyApi { public static final ItemApiLookup FLUID_CONTAINER_ITEM = ItemApiLookup.get(Identifier.of("mymod", "fluid_container"), FluidContainer.class, Void.class); } ``` ### Finding an API Instance ```java FluidContainer container = MyApi.FLUID_CONTAINER_ITEM.find(itemStack, null); // Void is always null if (container != null) { // Do something with the container if (container.containsFluids()) { System.out.println("It contains fluids!"); } } ``` ``` -------------------------------- ### Get Sendable Channels (ServerPlayerEntity) Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/networking/v1/ServerPlayNetworking.html Gets all channel identifiers that a connected client has declared the ability to receive packets on, for a given player. ```APIDOC ## getSendable ### Description Gets all channel names that the connected client declared the ability to receive a packets on. ### Method Signature ```java public static Set getSendable(ServerPlayerEntity player) ``` ### Parameters * `player` (ServerPlayerEntity) - the player ### Returns * `Set` - All the channel names the connected client declared the ability to receive a packets on ``` -------------------------------- ### Get Sendable Channels (ServerPlayNetworkHandler) Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/networking/v1/ServerPlayNetworking.html Gets all channel identifiers that a connected client has declared the ability to receive packets on, for a given network handler. ```APIDOC ## getSendable ### Description Gets all channel names that a connected client declared the ability to receive a packets on. ### Method Signature ```java public static Set getSendable(ServerPlayNetworkHandler handler) ``` ### Parameters * `handler` (ServerPlayNetworkHandler) - the network handler ### Returns * `Set` - All the channel names the connected client declared the ability to receive a packets on ``` -------------------------------- ### SimpleResourceReloadListener.apply Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Synchronously apply loaded data to the game state. ```APIDOC ## SimpleResourceReloadListener.apply ### Description Synchronously apply loaded data to the game state. ### Method `apply(T, ResourceManager, Executor)` ### Parameters - **data** (T) - The loaded data. - **resourceManager** (ResourceManager) - The resource manager. - **executor** (Executor) - The executor for asynchronous operations. ``` -------------------------------- ### Get Active Command Dispatcher Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/command/v2/ClientCommandManager.html Gets the active command dispatcher that handles client command registration and execution. This may be null when not connected to a server. ```java ClientCommandManager.getActiveDispatcher() ``` -------------------------------- ### SimpleResourceReloadListener.apply Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4+1.21.8/index-all.html Synchronously apply loaded data to the game state. ```APIDOC ## SimpleResourceReloadListener.apply(T, ResourceManager, Executor) ### Description Synchronously apply loaded data to the game state. ### Method `apply(T, ResourceManager, Executor)` ### Parameters - **T** (type) - Description of the T parameter - **ResourceManager** (type) - Description of the ResourceManager parameter - **Executor** (type) - Description of the Executor parameter ``` -------------------------------- ### LootTableEvents.MODIFY Example Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/loot/v3/LootTableEvents.html Example of how to register a listener to the MODIFY event to add items to a specific loot table, such as adding diamonds to the cobblestone loot table. ```APIDOC ## LootTableEvents.MODIFY ### Description This event can be used to modify loot tables. The main use case is to add items to vanilla or mod loot tables (e.g. modded seeds to grass). You can also modify loot tables that are created by `REPLACE`. They have the loot table source `LootTableSource.REPLACED`. ### Method Signature `LootTableEvents.MODIFY.register((LootTableKey key, LootTable.Builder tableBuilder, LootTableSource source, RegistryWrapper.WrapperLookup registries) -> void)` ### Example: adding diamonds to the cobblestone loot table We'll add a new diamond loot pool to the cobblestone loot table that will be dropped alongside the original cobblestone loot pool. If you want only one of the items to drop, you can use `FabricLootTableBuilder.modifyPools(java.util.function.Consumer)` to add the new item to the original loot pool instead. ```java LootTableEvents.MODIFY.register((key, tableBuilder, source, registries) -> { // If the loot table is for the cobblestone block and it is not overridden by a user: if (Blocks.COBBLESTONE.getLootTableKey() == key && source.isBuiltin()) { // Create a new loot pool that will hold the diamonds. LootPool.Builder pool = LootPool.builder() // Add diamonds... .with(ItemEntry.builder(Items.DIAMOND)) // ...only if the block would survive a potential explosion. .conditionally(SurvivesExplosionLootCondition.builder()); // Add the loot pool to the loot table tableBuilder.pool(pool); } }); ``` ``` -------------------------------- ### ClientConfigurationConnectionEvents.Init Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Callback for when the client configuration connection is initialized. ```APIDOC ## onConfigurationInit ### Description Callback for when the client configuration connection is initialized. ### Method Signature `onConfigurationInit(ClientConfigurationNetworkHandler handler, MinecraftClient client)` ``` -------------------------------- ### Example of Registering Default Attributes Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/object/builder/v1/entity/FabricDefaultAttributeRegistry.html An example demonstrating how to register default attributes for an entity type using `DefaultAttributeRegistry.INSTANCE.register()`. This is a common pattern for setting up entity attributes. ```java EntityAttributeRegistry.INSTANCE.register(type, LivingEntity.createLivingAttributes()); ``` -------------------------------- ### onConfigurationInit Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/networking/v1/ClientConfigurationConnectionEvents.Init.html This method is called when the client configuration connection is initialized. It receives the ClientConfigurationNetworkHandler and the MinecraftClient as arguments. ```APIDOC ## Method: onConfigurationInit ### Description Callback for when the client configuration connection is initialized. ### Signature `void onConfigurationInit(ClientConfigurationNetworkHandler handler, MinecraftClient client)` ### Parameters * `handler` (ClientConfigurationNetworkHandler) - The network handler for client configuration. * `client` (MinecraftClient) - The Minecraft client instance. ``` -------------------------------- ### holdMouse Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/gametest/v1/TestInput.html Starts holding down a mouse button. The mouse button will be held until it is released. Does nothing if the mouse button is already being held. Most key bindings will only start reacting to this when a tick is waited. ```APIDOC ## holdMouse void holdMouse(int button) ### Description Starts holding down a mouse button. The mouse button will be held until it is released. Does nothing if the mouse button is already being held. **Most key bindings will only start reacting to this when a tick is waited.** ### Parameters #### Path Parameters - `button` (int) - The mouse button to hold ``` -------------------------------- ### getAttachedOrGet Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/attachment/v1/AttachmentTarget.html Gets the data associated with the given AttachmentType, or gets the provided default value from the provided non-null supplier if it doesn't exist. The supplier may return null. This does not initialize the attachment. ```APIDOC ## getAttachedOrGet default A getAttachedOrGet(AttachmentType type, Supplier defaultValue) Gets the data associated with the given `AttachmentType`, or gets the provided default value from the provided non-`null` supplier if it doesn't exist. The supplier may return `null`. Unlike `getAttachedOrCreate(AttachmentType, Supplier)`, this doesn't initialize the attachment with the default value. ### Type Parameters `A` - the type of the attached data ### Parameters * `type` - the attachment type * `defaultValue` - the default value supplier to use as fallback ### Returns the attached data, or the default value ``` -------------------------------- ### ClientConfigurationConnectionEvents.START Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Event called after the connection has been initialized and is ready to start sending and receiving configuration packets. ```APIDOC ## ClientConfigurationConnectionEvents.START ### Description An event called after the connection has been initialized and is ready to start sending and receiving configuration packets. ### Variable `START` ``` -------------------------------- ### FabricAdvancementProvider Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4+1.21.8/index-all.html Get the name. ```APIDOC ## getName() ### Description Get the name. ### Method Method ### Class `net.fabricmc.fabric.api.datagen.v1.provider.FabricAdvancementProvider` ``` -------------------------------- ### WorldRenderEvents.AFTER_SETUP Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/rendering/v1/WorldRenderEvents.html Called after the view frustum is computed and render chunks are identified. Use for setup that depends on the view frustum. ```APIDOC ## WorldRenderEvents.AFTER_SETUP ### Description Called after view Frustum is computed and all render chunks to be rendered are identified and rebuilt but before chunks are uploaded to GPU. Use for setup of state that depends on view frustum. ``` -------------------------------- ### Transaction Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4+1.21.8/index-all.html Get the lifecycle. ```APIDOC ## getLifecycle() ### Description Get the lifecycle. ### Method Static method ### Interface `net.fabricmc.fabric.api.transfer.v1.transaction.Transaction` ``` -------------------------------- ### Registering a Styling Phase Message Decorator Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/message/v1/ServerMessageDecoratorEvent.html This example shows how to register a message decorator that only modifies the styling of a message, such as applying a color. This example applies an orange color to messages sent by server operators. ```APIDOC ## Registering a Styling Phase Message Decorator ### Description Registers a message decorator to modify the styling of chat messages without altering the text content. ### Method `ServerMessageDecoratorEvent.EVENT.register()` ### Parameters #### Event Phase - **ServerMessageDecoratorEvent.STYLING_PHASE** (Identifier) - The phase for modifying message styling. #### Callback Function - **sender** (ServerPlayerEntity) - The player who sent the message. - **message** (MutableText) - The message to be styled. ### Request Example ```java ServerMessageDecoratorEvent.EVENT.register(ServerMessageDecoratorEvent.STYLING_PHASE, (sender, message) -> { // Apply orange color to messages sent by server operators if (sender != null && sender.server.getPlayerManager().isOperator(sender.getGameProfile())) { return message.copy().styled(style -> style.withColor(0xFFA500)); } return message; }); ``` ``` -------------------------------- ### ClientPlayConnectionEvents.Init Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4+1.21.8/index-all.html Callback for the initialization of a client play connection. ```APIDOC ## onPlayInit ClientPlayNetworkHandler MinecraftClient ### Description Callback for the initialization of a client play connection. ### Method `onPlayInit` ### Parameters - **ClientPlayNetworkHandler** (ClientPlayNetworkHandler) - Description not provided - **MinecraftClient** (MinecraftClient) - Description not provided ``` -------------------------------- ### onPlayInit Method Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/networking/v1/ServerPlayConnectionEvents.Init.html This method is called when a player successfully initializes their connection to the server. It provides access to the server's network handler and the Minecraft server instance. ```APIDOC ## Method: onPlayInit ### Description Called when a player successfully initializes their connection to the server. ### Signature `void onPlayInit(ServerPlayNetworkHandler handler, MinecraftServer server)` ### Parameters * **handler** (ServerPlayNetworkHandler) - The network handler for the player's connection. * **server** (MinecraftServer) - The Minecraft server instance. ### Usage This is a functional interface, so it can be implemented using a lambda expression or method reference. ```java ServerPlayConnectionEvents.Init.onPlayInit(handler -> { // Your code here }); ``` ``` -------------------------------- ### Client Play Init Event Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Callback for the initialization of a client play connection. ```APIDOC ## onPlayInit(ClientPlayNetworkHandler, MinecraftClient) ### Description Callback for the initialization of a client play connection. ### Method Signature `onPlayInit(ClientPlayNetworkHandler, MinecraftClient)` ### Interface `net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents.Init` ``` -------------------------------- ### FuelRegistryEvents.Context.registries Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4+1.21.8/index-all.html Get the `RegistryWrapper.WrapperLookup` for all registries. ```APIDOC ## registries() ### Description Get the `RegistryWrapper.WrapperLookup` for all registries. ### Method Method in interface net.fabricmc.fabric.api.registry.FuelRegistryEvents.Context ### Returns RegistryWrapper.WrapperLookup - The wrapper lookup for all registries. ``` -------------------------------- ### afterInit Method Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/screen/v1/ScreenEvents.AfterInit.html This method is called after a screen has been initialized. It receives the MinecraftClient instance, the screen object, and the scaled screen dimensions. ```APIDOC ## Method afterInit ### Description Called after a screen has been initialized. ### Signature `void afterInit(MinecraftClient client, Screen screen, int scaledWidth, int scaledHeight)` ### Parameters * **client** (MinecraftClient) - The Minecraft client instance. * **screen** (Screen) - The screen that was just initialized. * **scaledWidth** (int) - The scaled width of the screen. * **scaledHeight** (int) - The scaled height of the screen. ``` -------------------------------- ### FabricEntitySelectorReader.getCustomFlag Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Gets the value of the flag. ```APIDOC ## getCustomFlag(Identifier) - Method in interface net.fabricmc.fabric.api.command.v2.FabricEntitySelectorReader Gets the value of the flag. ``` -------------------------------- ### TriState.get() Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Gets the value of the tri-state. ```APIDOC ## TriState.get() ### Description Gets the value of the tri-state. ### Method `get()` ### Enum net.fabricmc.fabric.api.util.TriState ``` -------------------------------- ### ServerPlayConnectionEvents.Init Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4+1.21.8/index-all.html Callback for the initialization of a server play connection. ```APIDOC ## onPlayInit ServerPlayNetworkHandler MinecraftServer ### Description Callback for the initialization of a server play connection. ### Method `onPlayInit` ### Parameters - **ServerPlayNetworkHandler** (ServerPlayNetworkHandler) - Description not provided - **MinecraftServer** (MinecraftServer) - Description not provided ``` -------------------------------- ### onLoginStart Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/networking/v1/ClientLoginConnectionEvents.Init.html Called when the client login connection starts. This event is useful for performing actions before the login process fully completes, such as setting up network handlers or client-side states. ```APIDOC ## Method: onLoginStart ### Description Called when the client login connection starts. ### Signature `void onLoginStart(ClientLoginNetworkHandler handler, MinecraftClient client)` ### Parameters * **handler** (`ClientLoginNetworkHandler`) - The network handler for the client login connection. * **client** (`MinecraftClient`) - The Minecraft client instance. ### Example Usage (Lambda Expression) ```java ClientLoginConnectionEvents.Init.EVENT.register((handler, client) -> { // Your code here }); ``` ``` -------------------------------- ### SimpleFabricLootTableProvider.run Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/datagen/v1/provider/SimpleFabricLootTableProvider.html Runs the data provider, generating loot tables. ```APIDOC ## run ### Description Runs the data provider, generating loot tables. ### Parameters - **writer** (DataWriter) - The writer to use for saving generated data. ### Returns - CompletableFuture - A future that completes when the data generation is finished. ``` -------------------------------- ### ServerTickEvents.StartTick Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Callback for the start of a server tick. ```APIDOC ## onStartTick (Server Tick) ### Description Callback for the start of a server tick. ### Method Signature onStartTick(MinecraftServer) ``` -------------------------------- ### ClientLoginConnectionEvents.Init Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4+1.21.8/index-all.html Callback for the initialization of a client login connection. ```APIDOC ## onLoginStart ClientLoginNetworkHandler MinecraftClient ### Description Callback for the initialization of a client login connection. ### Method `onLoginStart` ### Parameters - **ClientLoginNetworkHandler** (ClientLoginNetworkHandler) - Description not provided - **MinecraftClient** (MinecraftClient) - Description not provided ``` -------------------------------- ### EntitySleepEvents.StartSleeping Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Callback for when an entity starts sleeping. ```APIDOC ## onStartSleeping ### Description Called when an entity starts to sleep. ### Method Signature onStartSleeping(LivingEntity, BlockPos) ``` -------------------------------- ### create Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/gametest/v1/world/TestWorldBuilder.html Creates and joins a singleplayer world with the currently configured world settings. ```APIDOC ## `create` Method TestSingleplayerContext create() Creates and joins a singleplayer world with the configured world settings. ### Returns - The singleplayer context of the world that was joined ``` -------------------------------- ### holdKey (int) Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Starts holding down a key. ```APIDOC ## holdKey(int) ### Description Starts holding down a key. ### Method `holdKey` ### Parameters #### Path Parameters - **keyCode** (int) - Required - The key code of the key to hold. ``` -------------------------------- ### Server Play Init Event Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Callback for the initialization of a server play connection. ```APIDOC ## onPlayInit(ServerPlayNetworkHandler, MinecraftServer) ### Description Callback for the initialization of a server play connection. ### Method Signature `onPlayInit(ServerPlayNetworkHandler, MinecraftServer)` ### Interface `net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents.Init` ``` -------------------------------- ### holdAlt Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Starts holding down left alt. ```APIDOC ## holdAlt() ### Description Starts holding down left alt. ### Method `holdAlt` ``` -------------------------------- ### PlayerLookup.world Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Gets all the players in a server world. ```APIDOC ## world(ServerWorld) - Static method in class net.fabricmc.fabric.api.networking.v1.PlayerLookup ### Description Gets all the players in a server world. ### Method static ### Parameters #### Path Parameters - **world** (ServerWorld) - Required - The server world to get players from. ### Endpoint N/A (Static method) ``` -------------------------------- ### QuadView.renderLayer Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Gets the render layer of the quad. ```APIDOC ## QuadView.renderLayer ### Description Gets the render layer of the quad. ### Method Signature `BlockRenderLayer renderLayer()` ``` -------------------------------- ### MeshBakedGeometry Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4+1.21.8/index-all.html Gets this geometry's mesh. ```APIDOC ## getMesh() ### Description Gets this geometry's mesh. ### Method Method ### Class `net.fabricmc.fabric.api.renderer.v1.model.MeshBakedGeometry` ``` -------------------------------- ### Creating a Defaulted Registry Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/event/registry/FabricRegistryBuilder.html This example shows how to create a defaulted registry with a specified registry key and a default identifier. ```APIDOC ## createDefaulted(RegistryKey> registryKey, Identifier defaultId) ### Description Creates a new `FabricRegistryBuilder` using a `DefaultedRegistry`. The registry has the `RegistryAttribute.MODDED` attribute by default. ### Method Signature `static FabricRegistryBuilder> createDefaulted(RegistryKey> registryKey, Identifier defaultId)` ### Example Usage ```java RegistryKey> registryKey = RegistryKey.ofRegistry(Identifier.of("modid", "my_defaulted_registry")); Identifier defaultId = Identifier.of("modid", "default_value"); Registry registry = FabricRegistryBuilder.createDefaulted(registryKey, defaultId) .buildAndRegister(); ``` ``` -------------------------------- ### FabricDynamicRegistryProvider.Entries Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4+1.21.8/index-all.html Gets access to all registry lookups. ```APIDOC ## getLookups() ### Description Gets access to all registry lookups. ### Method Method ### Class `net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider.Entries` ``` -------------------------------- ### faceNormal Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4+1.21.8/index-all.html Gets the normal vector of a quad. ```APIDOC ## faceNormal() ### Description Gets the normal vector of this quad as implied by its vertex positions. This is useful for lighting and rendering calculations. ### Returns (Vector3f) - The normal vector of the quad. ``` -------------------------------- ### getWorldSave Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/index-all.html Gets the handle for the world save. ```APIDOC ## getWorldSave() ### Description Gets the handle for the world save. ### Method Method ``` -------------------------------- ### ClientPlayNetworking.Context Methods Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/networking/v1/ClientPlayNetworking.Context.html This section details the methods available on the ClientPlayNetworking.Context interface. ```APIDOC ## ClientPlayNetworking.Context An interface providing context for client-side play networking events. ### Methods #### client ```java MinecraftClient client() ``` Returns the MinecraftClient instance. #### player ```java ClientPlayerEntity player() ``` Returns the player entity that received the payload. #### responseSender ```java PacketSender responseSender() ``` Returns the PacketSender used for sending responses. ``` -------------------------------- ### KeyBindingHelper Source: https://maven.fabricmc.net/docs/fabric-api-0.133.4%2B1.21.8/net/fabricmc/fabric/api/client/keybinding/v1/package-summary.html The `KeyBindingHelper` class provides static methods for registering `KeyBinding` instances. This is the primary entry point for integrating custom key bindings into the game. ```APIDOC ## Class: KeyBindingHelper ### Description Helper for registering `KeyBinding`s. ### Methods #### `registerClientTickHandler(keyBinding: KeyBinding, handler: ClientTickEvents.KeyBindingTick)` Registers a client-side tick handler for a specific `KeyBinding`. This method is called every tick when the `KeyBinding` is pressed. #### `registerKeyBinding(keyBinding: KeyBinding)` Registers a `KeyBinding` with the game. This makes the key binding appear in the controls menu and allows it to be triggered. ### Example Usage ```java // In your mod initializer: KeyBinding myKeyBinding = new KeyBinding("key.my_mod.action", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_R, "category.my_mod.keys"); KeyBindingHelper.registerKeyBinding(myKeyBinding); // To handle presses: KeyBindingHelper.registerClientTickHandler(myKeyBinding, (client) -> { if (client.player != null) { // Do something when the key is pressed System.out.println("My key binding was pressed!"); } }); ``` ```