Skip to content

Commit

Permalink
Added Ancient Tab
Browse files Browse the repository at this point in the history
Added Obsidian Lantern item entry
Added temp texture for obsidian lantern
Added en_us translation file
Folder structure setup
Mod properties setup
  • Loading branch information
VaasKahnGrim committed Jun 22, 2023
1 parent 93db0a4 commit 5bcbeca
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package net.lord_of_owls.ancientcityenhancement;

import com.mojang.logging.LogUtils;
import net.lord_of_owls.ancientcityenhancement.item.ModCreativeModeTabs;
import net.lord_of_owls.ancientcityenhancement.item.ModItems;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
Expand All @@ -13,17 +14,18 @@
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.slf4j.Logger;

// The value here should match an entry in the META-INF/mods.toml file
@Mod(AncientCityEnhancement.MOD_ID)
public class AncientCityEnhancement {
// Define mod id in a common place for everything to reference
public static final String MOD_ID = "ancientcityenhancement";
// Directly reference a slf4j logger
private static final Logger LOGGER = LogUtils.getLogger();

public AncientCityEnhancement() {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();

ModCreativeModeTabs.register( modEventBus );

ModItems.register( modEventBus );

modEventBus.addListener( this::commonSetup );
MinecraftForge.EVENT_BUS.register( this );

Expand All @@ -32,14 +34,12 @@ public AncientCityEnhancement() {

private void commonSetup( final FMLCommonSetupEvent event ) {}

// Add the example block item to the building blocks tab
private void addCreative( BuildCreativeModeTabContentsEvent event ) {}

// You can use SubscribeEvent and let the Event Bus discover methods to call
@SubscribeEvent
public void onServerStarting( ServerStartingEvent event ) {}
private void addCreative( BuildCreativeModeTabContentsEvent event ) {
if ( event.getTab() == ModCreativeModeTabs.ANCIENT_TAB.get() ) {
event.accept(ModItems.OBSIDIAN_LANTERN);
}
}

// You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent
@Mod.EventBusSubscriber( modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT )
public static class ClientModEvents {
@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package net.lord_of_owls.ancientcityenhancement.item;

import net.lord_of_owls.ancientcityenhancement.AncientCityEnhancement;
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.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;

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

public static RegistryObject<CreativeModeTab> ANCIENT_TAB = CREATIVE_MODE_TABS.register( "ancient_tab", () -> CreativeModeTab.builder().icon( () -> new ItemStack( ModItems.OBSIDIAN_LANTERN.get() ) ).title( Component.translatable("creativemodetab.ancient_tab") ).build() );

public static void register( IEventBus eventBus ) {
CREATIVE_MODE_TABS.register( eventBus );
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.lord_of_owls.ancientcityenhancement.item;

import net.lord_of_owls.ancientcityenhancement.AncientCityEnhancement;
import net.minecraft.world.item.Item;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

public class ModItems {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create( ForgeRegistries.ITEMS, AncientCityEnhancement.MOD_ID );

public static final RegistryObject<Item> OBSIDIAN_LANTERN = ITEMS.register( "obsidian_lantern", () -> new Item( new Item.Properties() ) );


public static void register( IEventBus eventBus ) {
ITEMS.register( eventBus );
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"item.ancientcityenhancement.obsidian_lantern": "Obsidian Lantern",
"creativemodetab.ancient_tab": "Ancient Tab"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "ancientcityenhancement:item/obsidian_lantern"
}
}

0 comments on commit 5bcbeca

Please sign in to comment.