2015-12-03 22:49:31 +01:00
|
|
|
/*
|
|
|
|
* This file ("LensDeath.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-12-03 22:49:31 +01:00
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2016-01-03 16:05:51 +01:00
|
|
|
* © 2016 Ellpeck
|
2015-12-03 22:49:31 +01:00
|
|
|
*/
|
|
|
|
|
2016-01-05 04:47:35 +01:00
|
|
|
package de.ellpeck.actuallyadditions.mod.items.lens;
|
2015-12-03 22:49:31 +01:00
|
|
|
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.api.Position;
|
2016-01-05 14:57:50 +01:00
|
|
|
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
2016-01-05 04:47:35 +01:00
|
|
|
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.misc.DamageSources;
|
2015-12-03 22:49:31 +01:00
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
|
|
import net.minecraft.util.AxisAlignedBB;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
public class LensDeath extends Lens{
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@Override
|
2016-01-05 04:47:35 +01:00
|
|
|
public boolean invoke(Position hitBlock, IAtomicReconstructor tile){
|
2015-12-03 22:49:31 +01:00
|
|
|
int use = 150; //Per Block (because it doesn't only activate when something is hit like the other lenses!)
|
2016-01-05 04:47:35 +01:00
|
|
|
if(tile.getEnergy() >= use){
|
|
|
|
tile.extractEnergy(use);
|
2015-12-03 22:49:31 +01:00
|
|
|
|
2016-01-07 23:42:42 +01:00
|
|
|
ArrayList<EntityLivingBase> entities = (ArrayList<EntityLivingBase>)tile.getWorldObject().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.fromBounds(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1));
|
2015-12-03 22:49:31 +01:00
|
|
|
for(EntityLivingBase entity : entities){
|
|
|
|
entity.attackEntityFrom(DamageSources.DAMAGE_ATOMIC_RECONSTRUCTOR, 20F);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-07 23:42:42 +01:00
|
|
|
return hitBlock != null && !hitBlock.getBlock(tile.getWorldObject()).isAir(tile.getWorldObject(), hitBlock);
|
2015-12-03 22:49:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public float[] getColor(){
|
|
|
|
return new float[]{188F/255F, 222F/255F, 1F};
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getDistance(){
|
|
|
|
return 15;
|
|
|
|
}
|
|
|
|
}
|