Added an alchemy array, the Array of the Fast Miner

This commit is contained in:
WayofTime 2016-10-22 16:11:30 -04:00
parent 4e671d5132
commit 44e1c47e1c
6 changed files with 109 additions and 0 deletions

View file

@ -1,9 +1,14 @@
package WayofTime.bloodmagic.item.sigil;
import java.util.List;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class ItemSigilFastMiner extends ItemSigilToggleableBase
@ -18,4 +23,35 @@ public class ItemSigilFastMiner extends ItemSigilToggleableBase
{
player.addPotionEffect(new PotionEffect(MobEffects.HASTE, 2, 0, true, false));
}
@Override
public boolean performArrayEffect(World world, BlockPos pos)
{
double radius = 10;
int ticks = 600;
int potionPotency = 2;
AxisAlignedBB bb = new AxisAlignedBB(pos).expandXyz(radius);
List<EntityPlayer> playerList = world.getEntitiesWithinAABB(EntityPlayer.class, bb);
for (EntityPlayer player : playerList)
{
if (!player.isPotionActive(MobEffects.HASTE) || (player.isPotionActive(MobEffects.HASTE) && player.getActivePotionEffect(MobEffects.HASTE).getAmplifier() < potionPotency))
{
player.addPotionEffect(new PotionEffect(MobEffects.HASTE, ticks, potionPotency));
if (!player.capabilities.isCreativeMode)
{
player.hurtResistantTime = 0;
player.attackEntityFrom(BloodMagicAPI.getDamageSource(), 1.0F);
}
}
}
return false;
}
@Override
public boolean hasArrayEffect()
{
return true;
}
}