#Give item on receiving status effect
16 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
if you only want to give it once, you could listen for the advancement to be triggered. Another option is to modify the loot table's for the villagers on what their gift is that they give to the hero of the village
The goal is to give a single progression item (a netherite ingot for example) each time a raid is completed.
there is a forge event when an effect is added to an entity
so you could check for it to be a player, and be the correct effect, and then give the item
in startup_scripts:
const $MobEffects = Java.loadClass('net.minecraft.world.effect.MobEffects')
ForgeEvents.onEvent('net.minecraftforge.event.entity.living.MobEffectEvent$Added', event => {
const { entity, effectInstance } = event
if (entity.isPlayer()) {
if (effectInstance.effect == $MobEffects.HERO_OF_THE_VILLAGE) {
entity.give("minecraft:netherite_ingot")
}
}
})
You're an actual life-saver, thank you! I was trying to muddle through figuring out which forge event it would be (let alone how to reference it) and trying to use kubejs debugging to get info as a relative noob was not helping 😂
This makes a lot of sense, though!
I keep a copy of forge code so I can just pop it open in an ide and search for what I'm looking for 😄
suppose you could do it with github search as well, but I'm not the biggest fan since it only searches the default branch
I've just started dipping my toe into dev through kubeJS this past month and a half for modpack work so I have no idea where anything is or what does what yet 😂
you pick up a lot hanging out in here
Only thing I've got going for me is a background in HTML/CSS and some computer-science independent study so I can read code snippets and usually go "ah yes, I see what's happening"
Just tested the script and it worked flawlessly! Thanks again! 
no problem
Ticket closed!