Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/java/net/doppelr/lemonmates/LemonMates.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.doppelr.lemonmates;

import net.doppelr.lemonmates.item.ModCreativeModeTabs;
import net.doppelr.lemonmates.item.ModItems;
import net.minecraft.world.item.CreativeModeTabs;
import org.slf4j.Logger;
Expand Down Expand Up @@ -35,6 +36,8 @@ public LemonMates(IEventBus modEventBus, ModContainer modContainer) {
// Do not add this line if there are no @SubscribeEvent-annotated functions in this class, like onServerStarting() below.
NeoForge.EVENT_BUS.register(this);

ModCreativeModeTabs.register(modEventBus);

ModItems.register(modEventBus);

// Register the item to a creative tab
Expand Down
81 changes: 81 additions & 0 deletions src/main/java/net/doppelr/lemonmates/item/ModCreativeModeTabs.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package net.doppelr.lemonmates.item;

import net.doppelr.lemonmates.LemonMates;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.ItemStack;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredRegister;

import java.util.function.Supplier;

public class ModCreativeModeTabs {
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TAB =
DeferredRegister.create(Registries.CREATIVE_MODE_TAB, LemonMates.MOD_ID);

public static final Supplier<CreativeModeTab> LEMONMATES_TAB = CREATIVE_MODE_TAB.register("lemonmates_tab",
() -> CreativeModeTab.builder()
.title(Component.translatable("itemGroup." + LemonMates.MOD_ID + ".lemonmates"))
.withTabsBefore(CreativeModeTabs.SPAWN_EGGS)
.icon(() -> new ItemStack(ModItems.BOTTLE_CAP.get()))
.displayItems((params, output) -> {
// Bottle, Cap
output.accept(ModItems.BOTTLE_CAP);
output.accept(ModItems.BOTTLE_EMPTY);

// Labels
output.accept(ModItems.CITRON_LEMONADE_LABEL);
output.accept(ModItems.ORANGE_LEMONADE_LABEL);
output.accept(ModItems.RASPBERRY_LEMONADE_LABEL);
output.accept(ModItems.SUMMER_MIX_LABEL);
output.accept(ModItems.WATERMELON_LEMONADE_LABEL);

// Citron
output.accept(ModItems.BOTTLE_CITRON_LABEL);
output.accept(ModItems.BOTTLE_CITRON_LEMONADE);
output.accept(ModItems.BOTTLE_CITRON_LABEL_CAP);
output.accept(ModItems.BOTTLE_CITRON_LABEL_LEMONADE_CAP);
output.accept(ModItems.BOTTLE_CITRON_LEMONADE_CAP);
output.accept(ModItems.BOTTLE_CITRON_LABEL_LEMONADE);

// Orange
output.accept(ModItems.BOTTLE_ORANGE_LABEL);
output.accept(ModItems.BOTTLE_ORANGE_LEMONADE);
output.accept(ModItems.BOTTLE_ORANGE_LABEL_CAP);
output.accept(ModItems.BOTTLE_ORANGE_LABEL_LEMONADE_CAP);
output.accept(ModItems.BOTTLE_ORANGE_LEMONADE_CAP);
output.accept(ModItems.BOTTLE_ORANGE_LABEL_LEMONADE);

// Raspberry
output.accept(ModItems.BOTTLE_RASPBERRY_LABEL);
output.accept(ModItems.BOTTLE_RASPBERRY_LEMONADE);
output.accept(ModItems.BOTTLE_RASPBERRY_LABEL_CAP);
output.accept(ModItems.BOTTLE_RASPBERRY_LABEL_LEMONADE_CAP);
output.accept(ModItems.BOTTLE_RASPBERRY_LEMONADE_CAP);
output.accept(ModItems.BOTTLE_RASPBERRY_LABEL_LEMONADE);

// Summer Mix
output.accept(ModItems.BOTTLE_SUMMERMIX_LABEL);
output.accept(ModItems.BOTTLE_SUMMERMIX_LEMONADE);
output.accept(ModItems.BOTTLE_SUMMERMIX_LABEL_CAP);
output.accept(ModItems.BOTTLE_SUMMERMIX_LABEL_LEMONADE_CAP);
output.accept(ModItems.BOTTLE_SUMMERMIX_LEMONADE_CAP);
output.accept(ModItems.BOTTLE_SUMMERMIX_LABEL_LEMONADE);

// Watermelon
output.accept(ModItems.BOTTLE_WATERMELON_LABEL);
output.accept(ModItems.BOTTLE_WATERMELON_LEMONADE);
output.accept(ModItems.BOTTLE_WATERMELON_LABEL_CAP);
output.accept(ModItems.BOTTLE_WATERMELON_LABEL_LEMONADE_CAP);
output.accept(ModItems.BOTTLE_WATERMELON_LEMONADE_CAP);
output.accept(ModItems.BOTTLE_WATERMELON_LABEL_LEMONADE);
})
.build()
);

public static void register(IEventBus eventBus) {
CREATIVE_MODE_TAB.register(eventBus);
}
}
2 changes: 2 additions & 0 deletions src/main/resources/assets/lemonmates/lang/en_US.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"itemGroup.lemonmates.lemonmates": "Lemonmates",

"item.lemonmates.bottle_cap": "Bottle Cap",
"item.lemonmates.bottle_empty": "Empty Bottle",

Expand Down