Startup Script:
const $DamageSource = Java.loadClass(`net.minecraft.world.damagesource.DamageSource`)
/** Register effects */
StartupEvents.registry('mob_effect', event => {
// Register radiation effect
event.create('radiation')
// Change the name to be "Radiation", in green
.displayName(Component.green("Radiation"))
// Set a tick event to apply the action
.effectTick((entity, lvl) => global.radiationEffect(entity, lvl))
// Set the color of the effect
.color(Color.GREEN)
// Set whether the effect is harmful
.harmful();
})
/**
* Applies the radiation effect.
* Damages the entity (likely player) with 2 HP (1 hearts) per 10 ticks.
*
* @param {Internal.Entity} entity The entity to apply the effect to
* @param {number} lvl The level of the effect
*/
global.radiationEffect = (entity, lvl) => {
// Create damage source
let damagesource = new $DamageSource('radiation')
// Check if the global is run on the client. If so, return
if (entity.level.clientSide) return;
// Damage based on level
entity.attack(damagesource, lvl + 1);
}```
Client Script:
```js
/** Add language entries */
ClientEvents.lang('en_us', (e) => {
// Effect / Radiation
e.add("death.attack.radiation", "%1$s died in a horrible way");
})```
You can add an icon to go along with the effect by just dropping an 18px by 18px image over in ``kubejs/assets/kubejs/mob_effect/radiation.png`` - words of wisdom by @modest current
Credit to @sullen roost and @carmine wyvern
@oak saffron 's 1.18 version here in: [#1170471805148999751 message](/guild/303440391124942858/thread/1170471805148999751/p/1170471805148999751/#msg-1170696177126223922)
@fleet ferry 's 1.20 Successful Port here:
[#1183085911974608977 message](/guild/303440391124942858/thread/1183085911974608977/p/1183085911974608977/#msg-1183419350519132200)










