Started by
Leilak
on
Topic category: Help with Minecraft modding (Java Edition)
im REALLY new to programming, so i wanted help with this, im trying to make an enchantment that makes that when i kill a mob, i win certain levels of xp, can someone help me with this? i know its dumb but i really cant do it
When you make a procedure, you need to make sure it has the correct dependencies. Dependencies are things that are provided by the trigger you use, that can be used in your procedure.
The dependency for 'when an entity dies' does not provide an itemstack. (It wouldn't know where to get it from.) It only provides 'entity,' 'source entity,' 'x/y/z,' and 'world' as a dependency, so these are the only external things you're allowed to reference for that trigger. But since you can reference 'source entity,' (The entity who killed the target entity, who died), you can replace 'provided itemstack' with 'item in main hand of source entity,' and this should work as intended. (There's an 'item in main hand of entity' function in entity management, but it uses the target entity by default. You need to replace it with source entity so it checks the main hand of the entity who killed, not the one who died.)
I recommend NorthWestTrees Gaming; it's a youtube channel that's a great reference for new modders! I often find it's easier to learn by watching someone else work through a process than just reading about it...