Skip to content

Instantly share code, notes, and snippets.

/gist:58da0ba1e86b42987bab Secret

Created Feb 15, 2015
Embed
What would you like to do?
if(event.source.isProjectile()){
Entity strikingArrow = event.source.getSourceOfDamage();
{
if(enchant.allowSlowAoe||enchant.allowPoisonAoe||enchant.allowWitherAOE){
if(Utils.getEnchHelp(player,Enchantments.slowAoe.effectId,player.getHeldItem()) != 0 || (Utils.getEnchHelp(player,Enchantments.poisonAoe.effectId,player.getHeldItem()) != 0|| (Utils.getEnchHelp(player,Enchantments.witherAoe.effectId,player.getHeldItem()) != 0)))
{
int level = 0;
float splashDamage = event.ammount * (level * 0.13F);
AxisAlignedBB boundBox = AxisAlignedBB.getBoundingBox(strikingArrow.posX-3, strikingArrow.posY-3, strikingArrow.posZ-3, strikingArrow.posX+3, strikingArrow.posY+3, strikingArrow.posZ+3);
ArrayList<Entity> targetEntities = new ArrayList<Entity>(strikingArrow.worldObj.getEntitiesWithinAABBExcludingEntity(event.entity, boundBox));
ListIterator<Entity> itr = targetEntities.listIterator();
while(itr.hasNext())
{
Entity target = itr.next();
if(target instanceof EntityLivingBase)
{
if(enchant.allowSlowAoe){
if(Utils.getEnchHelp(player,Enchantments.slowAoe.effectId,player.getHeldItem()) != 0)
{
((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, (Enchantments.slowAOETimer*20), Utils.getEnchHelp(player,Enchantments.slowAoe.effectId,player.getHeldItem())));
target.attackEntityFrom(DamageSource.magic, splashDamage);
}
}
if(enchant.allowPoisonAoe){
if(Utils.getEnchHelp(player,Enchantments.poisonAoe.effectId,player.getHeldItem()) != 0)
{
((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.poison.id, (Enchantments.poisonAOETimer*20), Utils.getEnchHelp(player,Enchantments.poisonAoe.effectId,player.getHeldItem())));
target.attackEntityFrom(DamageSource.magic, splashDamage);
}
}
if(enchant.allowWitherAOE){
if(Utils.getEnchHelp(player,Enchantments.witherAoe.effectId,player.getHeldItem()) != 0)
{
((EntityLivingBase)target).addPotionEffect(new PotionEffect(Potion.wither.id, (Enchantments.witherAOETimer *20), Utils.getEnchHelp(player,Enchantments.witherAoe.effectId,player.getHeldItem())));
target.attackEntityFrom(DamageSource.magic, splashDamage);
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.