use of WayofTime.bloodmagic.entity.projectile.EntityBloodLight in project BloodMagic by WayofTime.
the class ItemSigilBloodLight method onItemRightClick.
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if (stack.getItem() instanceof ISigil.Holding)
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
if (PlayerHelper.isFakePlayer(player))
return ActionResult.newResult(EnumActionResult.FAIL, stack);
RayTraceResult mop = this.rayTrace(world, player, false);
if (getCooldownRemainder(stack) > 0)
return super.onItemRightClick(world, player, hand);
if (mop != null && mop.typeOfHit == RayTraceResult.Type.BLOCK) {
BlockPos blockPos = mop.getBlockPos().offset(mop.sideHit);
if (world.isAirBlock(blockPos)) {
world.setBlockState(blockPos, RegistrarBloodMagicBlocks.BLOOD_LIGHT.getDefaultState());
if (!world.isRemote) {
SoulNetwork network = NetworkHelper.getSoulNetwork(getBinding(stack));
network.syphonAndDamage(player, getLpUsed());
}
resetCooldown(stack);
player.swingArm(hand);
return super.onItemRightClick(world, player, hand);
}
} else {
if (!world.isRemote) {
SoulNetwork network = NetworkHelper.getSoulNetwork(getBinding(stack));
world.spawnEntity(new EntityBloodLight(world, player));
network.syphonAndDamage(player, getLpUsed());
}
resetCooldown(stack);
}
return super.onItemRightClick(world, player, hand);
}
Aggregations