IDamageSource 对象是实体受伤的来源。

It might be required to import the class to avoid errors.
import crafttweaker.damage.IDamageSource;

Zengetters 和无参数的 ZenMethods

Link to zengetters-和无参数的-zenmethods

ZenGetterZenMethod返回值类型
ZenGetter
harmInCreative
ZenMethod
canHarmInCreative();
返回值类型
bool
ZenGetter
damageType
ZenMethod
getDamageType();
返回值类型
string
ZenGetter
hungerDamage
ZenMethod
getHungerDamage();
返回值类型
float
ZenGetter
immediateSource
ZenMethod
getImmediateSource();
返回值类型
IEntity
ZenGetter
trueSource
ZenMethod
getTrueSource();
返回值类型
IEntity
ZenGetter
creativePlayer
ZenMethod
isCreativePlayer();
返回值类型
bool
ZenGetter
damageLocation
ZenMethod
getDamageLocation();
返回值类型
IVector3d
ZenGetter
damageAbsolute
ZenMethod
isDamageAbsolute();
返回值类型
bool
ZenGetter
damageUnblockable
ZenMethod
isDamageUnblockable();
返回值类型
bool
ZenGetter
difficultyScaled
ZenMethod
isDifficultyScaled();
返回值类型
bool
ZenGetter
explosion
ZenMethod
isExplosion();
返回值类型
bool
ZenGetter
fireDamage
ZenMethod
isFireDamage();
返回值类型
bool
ZenGetter
magicDamage
ZenMethod
isMagicDamage();
返回值类型
bool
ZenGetter
projectile
ZenMethod
isProjectile();
返回值类型
bool
ZenGetter
ZenMethod
setDamageAllowedInCreativeMode();
返回值类型
IDamageSource
ZenGetter
ZenMethod
setDamageBypassesArmor();
返回值类型
IDamageSource
ZenGetter
ZenMethod
setDamageIsAbsolute();
返回值类型
IDamageSource
ZenGetter
ZenMethod
setDifficultyScaled();
返回值类型
IDamageSource
ZenGetter
ZenMethod
setExplosion();
返回值类型
IDamageSource
ZenGetter
ZenMethod
setFireDamage();
返回值类型
IDamageSource
ZenGetter
ZenMethod
setMagicDamage();
返回值类型
IDamageSource
ZenGetter
ZenMethod
setProjectile();
返回值类型
IDamageSource

带参数的ZenMethod

Link to 带参数的zenmethod

  • getDeathMessage(IEntity entity); → 如果实体死于这个伤害源(damageSource),返回一个包含死亡信息的字符串

获取 IDamageSource 对象

Link to 获取-idamagesource-对象

你也可以使用这些方法或 Damage Source Bracket Handler

ZenScript
Copy
crafttweaker.damage.IDamageSource.createMobDamage(IEntityLivingBase mob)
crafttweaker.damage.IDamageSource.createIndirectDamage(IEntity trueSource, IEntityLivingBase immediateSource)
crafttweaker.damage.IDamageSource.createPlayerDamage(IPlayer player)
crafttweaker.damage.IDamageSource.createThrownDamage(IEntity trueSource, @Optional IEntity immediateSource)
crafttweaker.damage.IDamageSource.createIndirectMagicDamage(IEntity trueSource, @Optional IEntity immediateSource)
crafttweaker.damage.IDamageSource.createThornsDamage(IEntity source)
crafttweaker.damage.IDamageSource.createExplosionDamage(@Optional IEntityLivingBase trueSource)
crafttweaker.damage.IDamageSource.createOfType(String type)
crafttweaker.damage.IDamageSource.createEntityDamage(String type, IEntity source)
crafttweaker.damage.IDamageSource.createIndirectDamage(String type, IEntity trueSource, @Optional IEntity immediateSource)

//Preregistered Damage Types
crafttweaker.damage.IDamageSource.IN_FIRE()
crafttweaker.damage.IDamageSource.LIGHTNING_BOLT()
crafttweaker.damage.IDamageSource.ON_FIRE()
crafttweaker.damage.IDamageSource.LAVA()
crafttweaker.damage.IDamageSource.HOT_FLOOR()
crafttweaker.damage.IDamageSource.IN_WALL()
crafttweaker.damage.IDamageSource.CRAMMING()
crafttweaker.damage.IDamageSource.DROWN()
crafttweaker.damage.IDamageSource.STARVE()
crafttweaker.damage.IDamageSource.CACTUS()
crafttweaker.damage.IDamageSource.FALL()
crafttweaker.damage.IDamageSource.FLY_INTO_WALL()
crafttweaker.damage.IDamageSource.OUT_OF_WORLD()
crafttweaker.damage.IDamageSource.GENERIC()
crafttweaker.damage.IDamageSource.MAGIC()
crafttweaker.damage.IDamageSource.WITHER()
crafttweaker.damage.IDamageSource.ANVIL()
crafttweaker.damage.IDamageSource.FALLING_BLOCK()
crafttweaker.damage.IDamageSource.DRAGON_BREATH()
crafttweaker.damage.IDamageSource.FIREWORKS()