Topic category: Help with Minecraft modding (Java Edition)
So I made a custom liquid named acid and originally I was gonna use the auto-generated bucket however I learned that there are no ways to use it in crafting recipes and there is no way to give it to the player via commands (That last part is important due to a specific block I have in my mod, but it's not important for this discussion)
So I opted to create a custom bucket for it.
I created the "acid-proof bucket"
To get it working I created the following procedure (Triggered when item right-clicked on a block):
- If Get block at x: X y: Y z: Z = Acid
- do:
- Place Air at x: X y: Y z: Z
- Remove 1 acid-proof bucket from player inventory
- add 1 acid bucket to player inventory
and the "acid bucket"
To get it working I created the following procedure (Again, triggered when item right-clicked on a block):
- Place Acid at x: X y: Y z: Z
- Remove 1 acid bucket from player inventory
- add 1 acid-proof bucket from player inventory
So what's the problem?
when right-clicking the acid with the acid-proof bucket, for some reason it doesn't get rid of the acid nor does it give me the filled version of the bucket (and yes, I made sure it was a source block). I think the problem is that Acid is technically a fluid, and has no collision box. I don't know for sure though.
When right-clicking a block with the acid bucket, it would place acid, but it would replace the block I right clicked, rather than the blocks adjacent to it. I think this is because I have it place acid on the coordinates of the right-clicked blocks, and not the coordinates of the adjacent air.
now, if I know the problem, why don't I solve it myself? well if you couldn't tell, It's because I couldn't find a solution. I couldn't find anything related to right-clicking a fluid, and I couldn't find any procedure blocks that let me place a block to the adjacent blocks.
If anyone knows the solution to either of these problems, it would mean a lot.
Thank you for your time!
- Jay
This is what I have done: https://imgur.com/a/zlXYia0
That needs a few things added, like not emptying the bucket in creative, and will only work for placing/taking liquid from the top face of a block, but it's a start.
By the way, since you are working with fluids I hope you can help me with this: do you know how to change the colour of my liquid? As you can see in my images, my fluid's texture is a very translucent white. But in-game it looks just like regular water. I guess this is related to some overlay (possibly biome specific?) that's interfering, but I have no idea on how to change that.
Thank you for helping!
As for your problem, the only possible problem I could think of is the water still and water flow images using the same texture as the water one.
That might be it. My textures are just the water textures with the values changed a bit. I'll have to try again later.
Good luck with your modding!
If I may ask, where did you put the code of the image? because if I want to remove the liquid I can't edit empty bucket code and without any trigger option if I just straight up make a procedure copying what you did it happens each time it happens each time I right click on the fluid even if I'm not using a bucket
I found something that works. But it reads only the block directly above the one being looked at, not any other blocks all around. So the player needs to keep moving the crosshairs around a little. But it works, anyway.
https://ibb.co/vPnnVL2
Where do I find the Item in entitys hand string.
Under "entity procedures" you'll find both "Item in entity's main hand" and "Item in entity's off hand".
I updated the code (https://ibb.co/w04CnBs. ). This new code checks to make sure there is a block of empty air above the one being right-clicked, and if there is air there, it will put a block of water there. The previous code I posted would instead remove whatever block is above the one right-clicked (even stone and such) and put water there.
Oh, and there is an issue with this way of filling the container, in that it will fill from any water tile, regardless of whether it is still water or flowing water. This is different from the vanilla iron bucket, which fills only from still water and not from flowing water. I can't figure out how to replicate this behaviour with the custom bucket; that is, how to get it to fill from just still water and not from flowing water. I wrote a topic on it in the forum.