From 4f7ad220df0438b6f3382110577b53f29da46453 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 24 May 2018 15:50:07 -0400 Subject: Update of all changes --- .../darkknight/jewelrycraft/JewelrycraftMod.java | 245 ++++++++++++--------- 1 file changed, 146 insertions(+), 99 deletions(-) mode change 100644 => 100755 src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java (limited to 'src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java') diff --git a/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java b/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java old mode 100644 new mode 100755 index 653918d..574d163 --- a/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java +++ b/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java @@ -1,14 +1,15 @@ /* - * Mod made by DarkKnight during the Modjam 3 - * It's an awesome mod - * I love me! :D + * Mod made by DarkKnight during the Modjam 3 It's an awesome mod I love + * me! :D */ package darkknight.jewelrycraft; import java.io.File; import java.io.IOException; + import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Logger; + import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; @@ -18,6 +19,7 @@ import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import darkknight.jewelrycraft.achievements.AchievementsList; import darkknight.jewelrycraft.block.BlockList; @@ -32,106 +34,151 @@ import darkknight.jewelrycraft.potions.PotionList; import darkknight.jewelrycraft.proxy.CommonProxy; import darkknight.jewelrycraft.recipes.CraftingRecipes; import darkknight.jewelrycraft.thirdparty.ThirdPartyManager; +import darkknight.jewelrycraft.util.JewelrycraftUtil; import darkknight.jewelrycraft.util.Variables; import darkknight.jewelrycraft.worldGen.ChestGeneration; import darkknight.jewelrycraft.worldGen.village.VillageHandler; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent; + +@Mod(modid = Variables.MODID, name = Variables.MODNAME, + version = Variables.VERSION, guiFactory = Variables.CONFIG_GUI, + acceptedMinecraftVersions = "[1.7.10,1.8)") +public class JewelrycraftMod { + private static final class CreativeTabJewleryCraft + extends CreativeTabs { + private CreativeTabJewleryCraft(String lable) { + super(lable); + } + + @Override + public Item getTabIconItem() { + return Item.getItemFromBlock(BlockList.jewelCraftingTable); + } + } + + @Instance(Variables.MODID) + public static JewelrycraftMod instance; + + @SidedProxy(clientSide = Variables.CLIENT_PROXY, + serverSide = Variables.SERVER_PROXY) + public static CommonProxy proxy; + + public static Logger logger; + + public static File dir; + + public static CreativeTabs jewelrycraft = + new CreativeTabJewleryCraft(Variables.MODID); + public static CreativeTabs liquids = + new CreativeTabLiquids("Liquids") + .setBackgroundImageName("item_search.png"); + + public static SimpleNetworkWrapper netWrapper; + + public static boolean fancyRender = false; + + /** + * Pre initialization of mod stuff. + * + * @param e + * FMLPreInitializationEvent + * @throws IOException + * Signals that an I/O exception has occurred. + */ + @EventHandler + public void preInit(FMLPreInitializationEvent e) throws IOException { + dir = e.getModConfigurationDirectory(); + logger = e.getModLog(); + ConfigHandler.INSTANCE.loadConfig(e); + ThirdPartyManager.instance().index(); + logger.log(Level.INFO, "Registering Blocks"); + BlockList.preInit(e); + logger.log(Level.INFO, "Registering Items"); + ItemList.preInit(e); + logger.log(Level.INFO, "Registering Crafting Recipes"); + CraftingRecipes.preInit(e); + logger.log(Level.INFO, "Registering Curses"); + CurseList.preInit(e); + logger.log(Level.INFO, "Registering Packets"); + PacketHandler.preInit(e); + logger.log(Level.INFO, "Registering Entities"); + EntityList.preInit(e); + logger.log(Level.INFO, "Registering Village Stuff"); + VillageHandler.preInit(e); + logger.log(Level.INFO, "Registering Events"); + EventList.preInit(e); + logger.log(Level.INFO, "Registering Potions"); + PotionList.preInit(e); + logger.log(Level.INFO, "Loading Third Party Mods"); + ThirdPartyManager.instance().preInit(); + logger.log(Level.INFO, "Adding Dungeons loot"); + ChestGeneration.preInit(e); + + MinecraftForge.EVENT_BUS.register(this); + } + + @EventHandler + public void init(FMLInitializationEvent e) { + logger.log(Level.INFO, "Registering Events"); + EventList.init(e); + logger.log(Level.INFO, "Registering Potions"); + PotionList.init(e); + logger.log(Level.INFO, "Loading Third Party Mods"); + ThirdPartyManager.instance().init(); + FMLInterModComms.sendMessage("Waila", "register", + "darkknight.jewelrycraft.thirdparty.WailaHandler.registration"); + } + + @EventHandler + public void postInit(FMLPostInitializationEvent e) { + logger.log(Level.INFO, "Loading Third Party Mods"); + ThirdPartyManager.instance().postInit(); + logger.log(Level.INFO, "Registering Events"); + EventList.postInit(e); + logger.log(Level.INFO, "Registering Potions"); + PotionList.postInit(e); + logger.log(Level.INFO, "Registering Achievements"); + AchievementsList.addAchievements(); + } + + @EventHandler + public void serverLoad(FMLServerStartingEvent event) { + event.registerServerCommand(new JewelrycraftCommands()); + } -@Mod (modid = Variables.MODID, name = Variables.MODNAME, version = Variables.VERSION, guiFactory = Variables.CONFIG_GUI, acceptedMinecraftVersions = "[1.7.10,1.8)") -public class JewelrycraftMod -{ - @Instance (Variables.MODID) - public static JewelrycraftMod instance; - @SidedProxy (clientSide = Variables.CLIENT_PROXY, serverSide = Variables.SERVER_PROXY) - public static CommonProxy proxy; - public static Logger logger; - public static File dir; - public static CreativeTabs jewelrycraft = new CreativeTabs(Variables.MODID){ - @Override - public Item getTabIconItem() - { - return Item.getItemFromBlock(BlockList.jewelCraftingTable); - } - }; - public static CreativeTabs liquids = new CreativeTabLiquids("Liquids").setBackgroundImageName("item_search.png"); - public static SimpleNetworkWrapper netWrapper; - public static boolean fancyRender = false; - - /** - * Pre initialization of mod stuff. - * - * @param e FMLPreInitializationEvent - * @throws IOException Signals that an I/O exception has occurred. - */ - @EventHandler - public void preInit(FMLPreInitializationEvent e) throws IOException - { - dir = e.getModConfigurationDirectory(); - logger = e.getModLog(); - ConfigHandler.INSTANCE.loadConfig(e); - ThirdPartyManager.instance().index(); - logger.log(Level.INFO, "Registering Blocks"); - BlockList.preInit(e); - logger.log(Level.INFO, "Registering Items"); - ItemList.preInit(e); - logger.log(Level.INFO, "Registering Crafting Recipes"); - CraftingRecipes.preInit(e); - logger.log(Level.INFO, "Registering Curses"); - CurseList.preInit(e); - logger.log(Level.INFO, "Registering Packets"); - PacketHandler.preInit(e); - logger.log(Level.INFO, "Registering Entities"); - EntityList.preInit(e); - logger.log(Level.INFO, "Registering Village Stuff"); - VillageHandler.preInit(e); - logger.log(Level.INFO, "Registering Events"); - EventList.preInit(e); - logger.log(Level.INFO, "Registering Potions"); - PotionList.preInit(e); - logger.log(Level.INFO, "Loading Third Party Mods"); - ThirdPartyManager.instance().preInit(); - logger.log(Level.INFO, "Adding Dungeons loot"); - ChestGeneration.preInit(e); - } - - @EventHandler - public void init(FMLInitializationEvent e) - { - logger.log(Level.INFO, "Registering Events"); - EventList.init(e); - logger.log(Level.INFO, "Registering Potions"); - PotionList.init(e); - logger.log(Level.INFO, "Loading Third Party Mods"); - ThirdPartyManager.instance().init(); - FMLInterModComms.sendMessage("Waila", "register", "darkknight.jewelrycraft.thirdparty.WailaHandler.registration"); - } - - @EventHandler - public void postInit(FMLPostInitializationEvent e) - { - logger.log(Level.INFO, "Loading Third Party Mods"); - ThirdPartyManager.instance().postInit(); - logger.log(Level.INFO, "Registering Events"); - EventList.postInit(e); - logger.log(Level.INFO, "Registering Potions"); - PotionList.postInit(e); - logger.log(Level.INFO, "Registering Achievements"); - AchievementsList.addAchievements(); - } - - @EventHandler - public void serverLoad(FMLServerStartingEvent event) - { - event.registerServerCommand(new JewelrycraftCommands()); - } - - @EventHandler - public void imcCallback(FMLInterModComms.IMCEvent event) - { - for (final FMLInterModComms.IMCMessage imcMessage : event.getMessages()) - { - logger.info("The mod " + imcMessage.getSender() + " has sent the following message: " + imcMessage.getStringValue()); - } - } + @EventHandler + public void imcCallback(FMLInterModComms.IMCEvent event) { + for (final FMLInterModComms.IMCMessage imcMessage : event + .getMessages()) { + logger.info("The mod " + imcMessage.getSender() + + " has sent the following message: " + + imcMessage.getStringValue()); + } + } + + @SubscribeEvent + public void oredictRegistered(OreRegisterEvent orev) { + if(orev.Name.startsWith("ingot") || orev.Name.startsWith("alloy")) { + if(!JewelrycraftUtil.metal.contains(orev.Ore)) { + JewelrycraftUtil.metal.add(orev.Ore); + } + } + + if(orev.Name.startsWith("ore")) { + if(!JewelrycraftUtil.ores.contains(orev.Ore)) { + JewelrycraftUtil.metal.add(orev.Ore); + } + + ItemStack ingot = FurnaceRecipes.smelting().getSmeltingResult(orev.Ore); + + if(ingot != null) { + JewelrycraftUtil.oreToIngot.put(orev.Ore, ingot); + } + } + } } -- cgit v1.2.3