Pentagear Posted March 23, 2013 Share Posted March 23, 2013 So I recently picked up Modding and have successfully made a couple recipes based on the Forge tutorials. What I'm running into however, is when I attempt to use Redstone Repeaters in a recipe, it crashes the client. I'm sure there is something I'm missing, perhaps the ItemStack object cannot handle BlockRedstoneRepeater types. Here's an example of a recipe I'd like to use them in (all other block types work for this recipe so code is omitted): ItemStack furnaceStack = new ItemStack(Block.furnaceIdle); ItemStack obsidianStack = new ItemStack(Block.obsidian); ItemStack ironBlockStack = new ItemStack(Block.blockSteel); ItemStack repeaterStack = new ItemStack(BlockRedstoneRepeater.redstoneRepeaterIdle); ItemStack redstoneBlockStack = new ItemStack(Block.field_94341_cq); ItemStack blockDiamondStack = new ItemStack(Block.blockDiamond); GameRegistry.addRecipe( blockDiamondStack, "bab", "aea", "cdc", "a",obsidianStack, "b",ironBlockStack, "c",repeaterStack, "d",redstoneBlockStack, "e",furnaceStack ); I'm sorry if this is a really simple problem, but I couldn't find anything after searching on it for several hours. Do I need to modify or extend a class to enable this? What do I do? I forgot to mention that the blockDiamondStack is there as a placeholder until I learn how to create entirely new blocks. Quote Link to comment Share on other sites More sharing options...
Pentagear Posted March 23, 2013 Author Share Posted March 23, 2013 The redstone repeater block is unobtainable in vanilla, it only gets placed by the repeater Item. When it gets destroyed, it also drops that Item (much like reeds do). Ah, that makes sense. Thank you diesieben07. How would I go about allowing the use of repeaters in a recipe? I've seen other Mods with the ability to use them, what am I missing here? Quote Link to comment Share on other sites More sharing options...
Pentagear Posted March 23, 2013 Author Share Posted March 23, 2013 Awesome! Looks like that works. Where in the project explorer would I find a list of similar behaved items, so I don't have to ask again? Edit: Nevermind! Found the Item list in net.minecraft.item > Item.java... Thanks again for the help diesieben07! Quote Link to comment Share on other sites More sharing options...
Pentagear Posted March 23, 2013 Author Share Posted March 23, 2013 Hmmm. It seems unfortunate that simply changing the line into: ItemStack repeaterStack = new ItemStack(Item.redstoneRepeater); Did not work. At this point I'm clueless, and ideas I had about this working seem to be wrong . Quote Link to comment Share on other sites More sharing options...
Pentagear Posted March 23, 2013 Author Share Posted March 23, 2013 Doesn't work resulted in the client crashing after compile. I am away from the computer right now, but as soon as I get back, I will forward the logs that were generated, as well as posting all of the code for the package. Quote Link to comment Share on other sites More sharing options...
SenpaiSubaraki Posted March 23, 2013 Share Posted March 23, 2013 Tested your problem both : GameRegistry.addRecipe(new ItemStack(Block.dirt, 1), new Object[]{"P", 'P', new ItemStack(Item.redstoneRepeater,1)}); GameRegistry.addRecipe(new ItemStack(Block.dirt, 1), new Object[]{"P", 'P', Item.redstoneRepeater}); I have no problem at all. dont know what you are doing, but it must be something else ! Quote https://minecraft.curseforge.com/members/Subaraki/projects Link to comment Share on other sites More sharing options...
Pentagear Posted March 23, 2013 Author Share Posted March 23, 2013 Quite literally the result of ending the 2nd tutorial is what my code is. The only difference being is that I'm not using the recipes in the tutorial, rather just my own, the only code I've changed in that tutorial is in the Generic.java file: package tutorial.generic; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraftforge.common.MinecraftForge; 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="Generic", name="Generic", version="0.0.0") @NetworkMod(clientSideRequired=true, serverSideRequired=false) public class Generic { // The instance of the mod that Forge uses @Instance("Generic") public static Generic instance; // Say where the client and server 'proxy' code are loaded @SidedProxy(clientSide="tutorial.generic.client.ClientProxy", serverSide="tutorial.generic.CommonProxy") public static CommonProxy proxy; @PreInit public void preInit(FMLPreInitializationEvent event) { // Stub Method } @Init public void load(FMLInitializationEvent event) { proxy.registerRenderers(); ItemStack furnaceStack = new ItemStack(Block.furnaceIdle); ItemStack obsidianStack = new ItemStack(Block.obsidian); ItemStack ironBlockStack = new ItemStack(Block.blockSteel); ItemStack repeaterStack = new ItemStack(Item.redstoneRepeater); ItemStack redstoneBlockStack = new ItemStack(Block.field_94341_cq); ItemStack blockDiamondStack = new ItemStack(Block.blockDiamond); GameRegistry.addRecipe( blockDiamondStack, "bab", "aea", "cdc", "a",obsidianStack, "b",ironBlockStack, "c",repeaterStack, "d",redstoneBlockStack, "e",furnaceStack ); } @PostInit public void postInit(FMLPostInitializationEvent event) { // Stub Method } } That was my assumption too, that it was something else, but I've literally only tinkered with the Generic.java file. Quote Link to comment Share on other sites More sharing options...
Pentagear Posted March 23, 2013 Author Share Posted March 23, 2013 Tested your problem both : GameRegistry.addRecipe(new ItemStack(Block.dirt, 1), new Object[]{"P", 'P', new ItemStack(Item.redstoneRepeater,1)}); GameRegistry.addRecipe(new ItemStack(Block.dirt, 1), new Object[]{"P", 'P', Item.redstoneRepeater}); I have no problem at all. dont know what you are doing, but it must be something else ! I noticed that you are using a format that I haven't seen. new Object[]{"P",'P', new ItemStack(Item.redstoneRepeater,1)} and new Object[]{"P",'P', Item.redstoneRepeater} I understand what these mean, though is this how I have to identify those particular items, inside an Object? Quote Link to comment Share on other sites More sharing options...
Pentagear Posted March 23, 2013 Author Share Posted March 23, 2013 SOLVED! Now using: @Init public void load(FMLInitializationEvent event) { proxy.registerRenderers(); // BionikCraft: Redstone Furnace GameRegistry.addRecipe( new ItemStack(Block.bedrock, 1), new Object[] { "bab", "aea", "cdc", 'a', Block.obsidian, 'b', Block.blockSteel, 'c', Item.redstoneRepeater, 'd', Block.field_94341_cq, 'e', Block.furnaceIdle } ); } Seems that for some reason ("a", obj, "b", obj, "c", obj) is in fact different than ('a', obj, 'b', obj, 'c', obj). My own stupid fault for assuming quotes were similar. I'm familiar with other C based languages, though this is the first time I've run into this kind of problem with strings. Tested and working. Thanks again both of you. Quote Link to comment Share on other sites More sharing options...
jordan30001 Posted March 23, 2013 Share Posted March 23, 2013 The reason why "a" obj does not work is that "a" is a string the object requires a character/char 'a' so in short "a" = string 'a' = character Quote Link to comment Share on other sites More sharing options...
Pentagear Posted March 24, 2013 Author Share Posted March 24, 2013 The reason why "a" obj does not work is that "a" is a string the object requires a character/char 'a' so in short "a" = string 'a' = character Ahhh okay. Thanks for that! I will keep that in mind for the future. At first it seemed an odd little quirk but when I started looking and really thinking about the construction of addRecipe, it makes sense that they are considered different. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.