Posted November 30, 20177 yr So I have ran into a problem. I have all my variants set up (they are ores) and working . But I can not find out how to use them in smelting recipes. Spoiler GameRegistry.addSmelting(BlockInit.ORE_OVERWORLD.getDefaultState().withProperty(VARIANT, EnumHandler.EnumType.STEEL), new ItemStack (ItemInit.INGOT_STEEL), 9); This seemed to work GameRegistry.addSmelting(BlockInit.ORE_OVERWORLD.getDefaultState().withProperty(BlockOres.VARIANT, EnumType.STEEL).getBlock(), new ItemStack(ItemInit.INGOT_STEEL,8), 1000); Edited December 1, 20177 yr by landocchi
November 30, 20177 yr 5 hours ago, diesieben07 said: This does nothing. The Block instance does not contain the state (variant in your case), only the IBlockState does. As soon as you call getBlock the metadata/state/properties are lost. You must create an ItemStack with the correct metadata. You cannot smelt blocks, only items, as blocks cannot be put in any inventory, only items (this is why ItemBlock exists). Second time this exact problem this week. The Block + Meta problem probably needs to go into the common issues thread. 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.
November 30, 20177 yr Author Lmao I don't know if i'm just dense but I still cant get it to work. The closest I come is Spoiler GameRegistry.addSmelting(new ItemStack(BlockInit.ORE_OVERWORLD.getDefaultState().withProperty(BlockOres.VARIANT, EnumType.STEEL)), new ItemStack(ItemInit.INGOT_STEEL,2), 30); but it keeps making me put .getBlock() at the end of the .withproperty(), or cast a block argument. and if I put the .getBlock() it makes steel smelt normally but my other ores will not smelt. Edited November 30, 20177 yr by landocchi
November 30, 20177 yr You can't create an ItemStack out of an IBlockState. You have to ask the block to give you an item stack for the given state (getDrop or getPickBlock) 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.
December 1, 20177 yr Author Okay I figured it out. After using all you told me I went on the forge api website and found Spoiler ItemStack(Block blockIn, int amount, int meta) Which allows me to do exactly what I was aiming for. Thank you guys! This now works perfectly! Spoiler GameRegistry.addSmelting(new ItemStack(BlockInit.ORE_OVERWORLD ,1 ,0), new ItemStack(ItemInit.INGOT_STEEL), 1.0f); Edited December 1, 20177 yr by landocchi
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.