#Registering a new Paintslinger block for Botania

1 messages · Page 1 of 1 (latest)

thick jungle
#

i wanna interface with the botania api and use it to register new blocks for the paintslinger lens, and i'm wondering if there's any way to do this with kubejs
i know you can use java reflections n stuf but it seems like a more complicated affair than just using kubejs but i wanna know if it's even possible
here's the relevant file https://github.com/VazkiiMods/Botania/blob/1.20.x/Xplat/src/main/java/vazkii/botania/api/BotaniaAPI.java

GitHub

A tech mod for Minecraft themed around the magic of nature and plant life. - VazkiiMods/Botania

alpine hollowBOT
#

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

wintry fossil
#

it's actually fairly easy to do.... how simple you can make it down to will depend on your block names and such
in this example

const $BotaniaAPI = Java.loadClass("vazkii.botania.api.BotaniaAPI")

ServerEvents.recipes(event => {
    const botaniaAPI = $BotaniaAPI.instance()
    Ingredient.of("#thermal:rockwool").itemIds.forEach(id => {
        botaniaAPI['registerPaintableBlock(net.minecraft.resources.ResourceLocation,java.util.function.Function)'](id, dye => {
            var blockid = "thermal:" + dye.getName() + "_rockwool"
            return Block.getBlock(blockid)
        })
    })
})

I'm letting any thermal rockwool convert into any other thermal rockwool...

#

so I'm taking all the items in the thermal:rockwool tag, iterating over them, registering each block it's own conversion function, and then passing the block's id and the function to the register function

#

luckily the thermal blocks are all thermal:dye_rockwool so my return function is super easy

#

because the only thing that gets passed into the function is the dye color

#

could be something @quick lance may think about adding to kjs-botania

thick jungle
#

that works pretty well, thanks!