Package me.tnoctua.nmodutils.util
Class ModRegistry
java.lang.Object
me.tnoctua.nmodutils.util.ModRegistry
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ArrayList<net.minecraft.block.entity.BlockEntityType<?>> final ArrayList<net.minecraft.registry.tag.TagKey<net.minecraft.block.Block>> final ArrayList<net.minecraft.block.Block> final ArrayList<net.minecraft.component.ComponentType<?>> final ArrayList<net.minecraft.registry.RegistryKey<net.minecraft.entity.damage.DamageType>> final ArrayList<net.minecraft.registry.tag.TagKey<net.minecraft.entity.EntityType<?>>> final HashSet<net.minecraft.item.ItemGroup> final ArrayList<net.minecraft.registry.tag.TagKey<net.minecraft.item.Item>> final ArrayList<net.minecraft.item.Item> final ArrayList<net.minecraft.sound.SoundEvent> -
Constructor Summary
ConstructorsConstructorDescriptionModRegistry(String modIdentifier) Implements various registry helper methods to add content to the game. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.registry.tag.TagKey<net.minecraft.block.Block> Registers a block tag to the game.net.minecraft.registry.RegistryKey<net.minecraft.entity.damage.DamageType> damageType(String key) Registers a damage type to the game.net.minecraft.registry.tag.TagKey<net.minecraft.entity.EntityType<?>> Registers an entity tag to the game.net.minecraft.registry.tag.TagKey<net.minecraft.item.Item> Registers an item tag to the game.net.minecraft.block.Blockregister(boolean enabled, boolean item, String key, Function<net.minecraft.block.AbstractBlock.Settings, ? extends net.minecraft.block.Block> factory, net.minecraft.block.AbstractBlock.Settings settings) Registers a block to the game.net.minecraft.block.Blockregister(boolean enabled, String key, Function<net.minecraft.block.AbstractBlock.Settings, ? extends net.minecraft.block.Block> factory, net.minecraft.block.AbstractBlock.Settings settings) Registers a block to the game.net.minecraft.item.Itemregister(boolean enabled, String key, Function<net.minecraft.item.Item.Settings, net.minecraft.item.Item> factory, net.minecraft.item.Item.Settings settings) Registers an item to the game.net.minecraft.registry.RegistryKey<net.minecraft.item.ItemGroup> Registers an item group to the game.net.minecraft.block.Blockregister(String key, Function<net.minecraft.block.AbstractBlock.Settings, ? extends net.minecraft.block.Block> factory, net.minecraft.block.AbstractBlock.Settings settings) Registers a block to the game.net.minecraft.item.Itemregister(String key, Function<net.minecraft.item.Item.Settings, net.minecraft.item.Item> factory, net.minecraft.item.Item.Settings settings) Registers an item to the game.<T> net.minecraft.component.ComponentType<T> register(String key, UnaryOperator<net.minecraft.component.ComponentType.Builder<T>> builder) Registers a component type to the game.<T extends net.minecraft.block.entity.BlockEntity>
net.minecraft.block.entity.BlockEntityType<T> register(String key, net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder.Factory<? extends T> factory, net.minecraft.block.Block... blocks) Registers a block entity to the game.net.minecraft.registry.RegistryKey<net.minecraft.item.ItemGroup> Registers an item group to the game.net.minecraft.sound.SoundEventsoundEvent(boolean enabled, String key) Registers a sound event to the game.net.minecraft.sound.SoundEventsoundEvent(String key) Registers a sound event to the game.
-
Field Details
-
BLOCKS
-
ITEM_GROUPS
-
ITEMS
-
SOUNDS
-
BLOCK_TAGS
-
ITEM_TAGS
-
ENTITY_TAGS
public final ArrayList<net.minecraft.registry.tag.TagKey<net.minecraft.entity.EntityType<?>>> ENTITY_TAGS -
DAMAGE_TYPES
public final ArrayList<net.minecraft.registry.RegistryKey<net.minecraft.entity.damage.DamageType>> DAMAGE_TYPES -
BLOCK_ENTITIES
-
COMPONENTS
-
-
Constructor Details
-
ModRegistry
Implements various registry helper methods to add content to the game.- Parameters:
modIdentifier- identifier to use for the registry (which should always be your mod's ID)
-
-
Method Details
-
register
public <T extends net.minecraft.block.entity.BlockEntity> net.minecraft.block.entity.BlockEntityType<T> register(String key, net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder.Factory<? extends T> factory, net.minecraft.block.Block... blocks) Registers a block entity to the game.- Type Parameters:
T- block entity subclass- Parameters:
key- block entity ID/keyfactory- block entity factoryblocks- blocks applicable to the block entity- Returns:
- block entity type
-
register
public net.minecraft.block.Block register(String key, Function<net.minecraft.block.AbstractBlock.Settings, ? extends net.minecraft.block.Block> factory, net.minecraft.block.AbstractBlock.Settings settings) Registers a block to the game.- Parameters:
key- block ID/key- Returns:
- the registered block
-
register
public net.minecraft.block.Block register(boolean enabled, String key, Function<net.minecraft.block.AbstractBlock.Settings, ? extends net.minecraft.block.Block> factory, net.minecraft.block.AbstractBlock.Settings settings) Registers a block to the game.- Parameters:
enabled- whether the block should be registeredkey- block ID/key- Returns:
- the registered block
-
register
public net.minecraft.block.Block register(boolean enabled, boolean item, String key, Function<net.minecraft.block.AbstractBlock.Settings, ? extends net.minecraft.block.Block> factory, net.minecraft.block.AbstractBlock.Settings settings) Registers a block to the game.- Parameters:
enabled- whether the block should be registereditem- whether the block should have an item registeredkey- block ID/key- Returns:
- the registered block
-
register
public net.minecraft.registry.RegistryKey<net.minecraft.item.ItemGroup> register(String key, net.minecraft.item.ItemGroup itemGroup) Registers an item group to the game.- Parameters:
key- key/ID of the item groupitemGroup- item group instance- Returns:
- the registered item group's registry key
-
register
public net.minecraft.registry.RegistryKey<net.minecraft.item.ItemGroup> register(boolean enabled, String key, net.minecraft.item.ItemGroup itemGroup) Registers an item group to the game.- Parameters:
enabled- condition for registering the item groupkey- key/ID of the item groupitemGroup- item group instance- Returns:
- the registered item group's registry key
-
register
public net.minecraft.item.Item register(String key, Function<net.minecraft.item.Item.Settings, net.minecraft.item.Item> factory, net.minecraft.item.Item.Settings settings) Registers an item to the game.- Parameters:
key- item ID/key- Returns:
- the registered item
-
register
public net.minecraft.item.Item register(boolean enabled, String key, Function<net.minecraft.item.Item.Settings, net.minecraft.item.Item> factory, net.minecraft.item.Item.Settings settings) Registers an item to the game.- Parameters:
enabled- whether the item should be registeredkey- item ID/key- Returns:
- the registered item
-
soundEvent
Registers a sound event to the game.- Parameters:
key- sound event ID/key- Returns:
- the registered sound event
-
soundEvent
Registers a sound event to the game.- Parameters:
enabled- whether the sound event should be registeredkey- sound event ID/key- Returns:
- the registered sound event
-
blockTag
Registers a block tag to the game.- Parameters:
key- block tag ID/key- Returns:
- the block tag key
-
itemTag
Registers an item tag to the game.- Parameters:
key- item tag ID/key- Returns:
- the item tag key
-
entityTag
Registers an entity tag to the game.- Parameters:
key- entity tag ID/key- Returns:
- the entity tag key
-
damageType
public net.minecraft.registry.RegistryKey<net.minecraft.entity.damage.DamageType> damageType(String key) Registers a damage type to the game.This method does not create the resource required in /data/modid/damage_type
- Parameters:
key- damage type ID/key- Returns:
- the damage type key
-
register
public <T> net.minecraft.component.ComponentType<T> register(String key, UnaryOperator<net.minecraft.component.ComponentType.Builder<T>> builder) Registers a component type to the game.- Type Parameters:
T- type of component- Parameters:
key- component type ID/keybuilder- component builder- Returns:
- component type instance
-