User Tools

Site Tools


tutorial:transfer-api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
tutorial:transfer-api [2021/10/29 20:18] – [[WIP] Understanding the Fabric Transfer API] technici4ntutorial:transfer-api [2023/07/19 13:38] technici4n
Line 1: Line 1:
-====== [WIP] Understanding the Fabric Transfer API ====== +====== Fluid, Item and Energy Transfer ======
-This tutorial gives a brief overview of how the Fabric Transfer API works, and how you can use it for your own mods. +
-For any question, please go to the ''#fluid-volume-api-debating'' channel on the discord server.+
  
-===== Fabric API Lookup API ===== +All Transfer API classes are marked as ''@ApiStatus.Experimental''This is temporaryand it means that there may be occasional breaking changes if a design flaw is encountered in the APIbut we will try not to break the API to avoid disrupting the large amount of mods that are using it already. In practicethis means that you can mostly ignore this warning, and disable it in your IDE if it's too annoying.
-The //API Lookup// system allows blocks and items to expose functionality (called "API"s) in a flexible mannerExample use cases include: blocks that contain items such as chestsblocks that contain fluids such as tanksblocks that can be wrenchedblocks that can be colored, blocks that contain mana, items that contain fluids, and so on...+
  
-For Forge users, it is similar to the Capability systembut without data storage or event dispatch.+==== Transactions ==== 
 +The Fabric Transfer API relies heavily on the concept of transactions. Before looking at the details of how transfer workswe take a detour to discuss transactions.
  
-[[https://github.com/FabricMC/fabric/tree/1.17/fabric-api-lookup-api-v1|Link to the documentation.]] Read the ''BlockApiLookup'' and ''ItemApiLookup'' class documentation for a usage example.+  - [[tutorial:transfer-api/transactions|The Transaction system]].
  
-===== The Fluid Transfer API =====+==== 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'').
  
-===== Moving items and fluids between blocks =====+  - [[tutorial:transfer-api/simpletank|Creating a tank block entity]] walks you through how you can create a simple tank block entity, and what ''FluidVariant'' is. 
 +  - [[tutorial:transfer-api/storage|Understanding Storage<FluidVariant>]] teaches what ''Storage<FluidVariant>'' is and how to use it. 
 +  - [[tutorial:transfer-api/fluid_implementation|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.
  
-===== Implementing a fluid tank block =====+==== 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''). 
 +  - [[tutorial:transfer-api/item_storage|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.
  
-===== Fluid-containing items =====+//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 ==== 
 +  - [Not finished] [[tutorial:transfer-api/fluid-containing-items|How to use and implement the fluid-containing item API]]. 
 + 
 +==== The TechReborn Energy API ==== 
 +  - [Not yet written] 1. [[tutorial:energy-blockentity|how to create an energy storage block entity]]
tutorial/transfer-api.txt · Last modified: 2023/07/19 13:38 by technici4n