Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Vanityblocks;
- import net.minecraft.block.Block;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraftforge.common.Configuration;
- import net.minecraftforge.oredict.OreDictionary;
- import net.minecraftforge.oredict.ShapedOreRecipe;
- import cpw.mods.fml.common.Mod;
- import cpw.mods.fml.common.Mod.Init;
- import cpw.mods.fml.common.Mod.Instance;
- import cpw.mods.fml.common.Mod.PostInit;
- import cpw.mods.fml.common.Mod.PreInit;
- import cpw.mods.fml.common.SidedProxy;
- import cpw.mods.fml.common.event.FMLInitializationEvent;
- import cpw.mods.fml.common.event.FMLPostInitializationEvent;
- import cpw.mods.fml.common.event.FMLPreInitializationEvent;
- import cpw.mods.fml.common.network.NetworkMod;
- import cpw.mods.fml.common.registry.GameRegistry;
- import cpw.mods.fml.common.registry.LanguageRegistry;
- @Mod(modid="Vanityblocks", name="Anarchys Vanity Blocks", version= "0.0.1")
- @NetworkMod(clientSideRequired=true, serverSideRequired=false)
- /*
- TO DO
- add steel stuff
- */
- public class Vanityblocks {
- @Instance("Vanityblocks")
- public static Vanityblocks instance;
- @SidedProxy(clientSide = "Vanityblocks.ProxyClient", serverSide = "Vanityblocks.Proxy")
- public static Proxy proxy;
- public static int lavalampconfig;
- public static int redstoneblockconfig;
- public static int coalblockconfig;
- public static int charcoalblockconfig;
- public static int enderpearlblockconfig;
- public static int tinblockconfig;
- public static int copperblockconfig;
- public static int silverblockconfig;
- public static int leadblockconfig;
- public static int nikoliteblockconfig;
- public static int slimeblockconfig;
- public static Block lavalamp;
- public static Block redstoneblock;
- public static Block coalblock;
- public static Block charcoalblock;
- public static Block enderpearlblock;
- public static Block tinblock;
- public static Block copperblock;
- public static Block silverblock;
- public static Block leadblock;
- public static Block nikoliteblock;
- public static Block slimeblock;
- public static boolean Configflags;
- // public static Logger log = Logger.getLogger("Vanityblocks");
- @PreInit
- public void preInit(FMLPreInitializationEvent event) {
- // nothing required here
- Configuration config = new Configuration(event.getSuggestedConfigurationFile());
- config.load();
- lavalampconfig = config.getBlock("LavaLamp", 3000).getInt();
- redstoneblockconfig = config.getBlock("Redstone Block", 3001).getInt();
- coalblockconfig = config.getBlock("Coal Block", 3002).getInt();
- charcoalblockconfig = config.getBlock("Charcoal Block",3003).getInt();
- enderpearlblockconfig = config.getBlock("Ender Pearl Block",3004).getInt();
- tinblockconfig = config.getBlock("Tin Block",3005).getInt();
- copperblockconfig = config.getBlock("Copper Block",3006).getInt();
- silverblockconfig = config.getBlock("Silver Block",3007).getInt();
- leadblockconfig = config.getBlock("Lead Block",3008).getInt();
- nikoliteblockconfig = config.getBlock("Nikolite Block",3009).getInt();
- slimeblockconfig = config.getBlock("Slime Block",3010).getInt();
- // int randomItemID = config.getItem("Redstone Block", 20000).getInt();
- // Since this flag is a boolean, we can read it into the variable directly from the config.
- Configflags = config.get(Configuration.CATEGORY_GENERAL, "SomeConfigFlag", false).getBoolean(false);
- config.save();
- }
- @Init
- public void load(FMLInitializationEvent event) {
- // proxy.registerRenderInformation();
- lavalamp = new Blocklavalamp(lavalampconfig,0).setBlockName("lavalamp");
- GameRegistry.registerBlock(lavalamp, "Vanitysanarchy_lavalamp");
- LanguageRegistry.addName(lavalamp, "Lava Lamp");
- ItemStack tiningot, copperingot, silveringot, leadingot, nikolite;
- ItemStack blRedstone, blCoal, blCharcoal, blEnderpearl, blTin, blCopper, blSilver, blLead, blNikolite, blSlime;
- // Vanilla
- if (OreDictionary.getOres("blockRedstone").isEmpty())
- {
- redstoneblock = new Blockredstone(redstoneblockconfig,1).setBlockName("blockRedstone");
- GameRegistry.registerBlock(redstoneblock, "Vanitysanarchy_blockRedstone");
- LanguageRegistry.addName(redstoneblock, "Redstone Block");
- blRedstone = new ItemStack(redstoneblock);
- }
- else blRedstone = OreDictionary.getOres("blockRedstone").get(0);
- if (OreDictionary.getOres("blockCoal").isEmpty())
- {
- coalblock = new Blockcoal(coalblockconfig,2).setBlockName("blockCoal");
- GameRegistry.registerBlock(coalblock, "blockCoal");
- LanguageRegistry.addName(coalblock, "Coal Block");
- blCoal = new ItemStack(coalblock);
- }
- else blCoal = OreDictionary.getOres("blockCoal").get(0);
- if (OreDictionary.getOres("blockCharcoal").isEmpty())
- {
- charcoalblock = new Blockcharcoal(charcoalblockconfig,3).setBlockName("blockCharcoal");
- GameRegistry.registerBlock(charcoalblock, "blockCharcoal");
- LanguageRegistry.addName(charcoalblock, "Charcoal Block");
- }
- else blCharcoal = OreDictionary.getOres("blockCharcoal").get(0);
- if (OreDictionary.getOres("blockEnderpearl").isEmpty())
- {
- enderpearlblock = new Blockenderpearl(enderpearlblockconfig,4).setBlockName("blockEnderpearl");
- GameRegistry.registerBlock(enderpearlblock, "blockEnderpearl");
- LanguageRegistry.addName(enderpearlblock, "Enderpearl Block");
- }
- else blEnderpearl = OreDictionary.getOres("blockEnderpearl").get(0);
- // Mod Items
- if (!OreDictionary.getOres("ingotTin").isEmpty())
- {
- if (OreDictionary.getOres("blockTin").isEmpty())
- {
- tinblock = new Blocktin(tinblockconfig,5).setBlockName("blockTin");
- GameRegistry.registerBlock(tinblock, "blockTin");
- LanguageRegistry.addName(tinblock, "Tin Block");
- blTin = new ItemStack(tinblock);
- }
- else { blTin = OreDictionary.getOres("blockTin").get(0); }
- GameRegistry.addRecipe(new ShapedOreRecipe(blTin, new Object [] {"xxx", "xxx", "xxx", 'x', "ingotTin"}));
- tiningot = OreDictionary.getOres("ingotTin").get(0);
- ItemStack result = tiningot.copy();
- result.stackSize = 9;
- GameRegistry.addShapelessRecipe(result, blTin);
- }
- if (OreDictionary.getOres("blockCopper").isEmpty())
- {
- copperblock = new Blockcopper(copperblockconfig,6).setBlockName("blockCopper");
- GameRegistry.registerBlock(copperblock, "blockCopper");
- LanguageRegistry.addName(copperblock, "Copper Block");
- }
- else copperblock = OreDictionary.getOres("blockCopper").get(0);
- if (OreDictionary.getOres("blockSilver").isEmpty())
- {
- silverblock = new Blocksilver(silverblockconfig,7).setBlockName("blockSilver");
- GameRegistry.registerBlock(silverblock, "blockSilver");
- LanguageRegistry.addName(silverblock, "Silver Block");
- }
- else silverblock = OreDictionary.getOres("blockSilver").get(0);
- if (OreDictionary.getOres("blockLead").isEmpty())
- {
- leadblock = new Blocklead(leadblockconfig,8).setBlockName("blockLead");
- GameRegistry.registerBlock(leadblock, "blockLead");
- LanguageRegistry.addName(leadblock, "Lead Block");
- }
- else leadblock = OreDictionary.getOres("blockLead").get(0);
- if (OreDictionary.getOres("blockNikolite").isEmpty())
- {
- nikoliteblock = new Blocknikolite(nikoliteblockconfig,9).setBlockName("blocknikolite");
- GameRegistry.registerBlock(nikoliteblock, "blockNikolite");
- LanguageRegistry.addName(nikoliteblock, "Nikolite Block");
- }
- else nikoliteblock = OreDictionary.getOres("blockNikolite").get(0);
- if (OreDictionary.getOres("blockSlime").isEmpty())
- {
- slimeblock = new Blockslime(slimeblockconfig,10).setBlockName("blockSlime");
- GameRegistry.registerBlock(slimeblock, "blockSlime");
- LanguageRegistry.addName(slimeblock, "Slime Block");
- }
- else slimeblock = OreDictionary.getOres("blockSlime").get(0);
- ItemStack glassstack = new ItemStack(Block.glass);
- ItemStack lavabukkit = new ItemStack(Item.bucketLava);
- ItemStack string = new ItemStack(Item.silk);
- ItemStack redstone = new ItemStack(Item.redstone);
- ItemStack coal = new ItemStack(Item.coal);
- ItemStack charcoal = new ItemStack(Item.coal,1,1);
- ItemStack enderpearl = new ItemStack(Item.enderPearl);
- ItemStack slime = new ItemStack(Item.slimeBall);
- ItemStack skeleskull = new ItemStack(Item.skull);
- ItemStack zombieskull = new ItemStack(Item.skull,1,2);
- ItemStack stevehead = new ItemStack(Item.skull,1,3);
- ItemStack creeperhead = new ItemStack(Item.skull,1,4);
- if (!OreDictionary.getOres("ingotTin").isEmpty())
- if (!OreDictionary.getOres("ingotCopper").isEmpty())
- copperingot = OreDictionary.getOres("ingotCopper").get(0);
- if (!OreDictionary.getOres("ingotSilver").isEmpty())
- silveringot = OreDictionary.getOres("ingotSilver").get(0);
- if (!OreDictionary.getOres("ingotLead").isEmpty())
- leadingot = OreDictionary.getOres("ingotLead").get(0);
- if (!OreDictionary.getOres("dustNikolite").isEmpty())
- nikolite = OreDictionary.getOres("dustNikolite").get(0);
- // Copy the above for:
- // Copper
- // Silver
- // Lead
- // dustNikolite
- GameRegistry.addRecipe(new ItemStack(lavalamp), new Object [] {" x ", "xyx", " x ", 'x', glassstack, 'y', lavabukkit});
- // **** Put this in a different forgemod. Use the mcmod.info to declare two separate mods. ***
- //GameRegistry.addRecipe(new ItemStack(Block.web), new Object [] {"x x", " x ", "x x", 'x', string});
- //GameRegistry.addRecipe(skeleskull, new Object [] {"xxx", "xxx", "xxx", 'x', Item.bone});
- GameRegistry.addRecipe(new ItemStack(redstoneblock), new Object [] {"xxx", "xxx", "xxx", 'x', redstone});
- /*
- Storage Block Crafting
- */
- GameRegistry.addRecipe(new ItemStack(redstoneblock), new Object [] {"xxx", "xxx", "xxx", 'x', redstone});
- GameRegistry.addRecipe(new ItemStack(coalblock), new Object [] {"xxx", "xxx", "xxx", 'x', coal});
- GameRegistry.addRecipe(new ItemStack(charcoalblock), new Object [] {"xxx", "xxx", "xxx", 'x', charcoal});
- GameRegistry.addRecipe(new ItemStack(enderpearlblock), new Object [] {"xxx", "xxx", "xxx", 'x', enderpearl});
- GameRegistry.addRecipe(new ShapedOreRecipe(tinblock, new Object [] {"xxx", "xxx", "xxx", 'x', "ingotTin"}));
- GameRegistry.addRecipe(new ShapedOreRecipe(copperblock, new Object [] {"xxx", "xxx", "xxx", 'x', "ingotCopper"}));
- GameRegistry.addRecipe(new ShapedOreRecipe(silverblock, new Object [] {"xxx", "xxx", "xxx", 'x', "ingotSilver"}));
- GameRegistry.addRecipe(new ShapedOreRecipe(leadblock, new Object [] {"xxx", "xxx", "xxx", 'x', "ingotLead"}));
- GameRegistry.addRecipe(new ShapedOreRecipe(nikoliteblock, new Object [] {"xxx", "xxx", "xxx", 'x', "dustNikolite"}));
- GameRegistry.addRecipe(new ItemStack(slimeblock), new Object [] {"xxx", "xxx", "xxx", 'x', slime});
- /*
- Storage Block Uncrafting
- */
- GameRegistry.addShapelessRecipe(new ItemStack(Item.redstone, 9), new ItemStack(redstoneblock,1));
- GameRegistry.addShapelessRecipe(new ItemStack(Item.coal, 9), new ItemStack(coalblock,1));
- GameRegistry.addShapelessRecipe(new ItemStack(Item.coal, 9,1), new ItemStack(charcoalblock,1));
- GameRegistry.addShapelessRecipe(new ItemStack(Item.enderPearl, 9), new ItemStack(enderpearlblock,1));
- GameRegistry.addShapelessRecipe(new ItemStack(tiningot, 9), new ItemStack(tinblock, 1));
- GameRegistry.addShapelessRecipe(new ItemStack(copperingot, 9), new ItemStack(copperblock, 1));
- GameRegistry.addShapelessRecipe(new ItemStack(silveringot, 9), new ItemStack(silverblock, 1));
- GameRegistry.addShapelessRecipe(new ItemStack(leadingot, 9), new ItemStack(leadblock, 1));
- GameRegistry.addShapelessRecipe(new ItemStack(nikolite, 9), new ItemStack(nikoliteblock, 1));
- GameRegistry.addShapelessRecipe(new ItemStack(slime, 9), new ItemStack(slimeblock,1));
- }
- @PostInit
- public void postInit(FMLPostInitializationEvent event) {
- // If you want, you can move everything down here.
- // Alternately, you can declare in the mcmod.info that you
- // must be loaded after IC2, Redpower, Buildcraft, etc, etc, etc.
- // Either way will work.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement