Package commoble.bagofyurting.api

# Class BagOfYurtingAPI

java.lang.Object
commoble.bagofyurting.api.BagOfYurtingAPI

public class BagOfYurtingAPI extends Object

## Field Summary

Fields
Modifier and Type
Field
Description
`static BlockDataTransformer<?>`
`DEFAULT_TRANSFORMER`
The default blockentity data transformer used for writing and reading te data on yurt/unyurt when no transformer is assigned to a type

## Constructor Summary

Constructors
Constructor
Description
`BagOfYurtingAPI()`

## Method Summary

Modifier and Type
Method
Description
`static BlockDataTransformer<?>`
`getDataTransformer​(net.minecraft.world.level.block.entity.BlockEntityType<?> type)`
Get a block data transformer for a given blockentity's type.
`static <T extends net.minecraft.world.level.block.entity.BlockEntity>
void`
`registerBlockDataTransformer​(net.minecraft.world.level.block.entity.BlockEntityType<T> type, BlockDataSerializer<? super T> serializer, BlockDataDeserializer<? super T> deserializer)`
Register block data transformers to a tile entity type.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DEFAULT_TRANSFORMER

public static final BlockDataTransformer<?> DEFAULT_TRANSFORMER
The default blockentity data transformer used for writing and reading te data on yurt/unyurt when no transformer is assigned to a type

## Constructor Details

### BagOfYurtingAPI

public BagOfYurtingAPI()

## Method Details

### registerBlockDataTransformer

public static <T extends net.minecraft.world.level.block.entity.BlockEntity> void registerBlockDataTransformer​(net.minecraft.world.level.block.entity.BlockEntityType<T> type, BlockDataSerializer<? super T> serializer, BlockDataDeserializer<? super T> deserializer)
Register block data transformers to a tile entity type. Call this during FMLCommonSetupEvent. This is safe to call during multithreaded modloading. It will stop being safe to call once modloading concludes.

Type Parameters:
  `T` - The class type of the tile entity, e.g. ChestBlockEntity. Generic bounds on the de/serialization function parameters must be no higher than BlockEntity and no lower than T. e.g. if T is LockableLootBlockEntity, you can provide a function that requires a BlockEntity, but not one that requires a ChestBlockEntity.
Parameters:
  `type` - The type of the tile entity; only one pair of data transformers can be assigned to a given type
  `serializer` - Yurt-context-sensitive serializer for the given block entity type
  `deserializer` - Yurt-context-sensitive deserializer for the given block entity type

### getDataTransformer

public static BlockDataTransformer<?> getDataTransformer​(net.minecraft.world.level.block.entity.BlockEntityType<?> type)
Get a block data transformer for a given blockentity's type. This is safe to call once modloading concludes. If no transformer has been assigned to the given type, a default transformer that uses the default read and write methods of a given blockentity will be returned instead.

Parameters:
  `type` - The type
Returns:
  The data transformer for the block entity's type, or the default transformer if none have been assigned. This transformer will be able to read and write data for block entities that have the provided type.