2015-12-28 00:38:12 +00:00
|
|
|
package WayofTime.bloodmagic.item.sigil;
|
|
|
|
|
|
|
|
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
|
|
|
|
import WayofTime.bloodmagic.entity.projectile.EntityBloodLight;
|
|
|
|
import WayofTime.bloodmagic.item.ItemBindable;
|
|
|
|
import WayofTime.bloodmagic.registry.ModBlocks;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.BlockPos;
|
|
|
|
import net.minecraft.util.EnumFacing;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
|
|
|
public class ItemSigilBloodLight extends ItemSigilBase {
|
|
|
|
|
|
|
|
public ItemSigilBloodLight() {
|
|
|
|
super("bloodLight", 10);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
2015-12-29 19:32:35 +00:00
|
|
|
if (BindableHelper.checkAndSetItemOwner(stack, player) && ItemBindable.syphonBatteries(stack, player, getLPUsed() * 5) && !world.isRemote)
|
2015-12-28 00:38:12 +00:00
|
|
|
world.spawnEntityInWorld(new EntityBloodLight(world, player));
|
|
|
|
|
|
|
|
return stack;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
|
|
|
if (world.isRemote) return false;
|
|
|
|
|
2015-12-29 19:32:35 +00:00
|
|
|
if (BindableHelper.checkAndSetItemOwner(stack, player) && ItemBindable.syphonBatteries(stack, player, getLPUsed())) {
|
2015-12-28 00:38:12 +00:00
|
|
|
BlockPos newPos = blockPos.offset(side);
|
|
|
|
|
|
|
|
if (world.isAirBlock(newPos)) {
|
|
|
|
world.setBlockState(newPos, ModBlocks.bloodLight.getDefaultState());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|