initial commit
This commit is contained in:
parent
3c9ee26b06
commit
22186c33b9
1458 changed files with 282792 additions and 0 deletions
45
java/src/game/entity/EntityDamageSourceIndirect.java
Executable file
45
java/src/game/entity/EntityDamageSourceIndirect.java
Executable file
|
@ -0,0 +1,45 @@
|
|||
package game.entity;
|
||||
|
||||
import game.color.TextColor;
|
||||
import game.entity.types.EntityLiving;
|
||||
import game.item.ItemStack;
|
||||
|
||||
public class EntityDamageSourceIndirect extends EntityDamageSource
|
||||
{
|
||||
private Entity indirectEntity;
|
||||
|
||||
public EntityDamageSourceIndirect(TextColor color, String display, String item, String kill, String killItem, Entity source, Entity indirectEntityIn)
|
||||
{
|
||||
super(color, display, item, kill, killItem, source);
|
||||
this.indirectEntity = indirectEntityIn;
|
||||
}
|
||||
|
||||
public EntityDamageSourceIndirect(TextColor color, String display, Entity source)
|
||||
{
|
||||
this(color, display, display, "", "", source, source);
|
||||
}
|
||||
|
||||
public Entity getSourceOfDamage()
|
||||
{
|
||||
return this.damageSourceEntity;
|
||||
}
|
||||
|
||||
public Entity getEntity()
|
||||
{
|
||||
return this.indirectEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the death message that is displayed when the player dies
|
||||
*
|
||||
* @param victim The EntityLivingBase that died
|
||||
*/
|
||||
public String getDeathMessage(EntityLiving victim)
|
||||
{
|
||||
String killer = this.indirectEntity == null ? this.damageSourceEntity.getColoredName(this.color) : this.indirectEntity.getColoredName(this.color);
|
||||
ItemStack item = this.indirectEntity instanceof EntityLiving ? ((EntityLiving)this.indirectEntity).getHeldItem() : null;
|
||||
// String s = "death.attack." + this.damageType;
|
||||
// String s1 = s + "Item";
|
||||
return item != null ? String.format(this.displayExtra, victim.getColoredName(this.color), killer, item.getColoredName(this.color)) : String.format(this.display, victim.getColoredName(this.color), killer);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue