Started by
Taras Ogurtsov
on
Topic category: Help with Minecraft modding (Java Edition)
Hey, everybody. In my mod there are items that can be placed as a block, and I want to make it so that if a block in x y z replaceable (such as grass, snow, etc.) then it is replaced, not put a block on y + 1. Please help!
I imagine you would make a procedure with the global trigger 'player right clicks block,' then make a tag for blocks you want to be replaceable. If the block the player right clicked is replaceable, and the item in their main hand is one of your custom blocks, swing their main hand, place the block at the correct position, and shrink the item in their main hand for one if they don't have creative mode enabled.
I may have worded it wrong, but I want to know how to check if the block I click on is replaceable? Something like "Is the block in x y z replaceable?". I couldn't find anything like that in Block data.
Oh, I think I've already found the solution myself. Thanks for your help anyway!
Could you share a picture of your procedure for those who want to do the same please ?
https://imgur.com/
Generally speaking, if a block doesn't have a solid top surface, it's replaceable, so you could check for that. But I would recommend making a custom tag for what you want to be replaceable, just so you don't have to worry about any weird edge cases.
Here, as requested above, is a screenshot of the whole procedure. I think you will find the information you need in it. It should be clarified that in this case only plant type blocks will be replaced. If you want to add other replaceable blocks to this list that are not plants, you must add the tag to which these blocks belong. If you still have more questions, I'd be happy to help you!
nice, i appreciate it :), one question though, does the play buttom have synchronisation issue between client and server ?
I saw that you put them in an if statement client-side world
To be honest, I haven't tested my mod in multiplayer yet, but in single player mode everything works fine. I added this check so that the sound plays correctly. There is an issue that if you just play the sound, it duplicates for some reason, but with this check the sound plays correctly.