diff --git a/src/main/java/top/offsetmonkey538/compactmobfarms/CompactMobFarms.java b/src/main/java/top/offsetmonkey538/compactmobfarms/CompactMobFarms.java index fd59c72..672464c 100644 --- a/src/main/java/top/offsetmonkey538/compactmobfarms/CompactMobFarms.java +++ b/src/main/java/top/offsetmonkey538/compactmobfarms/CompactMobFarms.java @@ -16,6 +16,7 @@ import top.offsetmonkey538.compactmobfarms.block.ModBlocks; import top.offsetmonkey538.compactmobfarms.block.entity.ModBlockEntityTypes; import top.offsetmonkey538.compactmobfarms.item.ModItems; +import top.offsetmonkey538.compactmobfarms.item.group.ModItemGroups; import top.offsetmonkey538.compactmobfarms.screen.ModScreenHandlers; public class CompactMobFarms implements ModInitializer { @@ -27,6 +28,7 @@ public void onInitialize() { // Do stuff ModBlocks.register(); ModItems.register(); + ModItemGroups.register(); ModBlockEntityTypes.register(); ModScreenHandlers.register(); diff --git a/src/main/java/top/offsetmonkey538/compactmobfarms/datagen/language/ModEnglishLanguageProvider.java b/src/main/java/top/offsetmonkey538/compactmobfarms/datagen/language/ModEnglishLanguageProvider.java index 17d10ac..96750f2 100644 --- a/src/main/java/top/offsetmonkey538/compactmobfarms/datagen/language/ModEnglishLanguageProvider.java +++ b/src/main/java/top/offsetmonkey538/compactmobfarms/datagen/language/ModEnglishLanguageProvider.java @@ -11,6 +11,8 @@ public ModEnglishLanguageProvider(FabricDataOutput dataOutput) { @Override public void generateTranslations(TranslationBuilder translationBuilder) { + translationBuilder.add("itemGroup.compact_mob_farms.main_group", "Compact Mob Farms"); + translationBuilder.add(ModItems.SPIRIT_BOTTLE, "Bottle of Spirits"); translationBuilder.add(ModItems.SPAWNER_SHARD, "Spawner Shard"); translationBuilder.add(ModItems.COMPACT_MOB_FARM, "Compact Mob Farm"); diff --git a/src/main/java/top/offsetmonkey538/compactmobfarms/datagen/language/ModEstonianLanguageProvider.java b/src/main/java/top/offsetmonkey538/compactmobfarms/datagen/language/ModEstonianLanguageProvider.java index 18e0a18..b7fbf91 100644 --- a/src/main/java/top/offsetmonkey538/compactmobfarms/datagen/language/ModEstonianLanguageProvider.java +++ b/src/main/java/top/offsetmonkey538/compactmobfarms/datagen/language/ModEstonianLanguageProvider.java @@ -11,6 +11,8 @@ public ModEstonianLanguageProvider(FabricDataOutput dataOutput) { @Override public void generateTranslations(TranslationBuilder translationBuilder) { + translationBuilder.add("itemGroup.compact_mob_farms.main_group", "Kompaktsed Olendi Farmid"); + translationBuilder.add(ModItems.SPIRIT_BOTTLE, "Pudel vaime"); translationBuilder.add(ModItems.SPAWNER_SHARD, "Tekitaja kild"); translationBuilder.add(ModItems.COMPACT_MOB_FARM, "Kompaktne Olendi Farm"); diff --git a/src/main/java/top/offsetmonkey538/compactmobfarms/item/group/ModItemGroups.java b/src/main/java/top/offsetmonkey538/compactmobfarms/item/group/ModItemGroups.java new file mode 100644 index 0000000..5d35be6 --- /dev/null +++ b/src/main/java/top/offsetmonkey538/compactmobfarms/item/group/ModItemGroups.java @@ -0,0 +1,39 @@ +package top.offsetmonkey538.compactmobfarms.item.group; + +import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; +import net.minecraft.item.ItemGroup; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.text.Text; +import top.offsetmonkey538.compactmobfarms.item.ModItems; + +import static top.offsetmonkey538.compactmobfarms.CompactMobFarms.*; + +public final class ModItemGroups { + private ModItemGroups() { + + } + + public static final ItemGroup COMPACT_MOB_FARMS_ITEM_GROUP = register("compact_mob_farms_item_group", + FabricItemGroup.builder() + .icon(ModItems.SPAWNER_SHARD::getDefaultStack) + .displayName(Text.translatable("itemGroup.compact_mob_farms.main_group")) + .entries((displayContext, entries) -> { + entries.add(ModItems.SPIRIT_BOTTLE); + entries.add(ModItems.SPAWNER_SHARD); + entries.add(ModItems.COMPACT_MOB_FARM); + entries.add(ModItems.SAMPLE_TAKER); + }) + .build() + ); + + + private static T register(String name, T group) { + return Registry.register(Registries.ITEM_GROUP, id(name), group); + } + + @SuppressWarnings("EmptyMethod") + public static void register() { + // Registers item groups by loading the class. + } +}