Jump to content

[SOLVED][1.19.4] Replace a block before is actually placed into the world


Recommended Posts

In my mod I'm making so that if the player tries to place some glass panes while sneaking it will be placed another block (a horizontal glass pane). To do so I'm listening to the block place game event and so far everything works. However for a split fraction you can see the vanilla glass pane before it gets replaced by the mod block. Is there any way to prevent this and instead just straight forward place the mod block without placing the vanilla block and then the modded one?

You can see how I replace the block here:

By the way I've also tried listening to the BlockEvent.EntityPlaceEvent, cancelling and then set my own block, but that didn't worked at all (and not cancelling the event would produce the same result where you can see the placed block before is replaced) 

Edited by JimiIT92

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

It's not possible unless it is your block so can you override the logic in BlockItem.place()

This is because the vanilla client is simulating what it thinks should happen to give more immediate feedback to the player.


The vanilla BlockItem already places the block on the client side before calling the server where the event can decide a different block should be placed.

A similar thing happens when you cancel the block break event. The client momentarily displays the block as gone.


If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

  • JimiIT92 changed the title to [SOLVED][1.19.4] Replace a block before is actually placed into the world

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.

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.


  • Create New...

Important Information

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