Skip to content

Instantly share code, notes, and snippets.

Created February 15, 2015 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/58da0ba1e86b42987bab to your computer and use it in GitHub Desktop.
Save anonymous/58da0ba1e86b42987bab to your computer and use it in GitHub Desktop.
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