Jump to content

Get block right clicked


CraftCreeperDev

Recommended Posts

Override

onItemUse

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

Hi! How would I get the block that a player right clicked?

I want this to work only when I have a certain (custom) item in my hand. How would I achieve this?

 

you use the onBlockActivated method, like this

 

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){

	if(player.getHeldItem() != null && player.getHeldItem().getItem() == YOURITEMHERE){
                //Do SOMETHING Here
}

Link to comment
Share on other sites

Hi! How would I get the block that a player right clicked?

I want this to work only when I have a certain (custom) item in my hand. How would I achieve this?

 

you use the onBlockActivated method, like this

 

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){

	if(player.getHeldItem() != null && player.getHeldItem().getItem() == YOURITEMHERE){
                //Do SOMETHING Here
}

 

Stack traces for days.

Link to comment
Share on other sites

The itemstack, the player, the world, the x/y/z location that was clicked on, the side that was clicked, then the float version of the coordinates (x/y/z), which are not round integers (e.g. if you click the center of the top face of a block you'll get 123.5, 66.0, 432.5).

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

The itemstack, the player, the world, the x/y/z location that was clicked on, the side that was clicked, then the float version of the coordinates (x/y/z), which are not round integers (e.g. if you click the center of the top face of a block you'll get 123.5, 66.0, 432.5).

 

Bit off topic but; why is there a red explanation mark on my project?

http://prntscr.com/5n1vvt

Link to comment
Share on other sites

That means there's an error that will prevent the project from launching.

 

If its not in the source code, then there's an issue with the build path.  Right click -> build path -> configure and look for more ! in that window.

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

That means there's an error that will prevent the project from launching.

 

If its not in the source code, then there's an issue with the build path.  Right click -> build path -> configure and look for more ! in that window.

 

I have had the error before; I fixed it following the steps you showed above^ I tried it again and it doesn't seem to be working this time.

Link to comment
Share on other sites

I had the exclamation point thing happen to me before too, when I was trying to figure out how to compile my mod. I fixed it by restoring an older copy. If you do restore an older version, backup your textures because it deleted my textures when I did.

The proud(ish) developer of Ancients

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.

Announcements



×
×
  • Create New...

Important Information

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