Jump to content

[1.7.10] How to check if a tool can harvest a block?


HappyKiller1O1

Recommended Posts

So, I just need to compare if the item the player is holding has the right toolset and harvest level for the block being broken. I really have no idea how to go about this. Any suggestions?

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Link to comment
Share on other sites

I am creating a tool that breaks a 3x3 area and need to check if the blocks it is trying to break around the block that the player is breaking can be broken by the tool. So like, if you break stone it won't break the dirt around it.

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Link to comment
Share on other sites

Block#getHarvestTool(), Block#getHarvestLevel(), Block#isToolEffective()?

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.

Link to comment
Share on other sites

See, I would think that would work and would love to test it but the game is like "Oh you want to set an NBT tag on you item? Nah don't feel like it." xD

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Link to comment
Share on other sites

getHarvestTool takes an integer and returns a string.

getHarvestLevel takes an integer and returns an integer.

isToolEffective takes a string and an integer and returns a boolean.

 

I fail to see how your NBT item is relevant.

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.

Link to comment
Share on other sites

Let me explain a bit, my tool (when created) sets its stackTagCompound to not be null. With that, I set a string that is either "3x3", "5x5" or, "7x7". These are how many blocks it will mine. Basically my tag is returning null now. :P I fixed it but it did piss me off. xD Sorry about the vagueness in my previous posts.

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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