Jump to content

Change EntityPlaceEvent position


1Mangomaster1

Recommended Posts

I have a block that is 1.5 blocks tall(by model and VoxelShape), and I want to prevent users from placing a block directly above it, as it will intersect with the block making it look really weird...
So what I did is listen to RightClickEvent and cancel it if the block that will be placed by it(EntityPlaceEvent is only server side thus cancelling it still lets it happen on the client so the block is seen placed).
However, I want it to automatically place a block above that block(where it doesn't interfare), I already managed to use Level.setBlock(BlockPos, BlockState, int) but this doesn't use sounds or particles or anything..
I tried using EventBus.Post on a RightClickEvent on the right block.. it did nothing.... I also wanted to try on EntityPlaceEvent but it requires a BlockSnapshot which idk how to obtain...

What do I do??

My end goal is to place the block naturally(sound, particles, everything, also take one off the stack if not creative) just.. only block above my one and a half blocks tall block

Link to comment
Share on other sites

I suspected soo.. I'll have to mess around with the JSON of it to understand how it works there, because I've never really done it for this kinda of thing, but I think I have an idea of how it works.. I'll update soon, thank you!

Tho... how do I manage the VoxelShape here... each part of the top and bottom has a different shape(smaller than a single block).. how do I properly have each section its own shape?

Edited by 1Mangomaster1
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.