Refillable items

I have been fiddling with the dev kit for a few hours trying to get an item that can be refilled like a water jar but with different mechanics, these being: fillable while swimming on the surface of water but not while underwater
I would really appreciate help with this issue