Jump to content

[1.7.10] Block.getHarvestLevel(int meta) and Block.getHarvestTool(int meta)


Recommended Posts

Posted

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?

 

I come here to ask only after several hours of struggling, forum browsing and googling. Please be kind :)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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