mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-26 15:03:03 +00:00
38 lines
1.3 KiB
Java
38 lines
1.3 KiB
Java
/**
|
|
* This class was created by
|
|
<Vazkii>. It's distributed as
|
|
* part of the Botania Mod. Get the Source Code in github:
|
|
* https://github.com/Vazkii/Botania
|
|
*
|
|
* Botania is Open Source and distributed under the
|
|
* Botania License: http://botaniamod.net/license.php
|
|
*
|
|
* File Created @ [Jan 24, 2015, 4:41:44 PM (GMT)]
|
|
*/
|
|
package vazkii.botania.common.item.lens;
|
|
|
|
import net.minecraft.entity.projectile.ThrowableEntity;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.util.math.BlockRayTraceResult;
|
|
import net.minecraft.util.math.EntityRayTraceResult;
|
|
import net.minecraft.util.math.RayTraceResult;
|
|
import net.minecraft.world.Explosion;
|
|
import vazkii.botania.api.internal.IManaBurst;
|
|
|
|
public class LensExplosive extends Lens {
|
|
|
|
@Override
|
|
public boolean collideBurst(IManaBurst burst, ThrowableEntity entity, RayTraceResult pos, boolean isManaBlock, boolean dead, ItemStack stack) {
|
|
if(!entity.world.isRemote && !burst.isFake() && pos.getType() == RayTraceResult.Type.BLOCK) {
|
|
BlockPos coords = burst.getBurstSourceBlockPos();
|
|
if(!isManaBlock && !coords.equals(((BlockRayTraceResult) pos).getPos()))
|
|
entity.world.createExplosion(entity, entity.posX, entity.posY, entity.posZ,
|
|
burst.getMana() / 50F, Explosion.Mode.BREAK);
|
|
} else dead = false;
|
|
|
|
return dead;
|
|
}
|
|
|
|
}
|