I've been using Blockbench as a room editor for a game of mine, but need a way to add just a bit more information to a cube. I'm trying to make a plugin to do so and have them exported with the json files and so far my luck hasn't been all that great.
I have this set up in the onLoad() function
new Property(Cube, "array", "obj_data");
and im using this to try to change it
onConfirm: function(data) {
Undo.initEdit({elements: Cube.selected});
Cube.selected.forEach(cube => {
cube.obj_data[0] = (data.command_type + "-" + data.ref_variable + "-" + data.value_type + "-" + data.value);
Blockbench.showToastNotification({
text: (data.command_type + "-" + data.ref_variable + "-" + data.value_type + "-" + data.value),
icon: "location_city",
expire: 2500
});
});
Canvas.updateView({
elements: Cube.selected,
element_aspects: {geometry: true},
selection: true
});
Undo.finishEdit('Add object Data');
dia_add_data.hide();
}
when i run it i get this error though
Uncaught TypeError: Cannot set properties of undefined (setting '0')
at <anonymous>:99:30
at Array.forEach (<anonymous>)
at Dialog.onConfirm (<anonymous>:98:23)
at Dialog.close (dialog.js:595:22)
at HTMLButtonElement.<anonymous> (dialog.js:683:11)
at HTMLButtonElement.dispatch (jquery.js:2:43064)
at v.handle (jquery.js:2:41048)