blah blah blah insert commit name
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package xyz.sillyangel.tutorialmod;
|
package xyz.sillyangel.tutorialmod;
|
||||||
|
|
||||||
import com.mojang.logging.LogUtils;
|
import com.mojang.logging.LogUtils;
|
||||||
|
import net.minecraft.world.item.CreativeModeTabs;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
|
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
|
||||||
@@ -14,6 +15,7 @@ import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
|||||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import xyz.sillyangel.tutorialmod.item.ModItems;
|
||||||
|
|
||||||
// Very important Comment
|
// Very important Comment
|
||||||
// The value here should match an entry in the META-INF/mods.toml file
|
// The value here should match an entry in the META-INF/mods.toml file
|
||||||
@@ -30,7 +32,7 @@ public class TutorialMod {
|
|||||||
// Register ourselves for server and other game events we are interested in
|
// Register ourselves for server and other game events we are interested in
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
|
||||||
|
ModItems.register(modEventBus);
|
||||||
|
|
||||||
// Register the item to a creative tab
|
// Register the item to a creative tab
|
||||||
modEventBus.addListener(this::addCreative);
|
modEventBus.addListener(this::addCreative);
|
||||||
@@ -44,7 +46,9 @@ public class TutorialMod {
|
|||||||
|
|
||||||
// Add the example block item to the building blocks tab
|
// Add the example block item to the building blocks tab
|
||||||
private void addCreative(BuildCreativeModeTabContentsEvent event) {
|
private void addCreative(BuildCreativeModeTabContentsEvent event) {
|
||||||
|
if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) {
|
||||||
|
event.accept(ModItems.NUGGET);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// You can use SubscribeEvent and let the Event Bus discover methods to call
|
// You can use SubscribeEvent and let the Event Bus discover methods to call
|
||||||
|
|||||||
23
src/main/java/xyz/sillyangel/tutorialmod/item/ModItems.java
Normal file
23
src/main/java/xyz/sillyangel/tutorialmod/item/ModItems.java
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package xyz.sillyangel.tutorialmod.item;
|
||||||
|
|
||||||
|
import xyz.sillyangel.tutorialmod.TutorialMod;
|
||||||
|
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, TutorialMod.MOD_ID);
|
||||||
|
|
||||||
|
public static final RegistryObject<Item> NUGGET = ITEMS.register("nugget",
|
||||||
|
() -> new Item(new Item.Properties()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void register(IEventBus eventBus) {
|
||||||
|
ITEMS.register(eventBus);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
3
src/main/resources/assets/tutorialmod/lang/en_us.json
Normal file
3
src/main/resources/assets/tutorialmod/lang/en_us.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"item.tutorialmod.nugget": "nugget"
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "tutorialmod:item/nugget"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
src/main/resources/assets/tutorialmod/textures/item/nugget.png
Normal file
BIN
src/main/resources/assets/tutorialmod/textures/item/nugget.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
Reference in New Issue
Block a user