Jump to content

boredherobrine13

Members
  • Posts

    86
  • Joined

  • Last visited

Everything posted by boredherobrine13

  1. Just a note, it creates a totally blank file called morefuels.cfg, but it doesnt work if i try to add anything to it, and errors, only to be replaced by a new one.
  2. Thank you. I think I understand. I decided to remove the ConfigHandler.java file. Here is my Main.java: package com.bored.morefuelsmod; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.common.config.Configuration; @Mod(modid = Main.MODID, version = Main.VERSION, name=Main.MODNAME) public class Main { public static final String MODID = "morefuels"; public static final String VERSION = "1.1.0"; public static final String MODNAME = "More Fuels Mod"; @Instance(value = Main.MODID) public static Main instance; @EventHandler public void preinit(FMLPreInitializationEvent event){ Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); boolean enableRFtLrecipe = config.get(config.CATEGORY_GENERAL, "enableRFtLrecipe", true).getBoolean(true); if(enableRFtLrecipe) GameRegistry.addSmelting(Items.rotten_flesh, new ItemStack(Items.leather), 0.3F); //I feel like I need an "else if" statement here telling it to not add the recipe if it doesnt return true. //Also, how to I get the actual config file to appear......like do I make it or is it generated and if so how //and do i need to type any code for that... } @EventHandler public void init(FMLInitializationEvent event){ GameRegistry.registerFuelHandler(new Fuels()); } } But I have one question. Do I now need an else if statement to say what to do if it doesnt return true. If so, what do I need to put so that it knows not to enable the recipe. Also how do I actually create the config file so this shows up in a file. Do i need to write code for this?
  3. I think I get what you are saying...but I'm not quite sure how to implement it.
  4. Okay so I am working on a mod, and basically I want to use GameRegistry.addSmelting(Items.rotten_flesh, new ItemStack(Items.leather), 0.3F); to make it so that players can smelt rotten flesh into leather. However, I want players to be able to disable this in a .cfg file if they so desire. But I have very little experience with creating config files, virtually no idea how to. I have read multiple tutorials but they are all from different versions and they all say different things. I think there is probably some best way to do this but I just dont know and I cant find a clear tutorial. So here is my entire code: Main.java: package com.bored.morefuelsmod; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.common.config.Configuration; @Mod(modid = Main.MODID, version = Main.VERSION, name=Main.MODNAME) public class Main { public static final String MODID = "morefuels"; public static final String VERSION = "1.1.0"; public static final String MODNAME = "More Fuels Mod"; @Instance(value = Main.MODID) public static Main instance; @EventHandler public void preinit(FMLPreInitializationEvent event){ Configuration config = new Configuration(event.getSuggestedConfigurationFile()); boolean disableRFtLrecipe = config.get(config.CATEGORY_GENERAL, "disableRFtLrecipe", false).getBoolean(false); if(disableRFtLrecipe){ GameRegistry.addSmelting(Items.rotten_flesh, new ItemStack(Items.leather), 0.3F); } } @EventHandler public void init(FMLInitializationEvent event){ GameRegistry.registerFuelHandler(new Fuels()); } } ConfigHandler.java (not sure about this but I heard i should do this seperately. package com.bored.morefuelsmod; import java.io.File; import net.minecraftforge.common.config.Configuration; public class ConfigHandler { public static void init(File configFile) { Configuration config = new Configuration(configFile); config.load(); boolean disableRFtLrecipe = config.get(config.CATEGORY_GENERAL, "disableRFtLrecipe", false).getBoolean(false); config.save(); } } Please be detailed and try to simplify it, I very much appreciate code examples.
  5. Nevermind, I figured it out. Thanks for the help guys! if(fuel.getItem() == Item.getItemFromBlock(Blocks.deadbush)){ return 50; }
  6. I tried this. Gives me an error "block cannot be resolved to a variable." I feel like I am most likely just missing something here obvious but here is my code, any hints? if(Item.getItemFromBlock(block) == Blocks.deadbush){ return 50; }
  7. Hey. It's me again. So I managed to get things with items working...but what do I need to do if I need to make a block fuel. I tried this code and It didnt work. Couldn't find a fuel.getBlock. if(fuel.getItem() == Blocks.deadbush){ return 50; }
  8. Fuel existing furnaces. I am basically just making a tweak mod allowing certain items to be used as fuels that cant be used as fuels in vanilla.
  9. Hey so I am making my first mod but I am having serious issues allowing items and blocks to be used as fuels. This is referring to already in game items such as diamonds. I have been using the wiki so far but the code there doesn't seem to work for making an item usable as a fuel. Please tell me how? Sorry if this has already been asked, I am having issues with using the search feature on this forum (never loads search results and just stays on page). I am a N00b with little ADVANCED java knowledge looking to make a simple mod, so please be friendly. If I'm doing something obviously stupid, please just tell me. Link: http://www.minecraftforge.net/wiki/Furnace_Fuel P.S. I know it does say at that link that the tutorial is for 1.4.7-1.6.4 but I have no idea what else to use since no real 1.7.x or 1.8.x tutorials are available.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.