Class BlockRegistryAdapter
java.lang.Object
net.darkhax.bookshelf.common.api.registry.adapters.GameRegistryAdapter<net.minecraft.world.level.block.Block>
net.darkhax.bookshelf.common.impl.registry.adapter.BlockRegistryAdapter
- All Implemented Interfaces:
RegistryAdapter<net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.Block>, net.minecraft.world.level.block.Block>
public class BlockRegistryAdapter
extends GameRegistryAdapter<net.minecraft.world.level.block.Block>
A registry adapter for the block registry.
-
Field Summary
Fields inherited from class GameRegistryAdapter
context, registryFunc, registryKey -
Constructor Summary
ConstructorsConstructorDescriptionBlockRegistryAdapter(RegistrationContext context, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<net.minecraft.world.level.block.Block>> regKey, BiConsumer<net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.Block>, Supplier<net.minecraft.world.level.block.Block>> registryFunc) -
Method Summary
Modifier and TypeMethodDescriptionRegistryReference<net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.Block>, net.minecraft.world.level.block.Block> addPlaceable(String key, Supplier<net.minecraft.world.level.block.Block> value) Adds a new block to the block registry and queues up a BlockItem to be registered automatically during item registration.RegistryReference<net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.Block>, net.minecraft.world.level.block.Block> addPlaceable(String key, Supplier<net.minecraft.world.level.block.Block> value, Function<net.minecraft.world.level.block.Block, net.minecraft.world.item.Item> placer) Adds a new block to the block registry and queues up a custom placer item to be registered automatically during item registry.Methods inherited from class GameRegistryAdapter
add, idMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface RegistryAdapter
add
-
Constructor Details
-
BlockRegistryAdapter
public BlockRegistryAdapter(RegistrationContext context, net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<net.minecraft.world.level.block.Block>> regKey, BiConsumer<net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.Block>, Supplier<net.minecraft.world.level.block.Block>> registryFunc)
-
-
Method Details
-
addPlaceable
public RegistryReference<net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.Block>, net.minecraft.world.level.block.Block> addPlaceable(String key, Supplier<net.minecraft.world.level.block.Block> value) Adds a new block to the block registry and queues up a BlockItem to be registered automatically during item registration. The item will be registered using the same ID as the block.- Parameters:
key- The ID to register the value under. This ID only needs to be unique within your namespace.value- A supplier that will produce the block to register.- Returns:
- A reference to the registry entry.
-
addPlaceable
public RegistryReference<net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.Block>, net.minecraft.world.level.block.Block> addPlaceable(String key, Supplier<net.minecraft.world.level.block.Block> value, Function<net.minecraft.world.level.block.Block, net.minecraft.world.item.Item> placer) Adds a new block to the block registry and queues up a custom placer item to be registered automatically during item registry. The item will be registered using the same ID as the block.- Parameters:
key- The ID to register the value under. This ID only needs to be unique within your namespace.value- A supplier that will produce the block to register.placer- A factory that produces the placer item. The input block is the block that was registered.- Returns:
- A reference to the registry entry.
-