Immersive Engineering

Immersive Engineering

134M Downloads

[Suggestion] API method for determining if damage source is electrical wiring

desht opened this issue ยท 2 comments

commented

This would be handy for other mods to allow protection from electrical damage from wiring. For example, the Pneumatic Chestplate from PneumaticCraft protects from IE electrical damage (at an air cost) with the appropriate upgrade added. Unfortunately to do this right now, I need to do:

if (event.getSource() instanceof IEDamageSources.ElectricDamageSource) {
    ...
}

...which I feel bad about doing, because IEDamageSources is not in the API. A simple method (say boolean isElectricalWiringDamage(DamageSource source) in ApiUtils?) would be nice to have here.

commented

How about

event.getSource().damageType == Lib.DMG_WireShock

?

The Lib class is in the API, and that is the constant used for the wire damage.

commented

Aha, I missed that, thanks!