Posted May 24, 20169 yr Hi, I am doing a quick backport of my code to 1.6.4 due to a few requests. I know this version is outdated, and I have no plans to continually support it for future versions of my mod. This is simply a one time basic feature backport for those who might want to use my mod with older mods that have been abandoned and or not updated past 1.6. So please spare me the "Why are you using 1.6.4?" I am well aware of why I shouldn't be using it for active development. Anyways, my issue is this. In newer versions (1.7+) I have been able to add items as fuels using if(fuel.getItem() == Item.itemname){ return xticks; } This function works from 1.6.4 to 1.9.4 and probably even earlier versions which I won't be exploring. However, the function I have used to add blocks as fuels: if(fuel.getItem() == Item.getItemFromBlock(Blocks.itemname)){ return xticks; } Does not work in 1.6.4 because there is no "Item.getItemFromBlock" that I can use. I am not sure how to set it up and all attempts have failed thus far. Here is my current source code as is. (just so you can see how I have my mod set up if it will help you with finding a solution. Main.java: package com.bored.morefuelsmod; import net.minecraft.block.Block; import net.minecraftforge.common.Configuration; import net.minecraft.block.*; import net.minecraft.block.material.*; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = Main.MODID, version = Main.VERSION, name = Main.MODNAME) public class Main { public static final String MODID = "morefuelsmod-1.6.4"; public static final String VERSION = "1.3.1-alpha"; public static final String MODNAME = "More Fuels Mod"; @EventHandler public void preinit(FMLPreInitializationEvent event){ Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); boolean enableRFtLrecipe = config.get(Configuration.CATEGORY_GENERAL, "enableRFtLrecipe", true).getBoolean(true); if(enableRFtLrecipe) GameRegistry.addSmelting(367, new ItemStack(Item.leather), 0.3F); config.save(); } @EventHandler public void init(FMLInitializationEvent event) { GameRegistry.registerFuelHandler(new Fuels()); } } Fuels.java: package com.bored.morefuelsmod; import cpw.mods.fml.common.IFuelHandler; import net.minecraft.block.Block; import net.minecraft.block.BlockSand; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class Fuels implements IFuelHandler { @Override public int getBurnTime(ItemStack fuel) { if(fuel.getItem() == Item.itemFrame){ return 900; } if(fuel.getItem() == Item.bed){ return 1500; } if(fuel.getItem() == Item.painting){ return 1000; } if(fuel.getItem() == Item.sign){ return 640; } if(fuel.getItem() == Item.arrow){ return 60; } if(fuel.getItem() == Item.feather){ return 100; } if(fuel.getItem() == Item.wheat){ return 100; } if(fuel.getItem() == Item.seeds){ return 100; } if(fuel.getItem() == Item.melonSeeds){ return 100; } if(fuel.getItem() == Item.pumpkinSeeds){ return 100; } if(fuel.getItem() == Item.doorWood){ return 600; } if(fuel.getItem() == Item.minecartCrate){ return 400; } if(fuel.getItem() == Item.minecartTnt){ return 8180; } return 0; } }
May 24, 20169 yr Author Hi, I am doing a quick backport of my code to 1.6.4 due to a few requests. I know this version is outdated, and I have no plans to continually support it for future versions of my mod. This is simply a one time basic feature backport for those who might want to use my mod with older mods that have been abandoned and or not updated past 1.6. So please spare me the "Why are you using 1.6.4?" I am well aware of why I shouldn't be using it for active development. Anyways, my issue is this. In newer versions (1.7+) I have been able to add items as fuels using if(fuel.getItem() == Item.itemname){ return xticks; } This function works from 1.6.4 to 1.9.4 and probably even earlier versions which I won't be exploring. However, the function I have used to add blocks as fuels: if(fuel.getItem() == Item.getItemFromBlock(Blocks.itemname)){ return xticks; } Does not work in 1.6.4 because there is no "Item.getItemFromBlock" that I can use. I am not sure how to set it up and all attempts have failed thus far. Here is my current source code as is. (just so you can see how I have my mod set up if it will help you with finding a solution. Main.java: package com.bored.morefuelsmod; import net.minecraft.block.Block; import net.minecraftforge.common.Configuration; import net.minecraft.block.*; import net.minecraft.block.material.*; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = Main.MODID, version = Main.VERSION, name = Main.MODNAME) public class Main { public static final String MODID = "morefuelsmod-1.6.4"; public static final String VERSION = "1.3.1-alpha"; public static final String MODNAME = "More Fuels Mod"; @EventHandler public void preinit(FMLPreInitializationEvent event){ Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); boolean enableRFtLrecipe = config.get(Configuration.CATEGORY_GENERAL, "enableRFtLrecipe", true).getBoolean(true); if(enableRFtLrecipe) GameRegistry.addSmelting(367, new ItemStack(Item.leather), 0.3F); config.save(); } @EventHandler public void init(FMLInitializationEvent event) { GameRegistry.registerFuelHandler(new Fuels()); } } Fuels.java: package com.bored.morefuelsmod; import cpw.mods.fml.common.IFuelHandler; import net.minecraft.block.Block; import net.minecraft.block.BlockSand; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class Fuels implements IFuelHandler { @Override public int getBurnTime(ItemStack fuel) { if(fuel.getItem() == Item.itemFrame){ return 900; } if(fuel.getItem() == Item.bed){ return 1500; } if(fuel.getItem() == Item.painting){ return 1000; } if(fuel.getItem() == Item.sign){ return 640; } if(fuel.getItem() == Item.arrow){ return 60; } if(fuel.getItem() == Item.feather){ return 100; } if(fuel.getItem() == Item.wheat){ return 100; } if(fuel.getItem() == Item.seeds){ return 100; } if(fuel.getItem() == Item.melonSeeds){ return 100; } if(fuel.getItem() == Item.pumpkinSeeds){ return 100; } if(fuel.getItem() == Item.doorWood){ return 600; } if(fuel.getItem() == Item.minecartCrate){ return 400; } if(fuel.getItem() == Item.minecartTnt){ return 8180; } return 0; } }
May 24, 20169 yr I am not quite sure about 1.6.4 anymore, but I think Item.itemsList[block.blockID] should work. Its been a long time since I worked with 1.6, but I'm pretty confident that diesieben is correct. 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.
May 24, 20169 yr I am not quite sure about 1.6.4 anymore, but I think Item.itemsList[block.blockID] should work. Its been a long time since I worked with 1.6, but I'm pretty confident that diesieben is correct. 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.
May 24, 20169 yr Author I am not quite sure about 1.6.4 anymore, but I think Item.itemsList[block.blockID] should work. That worked! Thank you.
May 24, 20169 yr Author I am not quite sure about 1.6.4 anymore, but I think Item.itemsList[block.blockID] should work. That worked! Thank you.
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.