Damage Sources
Package: thaumcraft.api.damagesource
Author: Azanor
Thaumcraft provides custom damage sources for various in-game hazards and attacks.
DamageSourceThaumcraft
File: DamageSourceThaumcraft.java
Custom damage source class for Thaumcraft-specific damage types.
Static Instances
| Damage Source | String ID | Properties |
|---|---|---|
taint |
"taint" |
Bypasses armor, magic damage |
tentacle |
"tentacle" |
Standard damage |
swarm |
"swarm" |
Standard damage |
dissolve |
"dissolve" |
Bypasses armor |
Static Factory Methods
| Method | Description |
|---|---|
causeSwarmDamage(EntityLivingBase) |
Creates an EntityDamageSource with ID “swarm” |
causeTentacleDamage(EntityLivingBase) |
Creates an EntityDamageSource with ID “tentacle” |
Example Usage
// Direct damage source
entityLivingBase.attackEntityFrom(DamageSourceThaumcraft.taint, damage);
// From an entity (creates EntityDamageSource)
entityLivingBase.attackEntityFrom(DamageSourceThaumcraft.causeSwarmDamage(player), damage);
DamageSourceIndirectThaumcraftEntity
File: DamageSourceIndirectThaumcraftEntity.java
Extends: EntityDamageSourceIndirect
For projectile or indirect entity damage from Thaumcraft sources (e.g., arrows fired by Taint mobs).
Constructor
public DamageSourceIndirectThaumcraftEntity(String par1Str, Entity par2Entity, Entity par3Entity)
par1Str: Damage source string identifierpar2Entity: The entity that caused the damage (e.g., the shooter)par3Entity: The entity that was used as a projectile
Fluent Setters
| Method | Description |
|---|---|
setFireDamage() |
Marks damage as fire-based |
setDamageBypassesArmor() |
Makes damage ignore armor |
Example Usage
DamageSourceIndirectThaumcraftEntity source =
new DamageSourceIndirectThaumcraftEntity("taintarrow", shooter, arrow);
source.setFireDamage();
entityLivingBase.attackEntityFrom(source, damage);
Damage Source Properties
Thaumcraft damage sources can be configured with the following properties:
- Bypasses Armor: Damage is not reduced by armor
- Magic Damage: Affected by magic resistance/enchantments
- Fire Damage: Can ignite the target
- Projectile: Damage from ranged sources
Tags
#api #entity #damage #combat