#Can KubeJS use Custom Colormaps?
54 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
All it is, is the grass_top overlay with some erased.
I want the grass's colormap to be on this, just use the exact same map, "be grass"
I even copied grass block's block model and colormap folder into kubejs's folder, and nothing
Can kubejs really not make plants/foliage?
probably
its just a method in a class (BlockColors or smthn) that you call and pass a colour getter to
how 😮
It hard looking in the code
so i never know whats a js function or some other function defined only for the mod's behind the scene stuff
event.create('grass_overlay_light').material('grass').hardness(0.1).displayName('Grass Overlay Light').box(0,0,0,16,1,16,true).defaultCutout().noCollision().waterlogged().model('kubejs:blocks/grass_overlay_light')
this is the code in startup scripts
best i got was color() making the texture only black
i have no idea if kubejs has a built in way or how that works
but if it does thats probably better
color() looks to take an int and a color (in the form 0xAARRGGBB probably), then pop those into a map
not sure what thats used for (searching code on mobile is annoying
Does it seem like this is a way to get grass's colormap/tint? Or should there be a easier way?
Didnt expect making grass blocks was gonna be this hard tbh xD
AH HA
found it
i have no idea what the index passed there is for
but grass blocks use the level and the pos
so youll have to Java.loadClass() that ColorHandlerRegistry in a client script, and pass the required stuff in
the actual method to get the grass colour at a position would need to be found by lookimg at what grass blocks use
this all seems very advanced xD
Soo, how do i find stuff?
Every time i try it just doesnt work
no idea, havent used that site
it looks like vscode, so that search should work, but 🤷
somehow i found every method shown in this wiki page: https://mods.latvian.dev/books/kubejs-legacy/page/custom-blocks
This is a startup script.
onEvent('block.registry', event => {
event.create('test_block')...
EXCEPT the one i tried to search for XD
idk how my luck is this afwul
how do i improve on finding things about this mod?
The wiki only says so much and what it doesnt say is really hard to find, just blind luck on the github atm
looking at the github or wiki wont help you here
youd need to look at a mod with custom foliage/grass or minecraft itself
the first just requires finding an open source mod that does that, the second requires an ide setup to decompile mc
umm, i might have to just stop here xD
idk much coding so both of those seem rather out of my reach, sry for the bother
guess i cant use natural textures in this mod yet
Do i close this? I assumed forums only meant to closed if they got a finished answer
if you dont close it then the forum bot will remind you about it in a montn
it will vanish from your channel list after 3 days tho
Just because someone said it isn't possible doesn't mean it actually is. Instead they meant that no one has successfully done it yet.
Be the first!
Is this worth making a post in feature requests?
yes
May i ask you to in your free time?
I can, but your the smarter one here who can say it much more clearly xD
ill add a comment to it
k
its much easier to see the gaps when you didnt build the wall
the wall?
in this case a forum posy
ah
its easier to see what info is missing if someone else starts it
const $ColorHandlerRegistry = Java.loadClass('dev.architectury.registry.client.rendering.ColorHandlerRegistry')
const $BiomeColors = Java.loadClass('net.minecraft.client.renderer.BiomeColors')
const $GrassColor = Java.loadClass('net.minecraft.world.level.GrassColor')
StartupEvents.postInit(event => {
$ColorHandlerRegistry.registerBlockColors((state, level, pos, index) => {
if (level != null && pos != null){
return $BiomeColors.getAverageGrassColor(level, pos)
}
else {
return $GrassColor.get(0.5, 1.0)
}
}, 'kubejs:grass_block')
$ColorHandlerRegistry['registerItemColors(net.minecraft.client.color.item.ItemColor,net.minecraft.world.level.ItemLike[])']((stack, index) => {
return $GrassColor.get(0.5, 1.0)
}, Item.of('kubejs:grass_block').item)
})```
that looks about right
though you will want to use the client post init event and do it in client scripts so you dont crash dedi servers who dont have those classes
Startup wasn't my first choice, but I couldn't find a post init event for client
@novel pawn Unresolved thread still hasn't been closed! If your question was answered, please close this post with </ticket close:1054771505520717835> command!