Jump to content

canCollideCheck - Unknown flag is now not unknown


Draco18s
 Share

Recommended Posts

/**
     * Returns whether this block is collideable based on the arguments passed in Args: blockMetaData, unknownFlag
     */
    public boolean canCollideCheck(int par1, boolean par2)
    {
        return this.isCollidable();
    }

 

The par2 boolean is a flag that relates to collision raycasts, say, by the player's mouse cursor.

 

I had a dispenser-like block that I wanted to fire multiple arrows from, found that because of some offsets (so that they would be emitted from different locations, regardless of orientation) was causing some arrows to collide with the block itself.  So I looked into making the block non-collidable for that purpose.

 

Found the above function (well, knew it existed, but implemented it for an override and did this:

 

public boolean canCollideCheck(int par1, boolean par2)
    {
        return this.isCollidable() & par2;
    }

 

I could now no longer right-click interact with my block, but the arrows passed through it as desired.

 

Changed to

 

public boolean canCollideCheck(int par1, boolean par2)
    {
        return this.isCollidable() | par2;
    }

 

And retained the desired behavior and regained the ability to interact with it.

 

Scratch that, was a total fluke due to the RNG.

(There are 4 spots my arrows fire from, two of them collide, two don't, the test I thought things worked right was just a fluke of the RNG picking the two that worked).

 

Back-tracing the code it appears that this boolean is true if and only if the player right-clicks while holding a boat.  I suspect that this code is used to place the boat on top of water rather than underneath.

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

We are not the curators of vanilla code documentation.

 

I actually had no idea.

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

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 Terms of Use.