Posted February 24, 201411 yr I just got done reading the Tut on Using the Ore Dictionary to add crafting recipes. I did notice that the guide was made for 1.3.2 so could by why I'm having a problem. But if I do what the Tut says about replacing the item with a string that you specified when you register the ingot, it will throw me a Null Pointer in that recipe. This is my registering of the ingot which is before the recipes. OreDictionary.registerOre("ingotTitanium", titaniumIngots); This is the recipe I'm trying to use. GameRegistry.addRecipe(new ItemStack(mediumPowerCell, 1, mediumPowerCell.getMaxDamage()), new Object[]{"RXR", "XYX", "RXR", 'X', "ingotTitanium", 'Y', largePowerCore, 'R', Item.redstone});
February 24, 201411 yr Are you sure that largePowerCore is defined? Also, you don't need the new Object[]{} bit. The parameters of the recipes are declared as object... , meaning that it already comes in as an array. Oh, I know what the problem is. Here's one of mine GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockPedestal.instance,2), "ggg","g g","sss",'g', thinglass, 's', "stone")); Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
February 24, 201411 yr Author Yea i thought that was the case when it came to not needing the new Object[], I was watching a tut when this came up and I kept to it to follow along. My other recipes didn't have it. Yea I overlooked it when I read the description and only glanced at the code layout. By the way I don't see why people would call you an ass. Every time you post to one of my nub questions seem just fine & helpful to me.
February 24, 201411 yr Author Well its common sense that you will need to. I've watched hours of java tuts and still barely get the grasp of what I'm trying to do here. For anyone to think that they can do this without knowing java is idiotic. I thought I've asked some dumb questions. That brings me to a point I was looking over the "How to make an advanced config" and was wondering how it... works meaning I though java wouldn't agree with this. In the PreInit there are these lines. int randomBlockID = config.getBlock("RandomBlock", 200).getInt(); int randomItemID = config.getItem("RandomItem", 20000).getInt(); @PreInit public void preInit(FMLPreInitializationEvent event) { Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); int randomBlockID = config.getBlock("RandomBlock", 200).getInt(); int randomItemID = config.getItem("RandomItem", 20000).getInt(); // Since this flag is a boolean, we can read it into the variable directly from the config. someConfigFlag = config.get(Configuration.CATEGORY_GENERAL, "SomeConfigFlag", false).getBoolean(false); //Notice there is nothing that gets the value of this property so the expression results in a Property object. Property someProperty = config.get(Configuration.CATEGORY_GENERAL, "SomeConfigString", "nothing"); // Here we add a comment to our new property. someProperty.comment = "This value can be read as a string!"; String someConfigString = someProperty.value; // this could also be: // int someInt = someProperty.getInt(); // boolean someBoolean = someProperty.getBoolean(true); config.save(); } They then get passed into randomBlock = (new RandomBlock(randomBlockID , 5)) @Init public void load(FMLInitializationEvent event) { // now the blockID can be set in a configuration file randomBlock = (new RandomBlock(randomBlockID , 5)) .setHardness(1.5F) .setResistance(10.0F) .setStepSound(Block.soundStoneFootstep) .setBlockName("Random Block"); // where 20000 is the ItemID I want to assign it, and 2 is the texture. randomItem = (new RandomItem(randomItemID, 2)); } Now to my knowledge wouldn't randomBlockID and randomItemID be local variable to the first function and wouldn't be able to be called in the second function as they are? Also shouldn't the blocks themselves be defined before the preInit like how they are in the postInit. This is the whole code from the http://www.minecraftforge.net/wiki/How_to_make_an_advanced_configuration_file package mod.dummy; import net.minecraft.src.*; import cpw.mods.fml.common.*; import cpw.mods.fml.common.Mod.*; import cpw.mods.fml.common.event.*; /* +Other imports */ import net.minecraftforge.common.Configuration; import net.minecraft.src.forge.Property; @Mod( modid = "Dummy", name="Dummy", version="1.0") public class Dummy { @PreInit public void preInit(FMLPreInitializationEvent event) { Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); int randomBlockID = config.getBlock("RandomBlock", 200).getInt(); int randomItemID = config.getItem("RandomItem", 20000).getInt(); // Since this flag is a boolean, we can read it into the variable directly from the config. someConfigFlag = config.get(Configuration.CATEGORY_GENERAL, "SomeConfigFlag", false).getBoolean(false); //Notice there is nothing that gets the value of this property so the expression results in a Property object. Property someProperty = config.get(Configuration.CATEGORY_GENERAL, "SomeConfigString", "nothing"); // Here we add a comment to our new property. someProperty.comment = "This value can be read as a string!"; String someConfigString = someProperty.value; // this could also be: // int someInt = someProperty.getInt(); // boolean someBoolean = someProperty.getBoolean(true); config.save(); } @Init public void load(FMLInitializationEvent event) { // now the blockID can be set in a configuration file randomBlock = (new RandomBlock(randomBlockID , 5)) .setHardness(1.5F) .setResistance(10.0F) .setStepSound(Block.soundStoneFootstep) .setBlockName("Random Block"); // where 20000 is the ItemID I want to assign it, and 2 is the texture. randomItem = (new RandomItem(randomItemID, 2)); } @PostInit public void postInit(FMLPostInitializationEvent event) { } // These fields save the IDs between function calls public static int randomBlockID; public static int randomItemID; public static Block randomBlock; public static Item randomItem; public static boolean someConfigFlag; }
February 25, 201411 yr Java is funny about all the different scopes and such, huh. There are variables: local, nonlocal, and even other. vis-a-vis: You can declare variables in several different places: [*]In a class body as class fields. Variables declared here are referred to as class-level variables. [*]As parameters of a method or constructor. [*]In a method's body or a constructor's body. [*]Within a statement block, such as inside a while or for block. Then there is the types of class and member variables: static and nonstatic. And visibility: private, public, and [package]. Of course, you then have Integer vs int and "string" vs String... -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.