Started by
siiiiid
on
Topic category: Help with Minecraft modding (Java Edition)
I'm trying to make a fluid tank that is interactable with buckets but when I try to take fluid out the bucket fills up and then immediately drains back in. How can I make it so it only drains or fills one bucket once per right click on the tank?
Sometimes for this sort of thing it can actually be helpful to make a really short timer to prevent double triggering stuff. You could either just use the 'cooldown item' function to literally cooldown the item a little bit, preventing the player from right clicking with it for a couple ticks or two; or if you want it to be more hidden, you can make a player-persistant number variable, have a procedure that decreases the variable by one every tick if it's above zero, check if the variable is at zero before allowing the right-click procedure to run, and set the variable to 10 or something whenever you successfully right click.
Essentially, you need to build in a slight delay. There's some different ways you can do it.