Skip to content

Commit

Permalink
Added creative mode tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
Omar Rahman authored and Omar Rahman committed Sep 7, 2024
1 parent 2e2ad56 commit 858f2fb
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ loader_version_range=[4,)
mod_id=advancedgrindstone
mod_name=Advanced Grindstone
mod_license=GNU GPLv3
mod_version=0.0.1
mod_version=0.0.2
mod_group_id=net.ramen5914.advancedgrindstone
mod_authors=Omar Rahman (Ramen5914)
mod_description=A special grindstone to remove specific enchants or curses!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"block.advancedgrindstone.advanced_grindstone": "Advanced Grindstone",
"container.advancedgrindstone.advanced_grindstone_title": "Advanced Grindstone"
"container.advancedgrindstone.advanced_grindstone_title": "Advanced Grindstone",
"itemgroup.advancedgrindstone.advanced_grindstone_tab": "Ramen's Additions"
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public class AdvancedGrindstone {
public AdvancedGrindstone(IEventBus modEventBus, ModContainer modContainer) {
modEventBus.addListener(this::commonSetup);

ModCreativeModeTabs.register(modEventBus);

ModBlocks.register(modEventBus);
ModItems.register(modEventBus);
ModMenuTypes.register(modEventBus);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package net.ramen5914.advancedgrindstone;

import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredRegister;
import net.ramen5914.advancedgrindstone.block.ModBlocks;

import java.util.function.Supplier;

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

public static final Supplier<CreativeModeTab> ADVANCED_GRINDSTONE_TAB =
CREATIVE_MODE_TABS.register("advanced_grindstone_tab", () -> CreativeModeTab.builder()
.title(Component.translatable(String.format("itemgroup.%s.advanced_grindstone_tab", AdvancedGrindstone.MOD_ID)))
.icon(() -> new ItemStack(ModBlocks.ADVANCED_GRINDSTONE.get()))
.displayItems((parameters, output) -> {
output.accept(ModBlocks.ADVANCED_GRINDSTONE);
}).build());

public static void register(IEventBus eventBus) {
CREATIVE_MODE_TABS.register(eventBus);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import net.minecraft.data.PackOutput;
import net.neoforged.neoforge.common.data.LanguageProvider;

import net.ramen5914.advancedgrindstone.AdvancedGrindstone;
import net.ramen5914.advancedgrindstone.block.ModBlocks;

Expand All @@ -15,6 +14,7 @@ public ModEnglishLangProvider(PackOutput output) {
protected void addTranslations() {
addBlock(ModBlocks.ADVANCED_GRINDSTONE, "Advanced Grindstone");

add("container.advancedgrindstone.advanced_grindstone_title", "Advanced Grindstone");
add(String.format("container.%s.advanced_grindstone_title", AdvancedGrindstone.MOD_ID), "Advanced Grindstone");
add(String.format("itemgroup.%s.advanced_grindstone_tab", AdvancedGrindstone.MOD_ID), "Ramen's Additions");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.data.recipes.SmithingTransformRecipeBuilder;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.block.Blocks;
Expand Down

0 comments on commit 858f2fb

Please sign in to comment.