From a6a3bfa6f313adba5afe6eb4a0da049a8d641cfc Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Fri, 5 Jun 2015 01:53:14 +0100 Subject: Stuff! --- .../darkknight/jewelrycraft/thirdparty/Alpaca.java | 27 ++ .../darkknight/jewelrycraft/thirdparty/EE3.java | 84 +++--- .../darkknight/jewelrycraft/thirdparty/ModIds.java | 55 ++-- .../jewelrycraft/thirdparty/ThirdPartyManager.java | 287 +++++++++++---------- 4 files changed, 243 insertions(+), 210 deletions(-) create mode 100644 src/main/java/darkknight/jewelrycraft/thirdparty/Alpaca.java (limited to 'src/main/java/darkknight/jewelrycraft/thirdparty') diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/Alpaca.java b/src/main/java/darkknight/jewelrycraft/thirdparty/Alpaca.java new file mode 100644 index 0000000..09f96b3 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/Alpaca.java @@ -0,0 +1,27 @@ +package darkknight.jewelrycraft.thirdparty; + +/** + * @author Sorin + */ +public class Alpaca implements IThirdParty +{ + @Override + public void preInit() + {} + + @Override + public void init() + {} + + @Override + public void postInit() + {} + + @Override + public void clientSide() + {} + + @Override + public void clientInit() + {} +} diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/EE3.java b/src/main/java/darkknight/jewelrycraft/thirdparty/EE3.java index 76770b7..7a8a331 100644 --- a/src/main/java/darkknight/jewelrycraft/thirdparty/EE3.java +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/EE3.java @@ -1,41 +1,45 @@ -package darkknight.jewelrycraft.thirdparty; - -import net.minecraft.item.ItemStack; -import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy; -import darkknight.jewelrycraft.block.BlockCrystal; -import darkknight.jewelrycraft.block.BlockList; -import darkknight.jewelrycraft.item.ItemClayMolds; -import darkknight.jewelrycraft.item.ItemList; -import darkknight.jewelrycraft.item.ItemMolds; - -public class EE3 implements IThirdParty -{ - @Override - public void preInit() - {} - - @Override - public void init() - {} - - @Override - public void postInit() - { - EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.shadowOre), 4096); - EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.shadowBlock), 36864); - EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.shadowIngot), 4096); - EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.jewelCraftingTable), 16640); - EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.guide), 288); - for(int i = 0; i < ItemClayMolds.moldsItemNames.length; i++) EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.clayMolds, 1, i), 128); - for(int i = 0; i < ItemMolds.moldsItemNames.length; i++) EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.molds, 1, i), 128); - for(int i = 0; i < BlockCrystal.colors.length; i++) EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.crystal, 1, i), 64); - } - - @Override - public void clientSide() - {} - - @Override - public void clientInit() - {} +package darkknight.jewelrycraft.thirdparty; + +import net.minecraft.item.ItemStack; +import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy; +import com.pahimar.ee3.init.ModItems; +import com.pahimar.ee3.reference.Names; +import darkknight.jewelrycraft.block.BlockCrystal; +import darkknight.jewelrycraft.block.BlockList; +import darkknight.jewelrycraft.item.ItemClayMolds; +import darkknight.jewelrycraft.item.ItemList; +import darkknight.jewelrycraft.item.ItemMolds; +import darkknight.jewelrycraft.util.JewelrycraftUtil; + +public class EE3 implements IThirdParty +{ + @Override + public void preInit() + {} + + @Override + public void init() + {} + + @Override + public void postInit() + { + EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.shadowOre), 4096); + EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.shadowBlock), 36864); + EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.shadowIngot), 4096); + EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.jewelCraftingTable), 16640); + EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.guide), 288); + for(int i = 0; i < ItemClayMolds.moldsItemNames.length; i++) EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.clayMolds, 1, i), 128); + for(int i = 0; i < ItemMolds.moldsItemNames.length; i++) EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(ItemList.molds, 1, i), 128); + for(int i = 0; i < BlockCrystal.colors.length; i++) EnergyValueRegistryProxy.addPostAssignedEnergyValue(new ItemStack(BlockList.crystal, 1, i), 64); + for(int i = 0; i < Names.Items.GEM_SUBTYPES.length; i++) JewelrycraftUtil.gem.add(new ItemStack(ModItems.gem, 1, i)); + } + + @Override + public void clientSide() + {} + + @Override + public void clientInit() + {} } \ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/ModIds.java b/src/main/java/darkknight/jewelrycraft/thirdparty/ModIds.java index 61fcf99..b4a64c9 100644 --- a/src/main/java/darkknight/jewelrycraft/thirdparty/ModIds.java +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/ModIds.java @@ -1,28 +1,29 @@ -package darkknight.jewelrycraft.thirdparty; - -/** - * @author MineMarteen from Pneumaticraft - */ -public class ModIds{ - public static final String BUILDCRAFT = "BuildCraft|Core"; - public static final String COMPUTERCRAFT = "ComputerCraft"; - public static final String INDUSTRIALCRAFT = "IC2"; - public static final String IGWMOD = "IGWMod"; - public static final String FMP = "ForgeMultipart"; - public static final String WAILA = "Waila"; - public static final String TE = "ThermalExpansion"; - public static final String HC = "HydCraft"; - public static final String NEI = "NotEnoughItems"; - public static final String THAUMCRAFT = "Thaumcraft"; - public static final String BLOOD_MAGIC = "AWWayofTime"; - public static final String AE2 = "appliedenergistics2"; - public static final String CHISEL = "chisel"; - public static final String FORESTRY = "Forestry"; - public static final String MFR = "MineFactoryReloaded"; - public static final String OPEN_BLOCKS = "OpenBlocks"; - public static final String COFH_CORE = "CoFHCore"; - public static final String NOT_ENOUGH_KEYS = "notenoughkeys"; - public static final String OPEN_COMPUTERS = "OpenComputers|Core"; - public static final String EE3 = "EE3"; - public static final String PENUMATICRAFT = "PneumaticCraft"; +package darkknight.jewelrycraft.thirdparty; + +/** + * @author MineMarteen from Pneumaticraft + */ +public class ModIds{ + public static final String BUILDCRAFT = "BuildCraft|Core"; + public static final String COMPUTERCRAFT = "ComputerCraft"; + public static final String INDUSTRIALCRAFT = "IC2"; + public static final String IGWMOD = "IGWMod"; + public static final String FMP = "ForgeMultipart"; + public static final String WAILA = "Waila"; + public static final String TE = "ThermalExpansion"; + public static final String HC = "HydCraft"; + public static final String NEI = "NotEnoughItems"; + public static final String THAUMCRAFT = "Thaumcraft"; + public static final String BLOOD_MAGIC = "AWWayofTime"; + public static final String AE2 = "appliedenergistics2"; + public static final String CHISEL = "chisel"; + public static final String FORESTRY = "Forestry"; + public static final String MFR = "MineFactoryReloaded"; + public static final String OPEN_BLOCKS = "OpenBlocks"; + public static final String COFH_CORE = "CoFHCore"; + public static final String NOT_ENOUGH_KEYS = "notenoughkeys"; + public static final String OPEN_COMPUTERS = "OpenComputers|Core"; + public static final String EE3 = "EE3"; + public static final String PENUMATICRAFT = "PneumaticCraft"; + public static final String ALPACA = "alpaca"; } \ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/thirdparty/ThirdPartyManager.java b/src/main/java/darkknight/jewelrycraft/thirdparty/ThirdPartyManager.java index 5bc45b6..c2808f9 100644 --- a/src/main/java/darkknight/jewelrycraft/thirdparty/ThirdPartyManager.java +++ b/src/main/java/darkknight/jewelrycraft/thirdparty/ThirdPartyManager.java @@ -1,144 +1,145 @@ -package darkknight.jewelrycraft.thirdparty; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.world.World; -import cpw.mods.fml.common.Loader; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.network.IGuiHandler; -import darkknight.jewelrycraft.JewelrycraftMod; -import darkknight.jewelrycraft.config.ConfigHandler; - -/** - * @author MineMarteen from Pneumaticraft - */ -public class ThirdPartyManager implements IGuiHandler{ - - private static ThirdPartyManager INSTANCE = new ThirdPartyManager(); - private final List thirdPartyMods = new ArrayList(); - - public static ThirdPartyManager instance(){ - return INSTANCE; - } - - public void index(){ - Map> thirdPartyClasses = new HashMap>(); - thirdPartyClasses.put(ModIds.EE3, EE3.class); - - List enabledThirdParty = new ArrayList(); - ConfigHandler.config.addCustomCategoryComment("third_party_enabling", "With these options you can disable third party content by mod. Useful if something in the mod changes and causes crashes."); - for(String modid : thirdPartyClasses.keySet()) { - if(ConfigHandler.config.get("Third_Party_Enabling", modid, true).getBoolean()) { - enabledThirdParty.add(modid); - } - } - ConfigHandler.config.save(); - - for(Map.Entry> entry : thirdPartyClasses.entrySet()) { - if(enabledThirdParty.contains(entry.getKey()) && Loader.isModLoaded(entry.getKey())) { - try { - thirdPartyMods.add(entry.getValue().newInstance()); - } catch(Exception e) { - JewelrycraftMod.logger.log(Level.SEVERE, "Failed to instantiate third party handler!"); - e.printStackTrace(); - } - } - } - } - - public void onItemRegistry(Item item){ - for(IThirdParty thirdParty : thirdPartyMods) { - if(thirdParty instanceof IRegistryListener) ((IRegistryListener)thirdParty).onItemRegistry(item); - } - } - - public void onBlockRegistry(Block block){ - for(IThirdParty thirdParty : thirdPartyMods) { - if(thirdParty instanceof IRegistryListener) ((IRegistryListener)thirdParty).onBlockRegistry(block); - } - } - - public void preInit(){ - for(IThirdParty thirdParty : thirdPartyMods) { - try { - thirdParty.preInit(); - } catch(Throwable e) { - JewelrycraftMod.logger.log(Level.SEVERE, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " in the PreInit phase!"); - e.printStackTrace(); - } - } - } - - public void init(){ - for(IThirdParty thirdParty : thirdPartyMods) { - try { - thirdParty.init(); - } catch(Throwable e) { - JewelrycraftMod.logger.log(Level.SEVERE, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " in the Init phase!"); - e.printStackTrace(); - } - } - } - - public void postInit(){ - for(IThirdParty thirdParty : thirdPartyMods) { - try { - thirdParty.postInit(); - } catch(Throwable e) { - JewelrycraftMod.logger.log(Level.SEVERE, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " in the PostInit phase!"); - e.printStackTrace(); - } - } - } - - public void clientSide(){ - for(IThirdParty thirdParty : thirdPartyMods) { - try { - thirdParty.clientSide(); - } catch(Throwable e) { - JewelrycraftMod.logger.log(Level.SEVERE, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " client side!"); - e.printStackTrace(); - } - } - } - - public void clientInit(){ - for(IThirdParty thirdParty : thirdPartyMods) { - try { - thirdParty.clientInit(); - } catch(Throwable e) { - JewelrycraftMod.logger.log(Level.SEVERE, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " client side on the init!"); - e.printStackTrace(); - } - } - } - - @Override - public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z){ - for(IThirdParty thirdParty : thirdPartyMods) { - if(thirdParty instanceof IGuiHandler) { - Object obj = ((IGuiHandler)thirdParty).getServerGuiElement(ID, player, world, x, y, z); - if(obj != null) return obj; - } - } - return null; - } - - @Override - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z){ - for(IThirdParty thirdParty : thirdPartyMods) { - if(thirdParty instanceof IGuiHandler) { - Object obj = ((IGuiHandler)thirdParty).getClientGuiElement(ID, player, world, x, y, z); - if(obj != null) return obj; - } - } - return null; - } - +package darkknight.jewelrycraft.thirdparty; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.world.World; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.network.IGuiHandler; +import darkknight.jewelrycraft.JewelrycraftMod; +import darkknight.jewelrycraft.config.ConfigHandler; + +/** + * @author MineMarteen from Pneumaticraft + */ +public class ThirdPartyManager implements IGuiHandler{ + + private static ThirdPartyManager INSTANCE = new ThirdPartyManager(); + private final List thirdPartyMods = new ArrayList(); + + public static ThirdPartyManager instance(){ + return INSTANCE; + } + + public void index(){ + Map> thirdPartyClasses = new HashMap>(); + thirdPartyClasses.put(ModIds.EE3, EE3.class); + thirdPartyClasses.put(ModIds.ALPACA, Alpaca.class); + + List enabledThirdParty = new ArrayList(); + ConfigHandler.config.addCustomCategoryComment("third_party_enabling", "With these options you can disable third party content by mod. Useful if something in the mod changes and causes crashes."); + for(String modid : thirdPartyClasses.keySet()) { + if(ConfigHandler.config.get("Third_Party_Enabling", modid, true).getBoolean()) { + enabledThirdParty.add(modid); + } + } + ConfigHandler.config.save(); + + for(Map.Entry> entry : thirdPartyClasses.entrySet()) { + if(enabledThirdParty.contains(entry.getKey()) && Loader.isModLoaded(entry.getKey())) { + try { + thirdPartyMods.add(entry.getValue().newInstance()); + } catch(Exception e) { + JewelrycraftMod.logger.log(Level.SEVERE, "Failed to instantiate third party handler!"); + e.printStackTrace(); + } + } + } + } + + public void onItemRegistry(Item item){ + for(IThirdParty thirdParty : thirdPartyMods) { + if(thirdParty instanceof IRegistryListener) ((IRegistryListener)thirdParty).onItemRegistry(item); + } + } + + public void onBlockRegistry(Block block){ + for(IThirdParty thirdParty : thirdPartyMods) { + if(thirdParty instanceof IRegistryListener) ((IRegistryListener)thirdParty).onBlockRegistry(block); + } + } + + public void preInit(){ + for(IThirdParty thirdParty : thirdPartyMods) { + try { + thirdParty.preInit(); + } catch(Throwable e) { + JewelrycraftMod.logger.log(Level.SEVERE, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " in the PreInit phase!"); + e.printStackTrace(); + } + } + } + + public void init(){ + for(IThirdParty thirdParty : thirdPartyMods) { + try { + thirdParty.init(); + } catch(Throwable e) { + JewelrycraftMod.logger.log(Level.SEVERE, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " in the Init phase!"); + e.printStackTrace(); + } + } + } + + public void postInit(){ + for(IThirdParty thirdParty : thirdPartyMods) { + try { + thirdParty.postInit(); + } catch(Throwable e) { + JewelrycraftMod.logger.log(Level.SEVERE, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " in the PostInit phase!"); + e.printStackTrace(); + } + } + } + + public void clientSide(){ + for(IThirdParty thirdParty : thirdPartyMods) { + try { + thirdParty.clientSide(); + } catch(Throwable e) { + JewelrycraftMod.logger.log(Level.SEVERE, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " client side!"); + e.printStackTrace(); + } + } + } + + public void clientInit(){ + for(IThirdParty thirdParty : thirdPartyMods) { + try { + thirdParty.clientInit(); + } catch(Throwable e) { + JewelrycraftMod.logger.log(Level.SEVERE, "Jewelrycraft wasn't able to load third party content from the third party class " + thirdParty.getClass() + " client side on the init!"); + e.printStackTrace(); + } + } + } + + @Override + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z){ + for(IThirdParty thirdParty : thirdPartyMods) { + if(thirdParty instanceof IGuiHandler) { + Object obj = ((IGuiHandler)thirdParty).getServerGuiElement(ID, player, world, x, y, z); + if(obj != null) return obj; + } + } + return null; + } + + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z){ + for(IThirdParty thirdParty : thirdPartyMods) { + if(thirdParty instanceof IGuiHandler) { + Object obj = ((IGuiHandler)thirdParty).getClientGuiElement(ID, player, world, x, y, z); + if(obj != null) return obj; + } + } + return null; + } + } \ No newline at end of file -- cgit v1.2.3