Posted October 22, 201510 yr I have a cutom pickaxe called enderPickaxe. I want the pickAxe to double all ores and smelt it. The code I have will double and smelt anything that is smeltable.How would i finds ores only so mining a log or cobble won't double and smelt it. Is there a function like boolean isOre(ItemStack x) that would make it easy to check. This is how I currently do it @SubscribeEvent public void onBlockHarvest(HarvestDropsEvent event) { if(event.harvester.getHeldItem()!=null&&event.harvester.getHeldItem().getItem() instanceof enderPickaxe) { ItemStack stack = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(event.block,1,event.blockMetadata)); if(stack!=null) { ItemStack x=new ItemStack(stack.getItem(),2); event.drops.clear(); event.drops.add(x); } } }
October 22, 201510 yr That won't necessarily work. You've dropped the metadata from the smelting result. It also ignores ore blocks that don't drop blocks, but items, which can then be smelted, you'd need to look at the event.drops arraylist. That said, to answer your question: OreDictionary.getOreName(OreDictionary.getOreIDs(stack)); Note that that is not valud code, as getOreIDs() returns an array. 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.
October 22, 201510 yr Author if(OreDictionary.getOreIDs(stack)[0]!=0) the array contains integer of all ids associated with the ore. I just check if it has a value or is the initial value of zero. would something like this work to check if it is an ore. The other points you mention yes I realize it and I will fix it so it checks if it is smelt able then smelt it and double and if the drops are items then double it.
October 22, 201510 yr Stone is registered "stone" in the oredict, along with other blocks. So "is it an ore" may not be true. 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.
October 22, 201510 yr Author I guess that leaves me with getting the name of the block and using blockname.contain("Ore") to check if "Ore" is in it.
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.