Posted November 10, 20222 yr Hey guys, I hope you can help me. Currently, I am creating a block and open a gui inside the use()-method. Now, I want to add a side check - So, that always the front side opens the gui. I looked at the parameters but I wasn't able to find the side attribute anymore (which was available in older versions). Does it still exists or is it replaced by a new one? My block has a horizontal facing property, so this has to be included as well Thanks for your help, J3ramy
November 10, 20222 yr BlockHitResult contains the getDirection method, which returns the direction of the hit result, which should help you. Subscribe to the PlayerInteractEvent.RightClickBlock and have a little look, you might find something of use there... Edited November 10, 20222 yr by MistaOmega
November 11, 20222 yr Author @MistaOmegathanks for your suggestion! I looked at what you said. For now I use the current block direction and the hit result direction. So, my method for recognizing the front face is this: private boolean isFrontFace(Direction blockDirection, Direction hitDirection){ return blockDirection == hitDirection; } And in my use()-method I call it: if(this.isFrontFace(pState.getValue(HORIZONTAL_FACING), pHit.getDirection())) ... Maybe there are different ways to check it, but this works for me Thank you! Edited November 11, 20222 yr by J3ramy
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.