Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package com.flash.flashmod;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.swing.*;
/**
* Created by Charles Buffington on 7/6/2017.
*/
@Mod(modid= FlashMod.MODID, name = FlashMod.MODNAME, version = FlashMod.VERSION)
public class FlashMod {
public static final String MODID = "flashmod";
public static final String MODNAME = "THE_FLASH_MOD";
public static final String VERSION = "1.12.0";
public static CreativeTabs flashTab;
@GameRegistry.ObjectHolder("testmod")
public static class ModItems {
}
@Mod.EventHandler
public void PreInit(FMLPreInitializationEvent e){
flashTab = new CreativeTabs("Flash Mod"){
@SideOnly(Side.CLIENT)
public ItemStack getTabIconItem(){
return ItemStack.EMPTY;
}
};}
@Mod.EventHandler
public void init(FMLInitializationEvent e){
}
@Mod.EventBusSubscriber(modid = FlashMod.MODID)
public static class RegistrationHandler {
public static Item dark_banshee;
public static Item flash_sword;
public static ModelResourceLocation modelResourceLocation;
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event) {
event.getRegistry().register(flash_sword=new ItemSword(Item.ToolMaterial.DIAMOND).setCreativeTab(flashTab).setUnlocalizedName("flash_sword").setRegistryName("flashmod","flash_sword"));
event.getRegistry().register(dark_banshee=new Item().setUnlocalizedName("dark_banshee").setRegistryName("flashmod","dark_banshee").setCreativeTab(flashTab));
registerItemModels(ModItems.flash_sword,"inventory");
registerItemModels(ModItems.dark_banshee,"inventory");
}
@SideOnly(Side.CLIENT)
public static void registerItemModels(){
ModelLoader.setCustomModelResourceLocation(dark_banshee,0,modelResourceLocation);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment