#Create Block Error
28 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
this is the code
global.substrate_mapping[id] = {
category: category_index,
index: substrate_index,
name: name.replace(" Reagent", "").replace(" Catalyst", "")
}
current_category.push({
id: `kubejs:substrate_${id}`,
ingredient: ingredient,
outputItem: outputItem
})
event.create(`substrate_${id}`)
.material('glass')
.color(0, color)
.color(1, color)
.hardness(0.1)
.box(.25, 0, .25, .75, 14.0 / 16.0, .75, false)
.model("kubejs:block/jar/" + model)
.displayName(name)
.renderType("cutout")
.item(e => e.rarity(model == "catalyst" ? RARITY_UNCOMMON : RARITY_COMMON)
.color(0, c1))
substrate_index++
}
let createReagent = (color, id, prefix, ingredient, outputItem) => substrate_base(color, id, `${prefix} Reagent`, "substrate", ingredient, outputItem)
let catalyst = (color, id, prefix, ingredient) => substrate_base(color, id, `${prefix} Catalyst`, "catalyst", ingredient)
let reagent = (id, prefix, item, color) => ({id, prefix, item, color})
let IGNEOUS = {
c1: 0x6C8191,
reagents: [
reagent("andesite", "Andesite", "minecraft:andesite", 0x868887)
]}
IGNEOUS.reagents.forEach(builder => {
createReagent(builder.color, builder.id, builder.prefix, builder.item)
})
})```
this is the log
Paste version of startup.txt from @tranquil bay
This is a list of all the events. Choose your version.
which line is 85?
also can you add some syntax highlighting to that codeblock, its hard to read with it all being white
im making the function add properties to an object and put the object in the IGNEOUS array. Then im making the loop to create the object
im not even sure if that would be valid code in normal JS, ive never seen that before
but either way with Rhino you need to provide a key, it cannot default it
let reagent = (id, prefix, item, color) => ({id: id, prefix: prefix, item: item, color: color})
I've just checked, it is valid code in normal js
however, this isn't normal js 
I have another question. Can I add the color with no index ?
should be able to
How to write that ?
just remove the first param
It showing the error texture
the log show this [01:39:58] [ERR ] Error occurred while handling event 'block.registry': Can't find method dev.latvian.mods.kubejs.block.BlockBuilder.color(number). (startup_scripts:launch/blockRegistry.js#76)
public BlockBuilder color(int index, Color c) {
color.put(index, c.getArgbJS());
return this;
}
ye nevermind, you need an index
Ok. Thanks for the help