ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java

42 lines
1.3 KiB
Java
Raw Normal View History

/*
* 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
2016-01-03 16:05:51 +01:00
* http://ellpeck.de/actaddlicense/
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
2016-01-03 16:05:51 +01:00
* © 2016 Ellpeck
*/
2016-01-05 04:47:35 +01:00
package de.ellpeck.actuallyadditions.mod.items.lens;
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;
2016-01-08 13:31:58 +01:00
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.util.BlockPos;
public class LensDetonation extends Lens{
@Override
2016-01-08 13:31:58 +01:00
public boolean invoke(BlockPos hitBlock, IAtomicReconstructor tile){
if(hitBlock != null && !PosUtil.getBlock(hitBlock, tile.getWorldObject()).isAir(tile.getWorldObject(), hitBlock)){
int use = 250000;
2016-01-05 04:47:35 +01:00
if(tile.getEnergy() >= use){
tile.getWorldObject().newExplosion(null, hitBlock.getX()+0.5, hitBlock.getY()+0.5, hitBlock.getZ()+0.5, 10F, true, true);
2016-01-05 04:47:35 +01:00
tile.extractEnergy(use);
}
return true;
}
return false;
}
@Override
public float[] getColor(){
return new float[]{158F/255F, 43F/255F, 39F/255F};
}
@Override
public int getDistance(){
return 30;
}
2016-01-05 04:47:35 +01:00
}