Started by
SDBonds1234
on
Topic category: Help with Minecraft modding (Java Edition)
Hello MCreator Team,
I need assistance implementing a custom damage resistance system in MCreator 2024.4. My goal is to modify incoming damage based on an entity's NBT-stored resistance value when they are hurt by a specific custom damage type.
What I’m Trying to Achieve:
- Track the Base Incoming Damage done to an entity (basically off the "when entity is hurt" or something similar.}
- Since "Get event damage" doesn’t exist, I’m approximating i might need to somehow get the incoming damage by subtracting the entity’s new health from its previous health.
-
Apply Resistance Scaling:
- Each entity has an NBT-based resistance value (e.g.,
"warp_resistance"
). - I need to apply a damage multiplier:
-
final_damage = incoming_damage * (1 - (warp_resistance / 100))
This means that if
"warp_resistance"
is 50, the entity takes 50% reduced damage from that specific type.
Challenges I’m Facing:
- I can’t find a direct way to get the raw damage an entity takes before applying the reduction.
- The
"is provided damage source of type"
block only works in an IF statement and doesn’t directly interact with math operations for modifying damage. - I need a way to apply the multiplier on detected damage and ensure the correct reduced amount is actually dealt.
- Each entity has an NBT-based resistance value (e.g.,
-
What I Need Help With:
- How can I accurately retrieve the base damage value when the entity is hurt?
- How can I properly modify that damage using the resistance multiplier equation?
- How do I connect the
"is provided damage source of type"
block to a math function that alters the damage before it is applied? - I’m open to either Block Procedures (Mainly Block Procedures) or Code Injection solutions, as long as they work within MCreator’s framework. Any guidance on making this work properly would be greatly appreciated.
Also for clarification if there is an Alternative to NBT stored data. i am here for it. I just need a way to make this work basically.