#Is it possible to make a custom bucket with KubeJS?

52 messages · Page 1 of 1 (latest)

celest vault
#

I looked through this channel and was able to find a thread on this, but it was made in 2022. Is it still not possible to make a custom bucket or has a way been implemented?

Thank you!

light stormBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

celest vault
#

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?

hearty moss
#

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

forest garnet
#

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.

forest garnet
#

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.

lethal whaleBOT
#

Paste version of test_custom_bucket.js, bucket_test.js from @forest garnet

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

forest garnet
#

Here, cleaned it up, added the missing functionality, and added some example recipes: Create filling/emptying

The startup scripts is the same as before.

lethal whaleBOT
#

Paste version of bucket_test.js from @forest garnet

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.

timid canyon
#

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

hearty moss
celest vault
timid canyon
hearty moss
#

yeah but shouldnt it be the same as the other constructor that takes a fluid

lethal whaleBOT
#

[➤](#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" } }) })

hearty moss
#

all they were after was the custom model/texture

timid canyon
#

....

forest garnet
#

Yeah, that looked like a different issue than this one.

hearty moss
#

oh yeah i wasnt suggesting it for this ticket, just explaining how one could do it if they wanted one for a specific fluid

timid canyon
timid canyon
#

then why say 'this was solved with this'

hearty moss
#

i was insinuating the other ticket was solved by the script

#

not the fluid supplier issue

hearty moss
timid canyon
#

you suggested a custom fluid

hearty moss
#

i did not

hearty moss
timid canyon
#

both 'this'?

hearty moss
#

probably

#

either way i support recreating the logic with block right click event, seems the simplest way for a universal container item

timid canyon
#

other mods wont recognise it as a fluid container

hearty moss
#

that would need capabilities yea

#

which i think squosh figured out how to do hmmm

#

thats its own ticket though

forest garnet
# timid canyon other mods wont recognise it as a fluid container

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.

timid canyon
#

order doesnt matter, conditions always load before anything else

#

personally id use Platform.isLoaded tho, so it works on fabric

forest garnet