Deli_SK Posted September 15, 2014 Posted September 15, 2014 Hello I have a question. As I wanted to do a simple research for block harvest levels and block harvest tools, I found that I can't get that information. Basically I want to create a csv for spreadsheet with as much info from block as possible: try{ File file = new File("C:\\Temp\\blocks.txt"); if (!file.exists()) file.createNewFile(); PrintWriter w = new PrintWriter(file); for (Object aBlockRegistry : Block.blockRegistry) { Block block = (Block) aBlockRegistry; w.print(block.getUnlocalizedName()); w.print(","); w.print(block.getBlockHardness(null, 0, 0, 0)); w.print(","); Material material = block.getMaterial(); w.print(material == Material.rock ? "rock" : (material == Material.wood ? "wood" : "unknown")); w.print(","); w.print(block.getHarvestLevel(0)); w.print(","); w.print(block.getHarvestTool(0)); w.println(); } w.close(); } catch (Exception e){ System.out.println(e.getStackTrace()); } [/Code] The result looks weird, as harvest level is always -1 and harvest tool is always null [Code] tile.stairsWood,2.0,wood,-1,null tile.chest,2.5,wood,-1,null tile.redstoneDust,0.0,unknown,-1,null tile.oreDiamond,3.0,rock,-1,null tile.blockDiamond,5.0,unknown,-1,null tile.workbench,2.5,wood,-1,null [/Code] What am I doing wrong? Quote I come here to ask only after several hours of struggling, forum browsing and googling. Please be kind
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.