ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java

38 lines
1.4 KiB
Java
Raw Normal View History

/*
2016-05-16 22:52:27 +02:00
* This file ("DamageSources.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
2016-05-16 22:52:27 +02:00
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
2016-05-16 22:54:42 +02:00
* © 2015-2016 Ellpeck
*/
2016-01-05 04:47:35 +01:00
package de.ellpeck.actuallyadditions.mod.misc;
2016-01-05 04:47:35 +01:00
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
2016-03-18 23:47:22 +01:00
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
public class DamageSources extends DamageSource{
2015-11-19 15:26:54 +01:00
public static final DamageSource DAMAGE_ATOMIC_RECONSTRUCTOR = new DamageSources("atomicReconstructor", 5).setDamageBypassesArmor();
private int messageCount;
public DamageSources(String name, int messageCount){
super(name);
this.messageCount = messageCount;
}
@Override
2016-03-18 23:47:22 +01:00
public ITextComponent getDeathMessage(EntityLivingBase entity){
2016-04-20 21:39:03 +02:00
String locTag = "death."+ModUtil.MOD_ID+"."+this.damageType+"."+(Util.RANDOM.nextInt(this.messageCount)+1);
2016-03-18 23:47:22 +01:00
return new TextComponentString(StringUtil.localizeFormatted(locTag, entity.getName()));
}
}