EntityDamageSourceIndirect .java

net.minecraft.util.EntityDamageSourceIndirect (class, 41 lines): members: indirectEntity, getSourceOfDamage, getDeathMessage, getEntity. strings: ".item".

net.minecraft.utilclass41 linescommonextends EntityDamageSource1.5 KB

API Surface (3)

Entity getSourceOfDamage()
Entity getEntity()
IChatComponent getDeathMessage(EntityLivingBase entityLivingBaseIn)

Fields & Constants (1)

indirectEntity

String literals (2)

"death.attack."
".item"

Code Graph: Dependencies (6)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

EntityDamageSourceIndirect.java41 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.util;
2
3
import net.minecraft.entity.Entity;
4
import net.minecraft.entity.EntityLivingBase;
5
import net.minecraft.item.ItemStack;
6
7
public class EntityDamageSourceIndirect extends EntityDamageSource
8
{
9
    private Entity indirectEntity;
10
11
    public EntityDamageSourceIndirect(String damageTypeIn, Entity source, Entity indirectEntityIn)
12
    {
13
        super(damageTypeIn, source);
14
        this.indirectEntity = indirectEntityIn;
15
    }
16
17
    public Entity getSourceOfDamage()
18
    {
19
        return this.damageSourceEntity;
20
    }
21
22
    public Entity getEntity()
23
    {
24
        return this.indirectEntity;
25
    }
26
27
    /**
28
     * Gets the death message that is displayed when the player dies
29
     *  
30
     * @param entityLivingBaseIn The EntityLivingBase that died
31
     */
32
    public IChatComponent getDeathMessage(EntityLivingBase entityLivingBaseIn)
33
    {
34
        IChatComponent ichatcomponent = this.indirectEntity == null ? this.damageSourceEntity.getDisplayName() : this.indirectEntity.getDisplayName();
35
        ItemStack itemstack = this.indirectEntity instanceof EntityLivingBase ? ((EntityLivingBase)this.indirectEntity).getHeldItem() : null;
36
        String s = "death.attack." + this.damageType;
37
        String s1 = s + ".item";
38
        return itemstack != null && itemstack.hasDisplayName() && StatCollector.canTranslate(s1) ? new ChatComponentTranslation(s1, new Object[] {entityLivingBaseIn.getDisplayName(), ichatcomponent, itemstack.getChatComponent()}): new ChatComponentTranslation(s, new Object[] {entityLivingBaseIn.getDisplayName(), ichatcomponent});
39
    }
40
}
41

Deobfuscated MCP 1.8.9 source of EntityDamageSourceIndirect from Marcelektro/MavenMCP-1.8.9 (net/minecraft/util/EntityDamageSourceIndirect.java), stored verbatim.