1- package com .example . examplemod ;
1+ package com .neofastftl . infinitypattern ;
22
3+ import appeng .api .ids .AEItemIds ;
4+ import appeng .core .AppEng ;
5+ import appeng .core .definitions .ItemDefinition ;
6+ import appeng .items .materials .MaterialItem ;
7+ import com .neofastftl .infinitypattern .item .ItemInfinityPattern ;
38import org .slf4j .Logger ;
49
510import com .mojang .logging .LogUtils ;
3439import net .neoforged .neoforge .registries .DeferredItem ;
3540import net .neoforged .neoforge .registries .DeferredRegister ;
3641
42+ import java .util .ArrayList ;
43+ import java .util .List ;
44+
45+ import static net .minecraft .world .item .Items .registerItem ;
46+
3747// The value here should match an entry in the META-INF/neoforge.mods.toml file
38- @ Mod (ExampleMod .MODID )
39- public class ExampleMod
48+ @ Mod (InfinityPattern .MODID )
49+ public class InfinityPattern
4050{
4151 // Define mod id in a common place for everything to reference
42- public static final String MODID = "examplemod " ;
52+ public static final String MODID = "infinitypattern " ;
4353 // Directly reference a slf4j logger
4454 private static final Logger LOGGER = LogUtils .getLogger ();
4555 // Create a Deferred Register to hold Blocks which will all be registered under the "examplemod" namespace
46- public static final DeferredRegister .Blocks BLOCKS = DeferredRegister .createBlocks (MODID );
47- // Create a Deferred Register to hold Items which will all be registered under the "examplemod" namespace
48- public static final DeferredRegister .Items ITEMS = DeferredRegister .createItems (MODID );
56+ public static final DeferredRegister .Items ITEMS = DeferredRegister .createItems (InfinityPattern .MODID );
4957 // Create a Deferred Register to hold CreativeModeTabs which will all be registered under the "examplemod" namespace
5058 public static final DeferredRegister <CreativeModeTab > CREATIVE_MODE_TABS = DeferredRegister .create (Registries .CREATIVE_MODE_TAB , MODID );
5159
52- // Creates a new Block with the id "examplemod:example_block", combining the namespace and path
53- public static final DeferredBlock <Block > EXAMPLE_BLOCK = BLOCKS .registerSimpleBlock ("example_block" , BlockBehaviour .Properties .of ().mapColor (MapColor .STONE ));
54- // Creates a new BlockItem with the id "examplemod:example_block", combining the namespace and path
55- public static final DeferredItem <BlockItem > EXAMPLE_BLOCK_ITEM = ITEMS .registerSimpleBlockItem ("example_block" , EXAMPLE_BLOCK );
56-
5760 // Creates a new food item with the id "examplemod:example_id", nutrition 1 and saturation 2
58- public static final DeferredItem <Item > EXAMPLE_ITEM = ITEMS .registerSimpleItem ("example_item" , new Item .Properties ().food (new FoodProperties .Builder ()
59- .alwaysEdible ().nutrition (1 ).saturationModifier (2f ).build ()));
61+
62+ public static final DeferredItem <Item > ITEM_INFINITYPATTERN = ITEMS .register ("item_infinitypattern" ,
63+ () -> new ItemInfinityPattern (new Item .Properties ()));
6064
6165 // Creates a creative tab with the id "examplemod:example_tab" for the example item, that is placed after the combat tab
62- public static final DeferredHolder <CreativeModeTab , CreativeModeTab > EXAMPLE_TAB = CREATIVE_MODE_TABS .register ("example_tab " , () -> CreativeModeTab .builder ()
63- .title (Component .translatable ("itemGroup.examplemod " )) //The language key for the title of your CreativeModeTab
66+ public static final DeferredHolder <CreativeModeTab , CreativeModeTab > INFINITY_PATTERN = CREATIVE_MODE_TABS .register ("infinitypattern " , () -> CreativeModeTab .builder ()
67+ .title (Component .translatable ("itemGroup.infinitypattern " )) //The language key for the title of your CreativeModeTab
6468 .withTabsBefore (CreativeModeTabs .COMBAT )
65- .icon (() -> EXAMPLE_ITEM .get ().getDefaultInstance ())
69+ .icon (() -> ITEM_INFINITYPATTERN .get ().getDefaultInstance ())
6670 .displayItems ((parameters , output ) -> {
67- output .accept (EXAMPLE_ITEM .get ()); // Add the example item to the tab. For your own tabs, this method is preferred over the event
71+ output .accept (ITEM_INFINITYPATTERN .get ()); // Add the example item to the tab. For your own tabs, this method is preferred over the event
6872 }).build ());
6973
7074 // The constructor for the mod class is the first code that is run when your mod is loaded.
7175 // FML will recognize some parameter types like IEventBus or ModContainer and pass them in automatically.
72- public ExampleMod (IEventBus modEventBus , ModContainer modContainer )
76+ public InfinityPattern (IEventBus modEventBus , ModContainer modContainer )
7377 {
7478 // Register the commonSetup method for modloading
7579 modEventBus .addListener (this ::commonSetup );
7680
77- // Register the Deferred Register to the mod event bus so blocks get registered
78- BLOCKS .register (modEventBus );
7981 // Register the Deferred Register to the mod event bus so items get registered
8082 ITEMS .register (modEventBus );
8183 // Register the Deferred Register to the mod event bus so tabs get registered
@@ -86,9 +88,6 @@ public ExampleMod(IEventBus modEventBus, ModContainer modContainer)
8688 // Do not add this line if there are no @SubscribeEvent-annotated functions in this class, like onServerStarting() below.
8789 NeoForge .EVENT_BUS .register (this );
8890
89- // Register the item to a creative tab
90- modEventBus .addListener (this ::addCreative );
91-
9291 // Register our mod's ModConfigSpec so that FML can create and load the config file for us
9392 modContainer .registerConfig (ModConfig .Type .COMMON , Config .SPEC );
9493 }
@@ -106,13 +105,6 @@ private void commonSetup(final FMLCommonSetupEvent event)
106105 Config .items .forEach ((item ) -> LOGGER .info ("ITEM >> {}" , item .toString ()));
107106 }
108107
109- // Add the example block item to the building blocks tab
110- private void addCreative (BuildCreativeModeTabContentsEvent event )
111- {
112- if (event .getTabKey () == CreativeModeTabs .BUILDING_BLOCKS )
113- event .accept (EXAMPLE_BLOCK_ITEM );
114- }
115-
116108 // You can use SubscribeEvent and let the Event Bus discover methods to call
117109 @ SubscribeEvent
118110 public void onServerStarting (ServerStartingEvent event )
0 commit comments