Posted April 30, 201411 yr Hello Guys, I got a big problem with my mod. I want to smelt down my own created Ore but it won't work don't know why MainClass: package crystalrevolution; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.registry.GameRegistry; import crystalrevolution.blocks.OreCrystal; import crystalrevolution.items.Crystal; import crystalrevolution.proxies.ServerProxy; @Mod(modid = crystalrevolution.MODID, version = crystalrevolution.VERSION) public class crystalrevolution { @SidedProxy(clientSide = "crystalrevolution.proxies.ClientProxy", serverSide = "crystalrevolution.proxies.ServerProxy") public static ServerProxy proxy; public static final String MODID = "crevolution"; public static final String VERSION = "1.0.0a"; // --Blocks public static Block OreCrystal = new OreCrystal(Material.rock); // --Items public static Item Crystal = new Crystal(); public crystalrevolution() { // smelting GameRegistry.addSmelting(OreCrystal, new ItemStack(Crystal), 5.0F); // Blocks GameRegistry.registerBlock(OreCrystal, "OreCrystal"); // Items GameRegistry.registerItem(Crystal, "Crystal"); } } OreCrystal Class: package crystalrevolution.blocks; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import crystalrevolution.crystalrevolution; public class OreCrystal extends Block{ private String texture = "CrystalRevolution:crystal_ore"; public OreCrystal(Material mat) { super(mat); this.setBlockName("OreCrystal"); this.setHardness(5); this.setResistance(; this.setCreativeTab(crystalrevolution.tabCrystal); this.setBlockTextureName(texture); this.setHarvestLevel("pickaxe", 2); } public Item getItemDropped(int par1, Random rand, int par3){ return crystalrevolution.Crystal; } public int quantityDropped(Random rand){ return 1 + rand.nextInt(4); } }
April 30, 201411 yr Author I've read them several times but can't find my mistake! I can't put my Ore in the Furnace to smelt it down
April 30, 201411 yr Author The only method that is not working is the GameRegistry.addsmelting and i don't know why. I asked for help!
April 30, 201411 yr Author I've looked at modding tutorials by ScratchForFun and Shaqaruden and both did not work! And this Section is called Modder Support or not ? So why don't u help ? Why do u behave like this ?
April 30, 201411 yr Firt you need to register the block and the item, otherwise the game will not reconize them. Coding, Testing, Smiling, Publishing!
April 30, 201411 yr Author @Casual did u looked at the Code ? I have registered them already my only problem is the Smelting i used the same structure as in 1.6.2
April 30, 201411 yr You're overthinking it. Your mod's constuctor is not the place to register anything or create anything or add recipes for anything. Also, do not use your mod's static initializers for new blocks, or items. Learn about and use the FML events for your Mod preinitialization, initialization, and post-initialization. That is where your block, items, recipes, etc. are set up. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
April 30, 201411 yr @Casual did u looked at the Code ? I have registered them already my only problem is the Smelting i used the same structure as in 1.6.2 ffdsaklfj. How do you not understand what he's trying to tell you to do? You are suppose to "register" your items BEFORE you call your addSmelting() method, or the game will not recognize the items because they are even created yet!
April 30, 201411 yr Try this GameRegistry.addSmelting(<MainClassName>.OreCrystal.blockID, new ItemStack (<MainClassName>.Crystal), 5.0F); <MainClassName> is your main class name Developer of MechanicalCraft. Sadly not available to public yet
May 1, 201411 yr Smelting needs to go after the registration of the blocks/items! And inside load events. You really need to learn Java and thoroughly read beginner tutorials, it's worth doing. I havent checked the syntax, so you may need to import some things if they aren't already. But this is how your main class should look roughly import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.Mod.EventHandler; 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.registry.GameRegistry; import crystalrevolution.blocks.OreCrystal; import crystalrevolution.items.Crystal; import crystalrevolution.proxies.ServerProxy; @Mod(modid = crystalrevolution.MODID, version = crystalrevolution.VERSION) public class crystalrevolution { @SidedProxy(clientSide = "crystalrevolution.proxies.ClientProxy", serverSide = "crystalrevolution.proxies.ServerProxy") public static ServerProxy proxy; public static final String MODID = "crevolution"; public static final String VERSION = "1.0.0a"; // --Blocks public static Block OreCrystal = new OreCrystal(Material.rock); // --Items public static Item Crystal = new Crystal(); /** * Called from FML during the pre initialisation phase * @param event Pre-Init event */ @EventHandler public void preInitialise(FMLPreInitializationEvent event) { //Blocks and items are registered here // Blocks GameRegistry.registerBlock(OreCrystal, "OreCrystal"); // Items GameRegistry.registerItem(Crystal, "Crystal"); } /** * Called from FML during the initialisation phase * @param event Init event */ @EventHandler public void initialise(FMLInitializationEvent event) { //Smelting happens here GameRegistry.addSmelting(OreCrystal, new ItemStack(Crystal), 5.0F); } /** * Called from FML during the post initialisation phase * @param event Post-Init event */ @EventHandler public void postInitialise(FMLPostInitializationEvent event) { //Communication between mods goes here, if you choose to do that in the future } } I'm Sparkst3r, that kid who makes Sphax textures. Well hi there.
May 1, 201411 yr Smelting needs to go after the registration of the blocks/items! And inside load events. You really need to learn Java and thoroughly read beginner tutorials, it's worth doing. I havent checked the syntax, so you may need to import some things if they aren't already. But this is how your main class should look roughly import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.Mod.EventHandler; 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.registry.GameRegistry; import crystalrevolution.blocks.OreCrystal; import crystalrevolution.items.Crystal; import crystalrevolution.proxies.ServerProxy; @Mod(modid = crystalrevolution.MODID, version = crystalrevolution.VERSION) public class crystalrevolution { @SidedProxy(clientSide = "crystalrevolution.proxies.ClientProxy", serverSide = "crystalrevolution.proxies.ServerProxy") public static ServerProxy proxy; public static final String MODID = "crevolution"; public static final String VERSION = "1.0.0a"; // --Blocks public static Block OreCrystal = new OreCrystal(Material.rock); // --Items public static Item Crystal = new Crystal(); /** * Called from FML during the pre initialisation phase * @param event Pre-Init event */ @EventHandler public void preInitialise(FMLPreInitializationEvent event) { //Blocks and items are registered here // Blocks GameRegistry.registerBlock(OreCrystal, "OreCrystal"); // Items GameRegistry.registerItem(Crystal, "Crystal"); } /** * Called from FML during the initialisation phase * @param event Init event */ @EventHandler public void initialise(FMLInitializationEvent event) { //Smelting happens here GameRegistry.addSmelting(OreCrystal, new ItemStack(Crystal), 5.0F); } /** * Called from FML during the post initialisation phase * @param event Post-Init event */ @EventHandler public void postInitialise(FMLPostInitializationEvent event) { //Communication between mods goes here, if you choose to do that in the future } } The smelting code is wrong. You need to define if it's a block or not by going to the end of the block your smelting and put .blockID . Developer of MechanicalCraft. Sadly not available to public yet
May 1, 201411 yr Smelting needs to go after the registration of the blocks/items! And inside load events. You really need to learn Java and thoroughly read beginner tutorials, it's worth doing. I havent checked the syntax, so you may need to import some things if they aren't already. But this is how your main class should look roughly import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.EnumHelper; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.Mod.EventHandler; 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.registry.GameRegistry; import crystalrevolution.blocks.OreCrystal; import crystalrevolution.items.Crystal; import crystalrevolution.proxies.ServerProxy; @Mod(modid = crystalrevolution.MODID, version = crystalrevolution.VERSION) public class crystalrevolution { @SidedProxy(clientSide = "crystalrevolution.proxies.ClientProxy", serverSide = "crystalrevolution.proxies.ServerProxy") public static ServerProxy proxy; public static final String MODID = "crevolution"; public static final String VERSION = "1.0.0a"; // --Blocks public static Block OreCrystal = new OreCrystal(Material.rock); // --Items public static Item Crystal = new Crystal(); /** * Called from FML during the pre initialisation phase * @param event Pre-Init event */ @EventHandler public void preInitialise(FMLPreInitializationEvent event) { //Blocks and items are registered here // Blocks GameRegistry.registerBlock(OreCrystal, "OreCrystal"); // Items GameRegistry.registerItem(Crystal, "Crystal"); } /** * Called from FML during the initialisation phase * @param event Init event */ @EventHandler public void initialise(FMLInitializationEvent event) { //Smelting happens here GameRegistry.addSmelting(OreCrystal, new ItemStack(Crystal), 5.0F); } /** * Called from FML during the post initialisation phase * @param event Post-Init event */ @EventHandler public void postInitialise(FMLPostInitializationEvent event) { //Communication between mods goes here, if you choose to do that in the future } } The smelting code is wrong. You need to define if it's a block or not by going to the end of the block your smelting and put .blockID . For 1.6 you do, but this is 1.7, you don't need to do that anymore. You now only need to pass in the Item or block to the method and the appropriate method is inferred I'm Sparkst3r, that kid who makes Sphax textures. Well hi there.
May 1, 201411 yr @Casual did u looked at the Code ? I have registered them already my only problem is the Smelting i used the same structure as in 1.6.2 Yes I did! First take a look at your code: public crystalrevolution() { // smelting GameRegistry.addSmelting(OreCrystal, new ItemStack(Crystal), 5.0F); // Blocks GameRegistry.registerBlock(OreCrystal, "OreCrystal"); // Items GameRegistry.registerItem(Crystal, "Crystal"); } Take a look at the modified code public crystalrevolution() { // Blocks GameRegistry.registerBlock(OreCrystal, "OreCrystal"); // Items GameRegistry.registerItem(Crystal, "Crystal"); // smelting GameRegistry.addSmelting(OreCrystal, new ItemStack(Crystal), 5.0F); } The Crystal and the OreCrystal are first registered by the GameRegistry and then it can be used by other methodes like the addSmelting(). you can't do a addRecipe() before registerItem / Block either. Coding, Testing, Smiling, Publishing!
May 1, 201411 yr Ahhh now i understand what u want to tell me thanks for ur help You still shouldn't be putting it in the constructor. I'm Sparkst3r, that kid who makes Sphax textures. Well hi there.
May 1, 201411 yr Ahhh now i understand what u want to tell me thanks for ur help You still shouldn't be putting it in the constructor. That was the first thing I said. The OP seems to want to ignore the sage advice about that, since it works so far. The fun will come when he has to play nice with other mods and the emails and complaints he will get!!! Well, live and learn. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
May 1, 201411 yr So basically, problem solved? Developer of MechanicalCraft. Sadly not available to public yet
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.