User Tools

Site Tools


Sidebar

← Go back to the homepage

Fabric Tutorials

Setup

Basics

These pages are essential must-reads when modding with Fabric, and modding Minecraft in general, if you are new to modding, it is recommended you read the following.

Items

Blocks and Block Entities

Data Generation

World Generation

Commands

These pages will guide you through Mojang's Brigadier library which allows you to create commands with complex arguments and actions.

Events

These pages will guide you through using the many events included in Fabric API, and how to create your own events for you or other mods to use.

Entities

Fluids

Mixins & ASM

These pages will guide you through the usage of SpongePowered's Mixin library, which is a highly complex topic. We recommend you read these pages thoroughly.

Miscellaneous

Yarn

Contribute to Fabric

tutorial:transfer-api

Fluid, Item and Energy Transfer

All Transfer API classes are marked as @ApiStatus.Experimental. This is temporary, and it means that there may be occasional breaking changes if a design flaw is encountered in the API, but we will try not to break the API to avoid disrupting the large amount of mods that are using it already. In practice, this means that you can mostly ignore this warning, and disable it in your IDE if it's too annoying.

The Fluid Transfer API

The Fabric Fluid Transfer API is how fluid-containing blocks such as machines, pipes, and tanks communicate with each other. It's what allows all mods to be compatible with each other as far as fluid transfer is concerned. (If you are coming from Forge, it serves a purpose similar to IFluidHandler).

  1. Creating a tank block entity walks you through how you can create a simple tank block entity, and what FluidVariant is.
  2. Understanding Storage<FluidVariant> teaches what Storage<FluidVariant> is and how to use it.
  3. How to implement Storage<FluidVariant> provides an overview of the storage implementations provided by Fabric that you can use in your mods, with plenty of example code.

The Item Transfer API

The Fabric Item Transfer API is used by item-containing blocks such as chests, machines, or storage drawers to communicate with other. (If you are coming from Forge, it serves a purpose similar to IItemHandler).

  1. Item transfer with Storage<ItemVariant> explains how the item API is almost the same as the fluid API, how wrappers around Inventory/PlayerInventory can be retrieved, and how item storages can be implemented in practice.

Note: the existing item transfer API in Minecraft should be avoided in fabric mods due to its severe limitations. If you don't know what this means, you can ignore this warning.

Fluid-containing items

The TechReborn Energy API

tutorial/transfer-api.txt · Last modified: 2022/11/14 19:37 by nexus-dino