#Can KubeJS use Custom Colormaps?

54 messages · Page 1 of 1 (latest)

novel pawn
#

It's hard finding an answer for this, but i keep thinking there HAS to be a solution.
Lets say to make a custom leaf block, or custom grass blocks.
You want them to be dependent on biomes yes?

Well how?
I have this block for a grass overlay:

left templeBOT
#

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

novel pawn
#

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?

jovial axle
#

probably

#

its just a method in a class (BlockColors or smthn) that you call and pass a colour getter to

novel pawn
#

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

jovial axle
#

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

novel pawn
#

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

jovial axle
#

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

novel pawn
#

this all seems very advanced xD

#

Soo, how do i find stuff?
Every time i try it just doesnt work

jovial axle
#

no idea, havent used that site
it looks like vscode, so that search should work, but 🤷

novel pawn
#

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

jovial axle
#

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

novel pawn
#

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

jovial axle
#

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

novel pawn
#

i guess we can say the answer is kubejs just cant do it then

#

or at least not easily

jovial axle
#

its *not possible

#

??notpossible

urban dockBOT
# jovial axle ??notpossible

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!

novel pawn
#

Is this worth making a post in feature requests?

jovial axle
#

yes

novel pawn
#

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

jovial axle
#

ill add a comment to it

novel pawn
#

k

jovial axle
#

its much easier to see the gaps when you didnt build the wall

novel pawn
#

the wall?

jovial axle
#

in this case a forum posy

novel pawn
#

ah

jovial axle
#

its easier to see what info is missing if someone else starts it

molten steppe
#
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)
})```
jovial axle
#

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

molten steppe
left templeBOT
#

@novel pawn Unresolved thread still hasn't been closed! If your question was answered, please close this post with </ticket close:1054771505520717835> command!