#Is it possible to make a custom bucket with KubeJS?
52 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
yes you can do https://kubejs.com/wiki/tutorials/fluid-registry
I meant custom bucket as in a new item that functions like a bucket that you can use to pick up a fluid and place down. Is this possible?
i believe it does all that in the fluid builder, at least thats what it's saying
you can choose to not have a bucket and make it unplaceable with js .noBucket() too apparently
No, they want a container-type bucket, not the fluid that goes in the bucket. So we have the iron bucket, but also the wood bucket or copper bucket or whatever they want to make. Which then we have wood bucket of water, wood bucket of lava, etc.
Basically, for each fluid that exists (which I don't have an easy way of grabbing), you need to make a new item. Then you need to use BlockEvents to find out when you right clicked a block while holding that item. If you were holding it, place the fluid block, delete the item, and give a replacement item.
Paste version of test_custom_bucket.js, bucket_test.js from @forest garnet
This will notably NOT automatically populate filling/emptying recipes for Create or other mods.
You'd have to do that yourself too. But very similar to how we looped over the array of buckets in the BlockEvents.rightClicked, you can loop over the array in recipe events too; just remember to move the array definition outside of the BlockEvents.rightClicked so that it can be accessed globally; or the lazy, less efficient way, copy/paste it into ServerEvents.recipes().
You will also need to provide your own textures.
Let me clean that up a bit, I just realized it could replace blocks in niche situations.
AND that I forgot the function to pick up the fluid into the bucket
Here, cleaned it up, added the missing functionality, and added some example recipes: Create filling/emptying
The startup scripts is the same as before.
Paste version of bucket_test.js from @forest garnet
@celest vault Your username says ping if I reply, have a look at the scripts I have provided.
Yes, I have made carrots, apples, and potatoes temporarily act as bucket items for the sake of the example, but it should get you going.
Keeping in mind, yes, you'll need to create your own item for every fluid in the pack, but the helper function in the example startup script should make that easy; except for textures, that's still up to you
Hmm. Also, picking up the fluid will only work directly adjacent to a solid block, and you can't place the fluid on top of a fluid. Someone with more experience with ray-tracing can figure that out. Whomever does it will just need to replace each instance event.block.offset(event.facing) with the ray-trace to find the nearest fluid block.
replicating bucket behaviour from a kjs script is kinda annoying
instead you should be able to let mc handle all the placing logic by making a custom BucketItem insteda
we tried that (in another recent ticket) but then we came up with this error which i assume has to do with it running before the fluid itself is registered maybe #1256401481263878164 message
Thank you! I'll take a look at this soon when I am able to
forge adds a second constructor that takes a supplier
yeah but shouldnt it be the same as the other constructor that takes a fluid
well either way that other ticket was solved with this apparently #1256401481263878164 message
[➤](#1256401481263878164 message)
like that? js StartupEvents.registry('fluid', event => { event.create('thick_fluid') .thickTexture(0xFF0000) .bucketColor(0xFF0000) .displayName('Thick Fluid') .bucketItem.modelJson({ "parent": "minecraft:item/generated", "textures": { "layer0": "kubejs:item/thick_fluid_bucket" } }) })
all they were after was the custom model/texture
Yeah, that looked like a different issue than this one.
oh yeah i wasnt suggesting it for this ticket, just explaining how one could do it if they wanted one for a specific fluid
no because the supplier doesnt resolve till after the fluid is registered
wat
then why say 'this was solved with this'
i was insinuating the other ticket was solved by the script
not the fluid supplier issue
and that makes sense
you also suggested a bucketitem using createcustom so im not sure why you're suprised i suggested something similar 
you suggested a custom fluid
i did not
"this" was refering to the other ticket
both 'this'?
probably
either way i support recreating the logic with block right click event, seems the simplest way for a universal container item
other mods wont recognise it as a fluid container
that would need capabilities yea
which i think squosh figured out how to do 
thats its own ticket though
Yeah, that's one reason there's a custom filling/emptying recipe in the server example. Actually, someone without Create installed, can you test that script and see if it breaks while the recipes are still in the script? I put "conditions" to stop it from loading if Create isn't loaded, but idk if that's dependant on the "type" loading first or not.
order doesnt matter, conditions always load before anything else
personally id use Platform.isLoaded tho, so it works on fabric
I was unawares that exists. I just grabbed forge:is_loaded out of the github for Create when looking at compatibility recipes.
I will aspire to use that in the future.
