Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.7.10] How to perform an action only if a block is shift+right clicked on.


Awesome_Spider
 Share

Recommended Posts

I am on 1.8 so no help here, BUT - notice that blocks like Workbench only 'work' when you are not sneaking. (sneaking makes you place blocks).

Use reverse-tactic (look vanilla).

 

Also - if you don't want to use player.isSneaking (or whatever the field's name is)and need that value on server, you will need to make IExtendedEntityProperties and store when the button is pressed and when not (send packet from client to server - on click "true" on unclick "false").

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

 
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float g, float t){
if (!world.isRemote && player.isSneaking()){
            //Player is Sneak + Right Clicking
        } else {
            //Player is just clicking
        }
        return true;
}

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
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.