Skip to content

What is: ContainerIO

mega12345mega edited this page Jul 19, 2024 · 3 revisions

ContainerIO specifies how to read and write to any item/block/entity that could be considered a container. This is used with /open or the Ctrl + Space keybind to display a small-chest-sized page of items. If you want to add a new container, use NBTEditorAPI.registerItemContainer(Item, ItemContainerIO) to bind a ItemContainerIO to any item. There is also NBTEditorAPI.registerBlockContainer(Block, BlockContainerIO), NBTEditorAPI.registerEntityContainer(EntityType<?>, EntityContainerIO), NBTEditorAPI.registerBlockEntityTagContainer(BlockItem, BlockEntityTagContainerIO), & NBTEditorAPI.registerEntityTagContainer(Item, EntityType<?>, EntityTagContainerIO). This may be helpful if your mod adds an entirely new container, and you would like to add support for it. This can be applied to anything. For example, there is built-in support for not only chests, but also item frames, armor stands, furnaces, jukeboxes, and more. Most likely, you will be able to use an already existent implementation, like ConstSizeContainerIO. NBTContainerIO exists as a way to support both the item and block or entity versions of a container, which can then be wrapped with a BlockEntityTagContainerIO or EntityTagContainerIO.

Clone this wiki locally