#How I can fix my code?

48 messages · Page 1 of 1 (latest)

robust hedge
#

// Register items
StartupEvents.registry('item', event => {
// Register the Kinetic Mechanism
event.create('kinetic_mechanism').displayName('Kinetic Mechanism');
event.create('incomplete_kinetic_mechanism').displayName('Incomplete Kinetic Mechanism'); // Transitional item
});

// Define recipes
StartupEvents.registry(event => {
const transitional = 'kubejs:incomplete_kinetic_mechanism';

// Sequenced Assembly for the Kinetic Mechanism
event.recipes.createSequencedAssembly([
    'kubejs:kinetic_mechanism', // Output
], '#minecraft:wooden_slabs', [ // Input
    // Steps in the Sequenced Assembly
    event.recipes.createDeploying(transitional, [transitional, CR('andesite_alloy')]),
    event.recipes.createDeploying(transitional, [transitional, CR('andesite_alloy')]),
    event.recipes.createDeploying(transitional, [transitional, 'tfmg:screw']) // Changed to 'tfmg:screw'
])
.transitionalItem(transitional) // Transitional item
.loops(1) // Number of loops
.id('kubejs:kinetic_mechanism'); // Unique ID for this recipe

// Shapeless crafting recipe for manual crafting
event.shapeless(KJ('kinetic_mechanism'), [
    'tfmg:screw', // Changed to 'tfmg:screw'
    CR('cogwheel'),
    CR('andesite_alloy'),
    '#minecraft:logs'
]).id("kubejs:kinetic_mechanism_manual_only");

});

sonic galeBOT
#

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

robust hedge
#

Log:
[14:45:21] [INIT] KubeJS 2001.6.5-build.16; MC 2001 forge
[14:45:21] [INIT] Loaded plugins:
[14:45:21] [INIT] - dev.latvian.mods.kubejs.forge.BuiltinKubeJSForgePlugin
[14:45:21] [INIT] - dev.latvian.mods.kubejs.forge.BuiltinKubeJSForgeClientPlugin
[14:45:21] [INIT] - net.mehvahdjukaar.sawmill.integration.KubeJsPlugin
[14:45:21] [INIT] - dev.ftb.mods.ftbxmodcompat.ftbquests.kubejs.KubeJSIntegration
[14:45:21] [INIT] - dev.ftb.mods.ftbxmodcompat.ftbteams.kubejs.FTBTeamsKubeJSPlugin
[14:45:21] [INIT] - pie.ilikepiefoo.kubejsoffline.OfflinePlugin
[14:45:21] [INIT] - dev.latvian.mods.kubejs.create.KubeJSCreatePlugin
[14:45:21] [INIT] - pie.ilikepiefoo.AdditionsPlugin
[14:45:21] [INIT] - pie.ilikepiefoo.compat.jei.JEIKubeJSPlugin
[14:45:21] [INIT] - moe.wolfgirl.probejs.plugin.BuiltinProbeJSPlugin
[14:45:21] [INIT] - com.almostreliable.lootjs.kube.LootJSPlugin
[14:45:21] [INIT] - com.blakebr0.cucumber.compat.kubejs.CucumberKubeJSPlugin
[14:45:24] [INFO] example.js#5: Hello, World! (Loaded startup scripts)
[14:45:24] [INFO] Loaded script startup_scripts:example.js in 0.258 s
[14:45:24] [ERROR] ! kinetic_mechanism.js#9: Event handler 'StartupEvents.registry' requires extra id!
[14:45:24] [INFO] Loaded script startup_scripts:kinetic_mechanism.js in 0.076 s
[14:45:24] [INFO] Loaded script startup_scripts:zinc_casing.js in 0.002 s
[14:45:24] [INFO] Loaded 3/3 KubeJS startup scripts in 2.633 s with 1 errors and 0 warnings

ebon slate
#

try replacing
StartupEvents.registry(event => { with ServerEvents.recipes(event => { (in Define recipes)

silent egretBOT
#

Paste version of message.txt from @robust hedge

ebon slate
#

#1 all StartupEvents must be created in startup scripts

robust hedge
# ebon slate #1 all StartupEvents must be created in startup scripts

[20:48:02] [INIT] KubeJS 2001.6.5-build.16; MC 2001 forge
[20:48:02] [INIT] Loaded plugins:
[20:48:02] [INIT] - dev.latvian.mods.kubejs.forge.BuiltinKubeJSForgePlugin
[20:48:02] [INIT] - dev.latvian.mods.kubejs.forge.BuiltinKubeJSForgeClientPlugin
[20:48:02] [INIT] - net.mehvahdjukaar.sawmill.integration.KubeJsPlugin
[20:48:02] [INIT] - dev.ftb.mods.ftbxmodcompat.ftbquests.kubejs.KubeJSIntegration
[20:48:02] [INIT] - dev.ftb.mods.ftbxmodcompat.ftbteams.kubejs.FTBTeamsKubeJSPlugin
[20:48:02] [INIT] - pie.ilikepiefoo.kubejsoffline.OfflinePlugin
[20:48:02] [INIT] - dev.latvian.mods.kubejs.create.KubeJSCreatePlugin
[20:48:02] [INIT] - pie.ilikepiefoo.AdditionsPlugin
[20:48:02] [INIT] - pie.ilikepiefoo.compat.jei.JEIKubeJSPlugin
[20:48:02] [INIT] - moe.wolfgirl.probejs.plugin.BuiltinProbeJSPlugin
[20:48:02] [INIT] - com.almostreliable.lootjs.kube.LootJSPlugin
[20:48:02] [INIT] - com.blakebr0.cucumber.compat.kubejs.CucumberKubeJSPlugin
[20:48:07] [INFO] example.js#5: Hello, World! (Loaded startup scripts)
[20:48:07] [INFO] Loaded script startup_scripts:example.js in 0.347 s
[20:48:07] [ERROR] ! kinetic_mechanism.js#9: Unknown event 'StartupEvents.recipes'!
[20:48:07] [INFO] Loaded script startup_scripts:kinetic_mechanism.js in 0.068 s
[20:48:07] [INFO] Loaded script startup_scripts:zinc_casing.js in 0.004 s
[20:48:07] [INFO] Loaded 3/3 KubeJS startup scripts in 3.982 s with 1 errors and 0 warnings

ebon slate
silent egretBOT
#

Paste version of message.txt from @robust hedge

ebon slate
#

recipes and items must be in different files!

#

you can't do both ServerEvents and StartupEvents in the same file

robust hedge
#

// Register items
ServerEvents.registry('item', event => {
// Register the Kinetic Mechanism
event.create('kinetic_mechanism').displayName('Kinetic Mechanism');
event.create('incomplete_kinetic_mechanism').displayName('Incomplete Kinetic Mechanism'); // Transitional item
});

// Define recipes
ServerEvents.recipes(event => {
const transitional = 'kubejs:incomplete_kinetic_mechanism';

// Sequenced Assembly for the Kinetic Mechanism
event.recipes.create.sequencedAssembly([
    'kubejs:kinetic_mechanism' // Final output
], 
'#minecraft:wooden_slabs', // Initial input
[
    // Add assembly steps
    event.recipes.create.deploying(transitional, [transitional, 'create:andesite_alloy']),
    event.recipes.create.deploying(transitional, [transitional, 'create:andesite_alloy']),
    event.recipes.create.deploying(transitional, [transitional, 'tfmg:screw'])
])
.transitionalItem(transitional) // Specify transitional item
.loops(1) // Number of assembly loops
.id('kubejs:kinetic_mechanism_sequenced'); // Unique recipe ID

// Manual crafting recipe for the Kinetic Mechanism
event.shapeless('kubejs:kinetic_mechanism', [
    'tfmg:screw',
    'create:cogwheel',
    'create:andesite_alloy',
    '#minecraft:logs'
]).id('kubejs:kinetic_mechanism_manual');

});

I need to remove this // Register items
ServerEvents.registry('item', event => {
// Register the Kinetic Mechanism
event.create('kinetic_mechanism').displayName('Kinetic Mechanism');
event.create('incomplete_kinetic_mechanism').displayName('Incomplete Kinetic Mechanism'); ?

ebon slate
#

yes but no, move Register items to a separate file and fix ServerEvents.registry

royal ermine
#

no

#

in yous startup_scripts should be this:

StartupEvents.registry('item', event => {
    // Register the Kinetic Mechanism
    event.create('kinetic_mechanism').displayName('Kinetic Mechanism');
    event.create('incomplete_kinetic_mechanism').displayName('Incomplete Kinetic Mechanism'); // Transitional item
});

and in your server_scripts should be this:

ServerEvents.recipes(event => {
    const transitional = 'kubejs:incomplete_kinetic_mechanism';

    // Sequenced Assembly for the Kinetic Mechanism
    event.recipes.create.sequencedAssembly([
        'kubejs:kinetic_mechanism' // Final output
    ], 
    '#minecraft:wooden_slabs', // Initial input
    [
        // Add assembly steps
        event.recipes.create.deploying(transitional, [transitional, 'create:andesite_alloy']),
        event.recipes.create.deploying(transitional, [transitional, 'create:andesite_alloy']),
        event.recipes.create.deploying(transitional, [transitional, 'tfmg:screw'])
    ])
    .transitionalItem(transitional) // Specify transitional item
    .loops(1) // Number of assembly loops
    .id('kubejs:kinetic_mechanism_sequenced'); // Unique recipe ID

    // Manual crafting recipe for the Kinetic Mechanism
    event.shapeless('kubejs:kinetic_mechanism', [
        'tfmg:screw',
        'create:cogwheel',
        'create:andesite_alloy',
        '#minecraft:logs'
    ]).id('kubejs:kinetic_mechanism_manual');
});
robust hedge
#

@royal ermine @ebon slate both codes do not work

royal ermine
#

send your logs (Startup & Server) and files

robust hedge
silent egretBOT
#

Paste version of kinetic_mechanism.js from @robust hedge

robust hedge
silent egretBOT
#

Paste version of incomplete_kinetic_mechanism.js from @robust hedge

robust hedge
#

Code don't add crafts, but add items

royal ermine
#

you try it, if the recipe shows in JEI/Emi/Rei ?

#

or you try to crafting it?

robust hedge
royal ermine
#

try to craft it

#

if no errors appear in the server log the recipe should work, then it's only Jei which is anyway buggy^^

robust hedge
silent egretBOT
#

Paste version of message.txt from @robust hedge

robust hedge
royal ermine
#

may this will works:
Startup:

StartupEvents.registry('item', event => {
    event.create('kinetic_mechanism').displayName('Kinetic Mechanism');
    event.create('incomplete_kinetic_mechanism', 'create:sequenced_assembly').displayName('Incomplete Kinetic Mechanism');
});

Server:

ServerEvents.recipes(event => {
    let transitional = 'kubejs:incomplete_kinetic_mechanism';
    event.recipes.create.sequenced_assembly('kubejs:kinetic_mechanism', '#minecraft:wooden_slabs',
    [
        event.recipes.createDeploying(transitional, [transitional, 'create:andesite_alloy']),
        event.recipes.createDeploying(transitional, [transitional, 'create:andesite_alloy']),
        event.recipes.createDeploying(transitional, [transitional, 'tfmg:screw']),
    ])
    .transitionalItem(transitional).loops(1).id('kubejs:kinetic_mechanism_sequenced');
    
    event.shapeless('kubejs:kinetic_mechanism', [
        'tfmg:screw',
        'create:cogwheel',
        'create:andesite_alloy',
        '#minecraft:logs'
    ]).id('kubejs:kinetic_mechanism_manual');
});
robust hedge
#

Can you help me with sound when block placed and braked?

#

StartupEvents.registry('block', event => {
event.create('zinc_machine')
.displayName('Zinc Casing')
.texture('up', 'kubejs:block/zinc_machine_top')
.texture('down', 'kubejs:block/zinc_machine_bottom')
.texture('north', 'kubejs:block/zinc_machine_side')
.texture('south', 'kubejs:block/zinc_machine_side')
.texture('east', 'kubejs:block/zinc_machine_side')
.texture('west', 'kubejs:block/zinc_machine_side')
.mapColor('metal') // Updated material to mapColor
.soundType('metal') // Updated soundType to use the correct method
.hardness(6) // Fixed to use a numeric value (not string)
.resistance(100) // Fixed to use a numeric value (not string)
.tagBlock('minecraft:mineable/pickaxe')
.tagBlock('minecraft:iron_block')
.requiresTool(true);
});

robust hedge
#

How I can make craft where tool(axe) lose durability but not consumed?

robust hedge
#

@royal ermine Can you help me with sound when block placed and braked?

royal ermine
#

what are wrong with your block registry code? if i try with it it works

robust hedge
robust hedge
royal ermine
#

it depends on the crafting type but i don't know,
and your code works for the sound i have tried it with 4 or 5 different types including the metal type, so it's not a code related problem