2015-11-15 14:25:12 +01: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-01-03 16:05:51 +01:00
|
|
|
* http://ellpeck.de/actaddlicense/
|
2015-11-15 14:25:12 +01:00
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2016-01-03 16:05:51 +01:00
|
|
|
* © 2016 Ellpeck
|
2015-11-15 14:25:12 +01:00
|
|
|
*/
|
|
|
|
|
2016-01-05 04:47:35 +01:00
|
|
|
package de.ellpeck.actuallyadditions.mod.misc;
|
2015-11-15 14:25:12 +01:00
|
|
|
|
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;
|
2015-11-15 14:25:12 +01:00
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
|
|
import net.minecraft.util.ChatComponentText;
|
|
|
|
import net.minecraft.util.DamageSource;
|
|
|
|
import net.minecraft.util.IChatComponent;
|
|
|
|
|
|
|
|
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();
|
2015-11-15 14:25:12 +01:00
|
|
|
|
|
|
|
private int messageCount;
|
|
|
|
|
|
|
|
public DamageSources(String name, int messageCount){
|
|
|
|
super(name);
|
|
|
|
this.messageCount = messageCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-01-08 08:10:55 +01:00
|
|
|
public IChatComponent getDeathMessage(EntityLivingBase entity){
|
2015-11-22 18:58:23 +01:00
|
|
|
String locTag = "death."+ModUtil.MOD_ID_LOWER+"."+this.damageType+"."+(Util.RANDOM.nextInt(this.messageCount)+1);
|
2016-01-08 08:10:55 +01:00
|
|
|
return new ChatComponentText(StringUtil.localizeFormatted(locTag, entity.getName()));
|
2015-11-15 14:25:12 +01:00
|
|
|
}
|
|
|
|
}
|