#dimensional debuff code string failling to work

11 messages · Page 1 of 1 (latest)

shell panther
#

PlayerEvents.tick(event => {
let player = event.player;
let world = player.level;
let dimension = world.dimension;

    // List of dimensions where the effect should apply
    let nerfedDimensions = [
        'minecraft:the_nether',  // Nether
        'aether:dimension',      // Aether (if using the Aether mod)
        'twilightforest:twilight_forest', // Twilight Forest
        'ad_astra:moon',         // Moon (Ad Astra mod)
        'ad_astra:mars',         // Mars (Ad Astra mod)
        'ad_astra:mercury',      // Mercury (Ad Astra mod)
        'ad_astra:venus'         // Venus (Ad Astra mod)
    ];

    // Check if the player is in one of the nerfed dimensions
    if (nerfedDimensions.includes(dimension.id)) {
        player.persistentData.overworld_tools_debuff = true;
    } else {
        player.persistentData.overworld_tools_debuff = false;
    }
});

// Modify the tool properties when used
ItemEvents.modify(event => {
    let player = event.entity;
    if (!player || !player.persistentData.overworld_tools_debuff) return;

    let item = event.item;
    let id = item.id;

    // List of affected tools and weapons
    let nerfedTools = [
        'minecraft:iron_sword',
        'minecraft:diamond_sword',
        'minecraft:netherite_sword',
        'minecraft:iron_pickaxe',
        'minecraft:diamond_pickaxe',
        'minecraft:netherite_pickaxe',
        'minecraft:golden_sword', // Optional:I can add more tools/weapons if needed
        'minecraft:stone_pickaxe'
    ];

    // Apply nerf to all tools in the affected list
    if (nerfedTools.includes(id)) {
        event.multipliers.damage = 0.9; // Reduces attack damage by 90%
        event.multipliers.miningSpeed = 0.9; // Reduces mining speed by 90%
    }
});
lethal bisonBOT
#

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

shell panther
#

I've tried adding Dimensional Progression by forcing the player to use that specfic dimension's weapons/tools

proper narwhalBOT
#

You can write your code in a codeblock by typing it between the codeblock delimiters:
Note that these are backticks, not apostrophes

```js :arrow_left:

ServerEvents.recipes(event => {
event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})

``` :arrow_left:

This example will look like this:

ServerEvents.recipes(event => {
  event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
proper narwhalBOT
#

NEVER use any AI to generate KubeJS code. They currently know very little about it, and what they do know is often outdated or false. You can instead look at the KubeJS wiki or ask for help in #1047320998199955458.

stiff charm
#

To do this you should probably use the BlockEvents.broken Event, and Check for Tool used to Break the block

shell panther
#

...

shell panther
#

but I have another issue, this recipe has no errors but won't load:
event.recipes.create.sequenced_assembly(
'advancednetherite:netherite_iron_helmet', // Output Item
'minecraft:netherite_helmet', // Input Item
[
// Step 1: Deploying Smithing Template
event.recipes.create.deploying(inter, [inter, 'minecraft:netherite_upgrade_smithing_template']),
// Step 2: Deploying Diamond onto Transitional Item
event.recipes.create.deploying(inter, [inter, 'minecraft:netherite_ingot']),
// Step 3: Filling with Lava
event.recipes.create.filling(inter, [inter, Fluid.of('minecraft:lava', 500)]),
// Step 4: Deploying iron ingot
event.recipes.create.deploying(inter, [inter, 'minecraft:iron_ingot']),
// Step 5: Pressing
event.recipes.create.pressing(inter, inter),
]
)
.transitionalItem('kubejs:incomplete_netherite_piece')
.loops(2); //Loops

proper narwhalBOT
#

You can write your code in a codeblock by typing it between the codeblock delimiters:
Note that these are backticks, not apostrophes

```js :arrow_left:

ServerEvents.recipes(event => {
event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})

``` :arrow_left:

This example will look like this:

ServerEvents.recipes(event => {
  event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
stiff charm
#

But probably it's because you haben't defined the inter variable

shell panther
#

I having issues registering 4 new tiers of knifes and it keeps giving the error of Error in 'StartupEvents.registry': TypeError: Cannot find function type in object BasicItemJS$Builder[kubejs:netherite_iron_knife]. event.create("kubejs:netherite_iron_knife")
.displayName("Netherite Iron Knife")
.texture("kubejs:item/netherite_iron_knife")
.tool('sword')
.tier('netherite')
.attackDamageBaseline(6.5)
.attackSpeedBaseline(2.0)
.fireResistant(true)