#mob effect to get regen and more hp on damage
14 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
Paste version of Perfect_Cycles.js from @stuck tendon
its my first time using kubejs
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"
)}
})
it doesnt work but with the changes u mentioned would it?
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
Does the wiki have this stuff?
You wish - documenting KubeJS would mean documenting all of Minecraft
ProbeJS or ProbeJS Legacy - it isn't a VS Code extension, but dumps TypeScript types that your editor can consume to provide hints
(It is also a VSCode extension but I believe that’s only for 1.21 :/)