2015-12-03 22:49:31 +01:00
|
|
|
/*
|
|
|
|
* This file ("LensDetonation.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
|
|
|
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
|
|
|
* © 2015 Ellpeck
|
|
|
|
*/
|
|
|
|
|
|
|
|
package ellpeck.actuallyadditions.items.lens;
|
|
|
|
|
|
|
|
import ellpeck.actuallyadditions.tile.TileEntityAtomicReconstructor;
|
2015-12-23 01:43:49 +01:00
|
|
|
import ellpeck.actuallyadditions.util.Position;
|
2015-12-03 22:49:31 +01:00
|
|
|
|
|
|
|
public class LensDetonation extends Lens{
|
|
|
|
|
|
|
|
@Override
|
2015-12-23 01:43:49 +01:00
|
|
|
public boolean invoke(Position hitBlock, TileEntityAtomicReconstructor tile){
|
|
|
|
if(hitBlock != null && !hitBlock.getBlock(tile.getWorldObj()).isAir(tile.getWorldObj(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ())){
|
2015-12-03 22:49:31 +01:00
|
|
|
int use = 500000;
|
|
|
|
if(tile.storage.getEnergyStored() >= use){
|
|
|
|
tile.getWorldObj().newExplosion(null, hitBlock.getX()+0.5, hitBlock.getY()+0.5, hitBlock.getZ()+0.5, 10F, true, true);
|
|
|
|
tile.storage.extractEnergy(use, false);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public float[] getColor(){
|
|
|
|
return new float[]{158F/255F, 43F/255F, 39F/255F};
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getDistance(){
|
|
|
|
return 30;
|
|
|
|
}
|
|
|
|
}
|