Skip to content

Commit

Permalink
main item group
Browse files Browse the repository at this point in the history
  • Loading branch information
OffsetMonkey538 committed Oct 5, 2023
1 parent 95d3d9b commit d5cbcfa
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -27,6 +28,7 @@ public void onInitialize() {
// Do stuff
ModBlocks.register();
ModItems.register();
ModItemGroups.register();
ModBlockEntityTypes.register();
ModScreenHandlers.register();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
@@ -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 extends ItemGroup> 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.
}
}

0 comments on commit d5cbcfa

Please sign in to comment.