#mob effect to get regen and more hp on damage

14 messages · Page 1 of 1 (latest)

stuck tendon
sacred nightBOT
#

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

silk iglooBOT
#

Paste version of Perfect_Cycles.js from @stuck tendon

stuck tendon
#

its my first time using kubejs

real crest
#

You did not explain what's the error, but I see an issue:

//        v No left bracket
        if EntityEvents.hurt) {
//         ^ EntityEvents should not be used inside of event
            entity.addEffect('minecraft:regeneration', 60, 4, false, false)
            .modifyattribute('minecraft:generic.max_health',
//              v You did not quote this string UUID.
                ac99045f-4231-4037-98bb-667a4be07e35
                , 4
                , "multiply_base"
            )}
        })
stuck tendon
#

it doesnt work but with the changes u mentioned would it?

real crest
#

Idk, I only pointed out syntax and logical errors

#
StartupEvents.registry('mob_effect', event => {
  event
    .create('adaptation') // Resource locations cannot contain capital letters
    .effectTick((entity, potionLevel) => {
      if (entity.invulnerableTime == 0) return; // Check the entity's invincibility ticks, if not, return
      entity.potionEffects.add('minecraft:regeneration', 60, 4, false, false); // This is a more script-friendly way to add mob effects onto the entity,
      // The add method returns nothing, so there's nothing to "chain" upon.
      // Also, the method is called "modifyAttribute", not "modifyattribute" (note capital A)
      entity.modifyAttribute(
        'minecraft:generic.max_health',
        'ac99045f-4231-4037-98bb-667a4be07e35',
        4,
        'multiply_base'
      );
      // Keep in mind that this will be applied **every tick**, so maybe the choice of this event in particular is not good.
    })
    .displayName('Perfect Cycles');
});

Keep in mind the comments, so don't expect that the code works as you expected

stuck tendon
#

Does the wiki have this stuff?

real crest
#

You wish - documenting KubeJS would mean documenting all of Minecraft

stuck tendon
#

is there any sort documentation for it

#

or like extension for visual studio code?

real crest
#

ProbeJS or ProbeJS Legacy - it isn't a VS Code extension, but dumps TypeScript types that your editor can consume to provide hints

pure cave
#

(It is also a VSCode extension but I believe that’s only for 1.21 :/)