Skip to content

Commit

Permalink
Added the Creative Tab before
Browse files Browse the repository at this point in the history
Recipes were made. Going to add them now :D
  • Loading branch information
darkwolfie37 committed Jan 29, 2024
1 parent 116d889 commit df3867e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/main/java/com/darkwolfie/silentvalkyrie/Main.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.darkwolfie.silentvalkyrie;

import com.darkwolfie.silentvalkyrie.item.ModCreativeTabs;
import com.darkwolfie.silentvalkyrie.item.ModItems;
import com.mojang.logging.LogUtils;
import net.minecraft.client.Minecraft;
Expand Down Expand Up @@ -34,6 +35,8 @@ public Main() {

ModItems.register(modEventBus);

ModCreativeTabs.register(modEventBus);

// Register ourselves for server and other game events we are interested in
MinecraftForge.EVENT_BUS.register(this);

Expand All @@ -60,10 +63,10 @@ private void commonSetup(final FMLCommonSetupEvent event) {
// Add the example block item to the building blocks tab
private void addCreative(BuildCreativeModeTabContentsEvent event)
{
if(event.getTabKey() == CreativeModeTabs.INGREDIENTS)
{
event.accept(ModItems.PlutoSteel);
}
// if(event.getTabKey() == CreativeModeTabs.INGREDIENTS)
// {
// event.accept(ModItems.PlutoSteel);
// }
}
// You can use SubscribeEvent and let the Event Bus discover methods to call
@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.darkwolfie.silentvalkyrie.item;

import com.darkwolfie.silentvalkyrie.Main;
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.minecraft.world.item.Items;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;

public class ModCreativeTabs {
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS =
DeferredRegister.create(Registries.CREATIVE_MODE_TAB, Main.MODID);

public static final RegistryObject<CreativeModeTab> ORES_TAB = CREATIVE_MODE_TABS.register("ores_tab",
() -> CreativeModeTab.builder().icon(() -> new ItemStack(ModItems.PlutoSteel.get()))
.title(Component.translatable("creativetab.sv.ore_tab_thing_ig"))
.displayItems((pParameters, pOutput) -> {
pOutput.accept(ModItems.PlutoSteel.get());
})
.build());


public static void register(IEventBus eventBus) {
CREATIVE_MODE_TABS.register(eventBus);
}
}
3 changes: 2 additions & 1 deletion src/main/resources/assets/silentvalkyrie/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"item.silentvalkyrie.plutosteel": "PlutoSteel"
"item.silentvalkyrie.plutosteel": "PlutoSteel",
"creativetab.sv.ore_tab_thing_ig": "Ores IG"
}

0 comments on commit df3867e

Please sign in to comment.